9a5720e8ad
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Branch Policy Check / Verify merge target (pull_request) Successful in 1s
PR RC Release / Build RC Release (pull_request) Successful in 3s
Universal: PR Check / Validate PR (pull_request) Failing after 6s
Branch Cleanup / Delete merged branch (pull_request) Successful in 1s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Full namespace migration: update the Go module path and all import statements from git.mokoconsulting.tech to code.mokoconsulting.tech. Also updates all URL references in templates, workflows, configs, tests, and documentation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package packages
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
|
|
packages_model "code.mokoconsulting.tech/MokoConsulting/MokoGitea/models/packages"
|
|
user_model "code.mokoconsulting.tech/MokoConsulting/MokoGitea/models/user"
|
|
)
|
|
|
|
type nop struct{}
|
|
|
|
func (n *nop) GetViewPackageVersionData(ctx context.Context, pd *packages_model.PackageDescriptor) (any, error) {
|
|
return nil, nil //nolint:nilnil // no data, no error
|
|
}
|
|
|
|
func (n *nop) OnBeforeRemovePackageAll(ctx context.Context, doer *user_model.User, pkg *packages_model.Package, pds []*packages_model.PackageDescriptor) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *nop) OnBeforeRemovePackageVersion(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) error {
|
|
return nil
|
|
}
|
|
|
|
var _ Specialization = (*nop)(nil)
|
|
|
|
type SpecManagerType struct {
|
|
specMap map[packages_model.Type]Specialization
|
|
}
|
|
|
|
func (m *SpecManagerType) Add(t packages_model.Type, spec Specialization) {
|
|
m.specMap[t] = spec
|
|
}
|
|
|
|
func (m *SpecManagerType) Get(t packages_model.Type) Specialization {
|
|
if len(m.specMap) == 0 {
|
|
panic("specialization not initialized")
|
|
}
|
|
spec := m.specMap[t]
|
|
if spec == nil {
|
|
return &nop{}
|
|
}
|
|
return spec
|
|
}
|
|
|
|
var GetSpecManager = sync.OnceValue(func() *SpecManagerType {
|
|
return &SpecManagerType{specMap: make(map[packages_model.Type]Specialization)}
|
|
})
|