feat: bump up golang-runtime from 1.20.7 to 1.21.7 (#20046)

* feat: bump up golang-runtime from 1.20.7 to 1.21.7

Signed-off-by: Shengwen Yu <yshengwen@vmware.com>

* fix: update code to comply golangci-lint

Signed-off-by: Shengwen Yu <yshengwen@vmware.com>

* fix: update the mocks per the change of source code

Signed-off-by: Shengwen Yu <yshengwen@vmware.com>

---------

Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
This commit is contained in:
Shengwen YU 2024-02-29 19:33:29 +08:00 committed by GitHub
parent 93bdcf5c58
commit 7103af0264
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
166 changed files with 374 additions and 360 deletions

View File

@ -33,10 +33,10 @@ jobs:
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v1
with:
go-version: 1.20.7
go-version: 1.21.7
id: go
- uses: actions/checkout@v3
with:
@ -94,10 +94,10 @@ jobs:
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v1
with:
go-version: 1.20.7
go-version: 1.21.7
id: go
- uses: actions/checkout@v3
with:
@ -149,10 +149,10 @@ jobs:
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v1
with:
go-version: 1.20.7
go-version: 1.21.7
id: go
- uses: actions/checkout@v3
with:
@ -204,10 +204,10 @@ jobs:
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v1
with:
go-version: 1.20.7
go-version: 1.21.7
id: go
- uses: actions/checkout@v3
with:
@ -257,10 +257,10 @@ jobs:
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v1
with:
go-version: 1.20.7
go-version: 1.21.7
id: go
- uses: actions/checkout@v3
with:

View File

@ -23,10 +23,10 @@ jobs:
with:
version: '430.0.0'
- run: gcloud info
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v1
with:
go-version: 1.20.7
go-version: 1.21.7
id: go
- name: Setup Docker
uses: docker-practice/actions-setup-docker@master

View File

@ -25,10 +25,10 @@ jobs:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- uses: google-github-actions/setup-gcloud@v0
- run: gcloud info
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v1
with:
go-version: 1.20.7
go-version: 1.21.7
id: go
- uses: actions/checkout@v3
with:

View File

@ -145,27 +145,27 @@ The folder graph below shows the structure of the source code folder `harbor/src
#### Go
Harbor backend is written in [Go](http://golang.org/). If you don't have a Harbor backend service development environment, please [set one up](https://golang.org/doc/install).
| Harbor | Requires Go |
|----------|---------------|
| 1.1 | 1.7.3 |
| 1.2 | 1.7.3 |
| 1.3 | 1.9.2 |
| 1.4 | 1.9.2 |
| 1.5 | 1.9.2 |
| 1.6 | 1.9.2 |
| 1.7 | 1.9.2 |
| 1.8 | 1.11.2 |
| 1.9 | 1.12.12 |
| 1.10 | 1.12.12 |
| 2.0 | 1.13.15 |
| 2.1 | 1.14.13 |
| 2.2 | 1.15.6 |
| 2.3 | 1.15.12 |
| 2.4 | 1.17.7 |
| 2.5 | 1.17.7 |
| 2.6 | 1.18.6 |
| 2.7 | 1.19.4 |
| 2.8 | 1.20.7 |
| Harbor | Requires Go |
|----------|-------------|
| 1.1 | 1.7.3 |
| 1.2 | 1.7.3 |
| 1.3 | 1.9.2 |
| 1.4 | 1.9.2 |
| 1.5 | 1.9.2 |
| 1.6 | 1.9.2 |
| 1.7 | 1.9.2 |
| 1.8 | 1.11.2 |
| 1.9 | 1.12.12 |
| 1.10 | 1.12.12 |
| 2.0 | 1.13.15 |
| 2.1 | 1.14.13 |
| 2.2 | 1.15.6 |
| 2.3 | 1.15.12 |
| 2.4 | 1.17.7 |
| 2.5 | 1.17.7 |
| 2.6 | 1.18.6 |
| 2.7 | 1.19.4 |
| 2.8 | 1.21.7 |
Ensure your GOPATH and PATH have been configured in accordance with the Go environment instructions.

View File

@ -145,7 +145,7 @@ GOINSTALL=$(GOCMD) install
GOTEST=$(GOCMD) test
GODEP=$(GOTEST) -i
GOFMT=gofmt -w
GOVERSION=1.20.7
GOVERSION=1.21.7
GOBUILDIMAGE=goharbor/golang:$(GOVERSION)
PUSHGOIMAGE=false
GOBUILDPATHINCONTAINER=/harbor
@ -510,7 +510,7 @@ misspell:
@find . -type d \( -path ./src/vendor -o -path ./tests \) -prune -o -name '*.go' -print | xargs misspell -error
# golangci-lint binary installation or refer to https://golangci-lint.run/usage/install/#local-installation
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
GOLANGCI_LINT := $(shell go env GOPATH)/bin/golangci-lint
lint:
@echo checking lint

View File

@ -12,7 +12,7 @@ ENV GOLANG_VERSION ${GOVERSION}
RUN set eux; \
url="https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz"; \
sha256="f0a87f1bcae91c4b69f8dc2bc6d7e6bfcd7524fceec130af525058c0c17b1b44"; \
sha256="13b76a9b2a26823e53062fa841b07087d48ae2ef2936445dc34c4ae03293702c"; \
wget -O go.tgz.asc "$url.asc"; \
wget -O go.tgz "$url"; \
echo "$sha256 *go.tgz" | sha256sum -c -; \

View File

@ -1,4 +1,4 @@
FROM goharbor/golang:1.20.7
FROM goharbor/golang:1.21.7
ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution
ENV BUILDTAGS include_oss include_gcs

View File

@ -1,4 +1,4 @@
FROM goharbor/golang:1.20.7
FROM goharbor/golang:1.21.7
ADD . /go/src/github.com/aquasecurity/harbor-scanner-trivy/
WORKDIR /go/src/github.com/aquasecurity/harbor-scanner-trivy/

View File

@ -19,7 +19,7 @@ TEMP=$(mktemp -d ${TMPDIR-/tmp}/trivy-adapter.XXXXXX)
git clone https://github.com/aquasecurity/harbor-scanner-trivy.git $TEMP
cd $TEMP; git checkout $VERSION; cd -
echo "Building Trivy adapter binary based on goharbor/golang:1.20.7..."
echo "Building Trivy adapter binary based on goharbor/golang:1.21.7..."
cp Dockerfile.binary $TEMP
docker build -f $TEMP/Dockerfile.binary -t trivy-adapter-golang $TEMP

View File

@ -58,7 +58,7 @@ func NewBuilderForUser(user *models.User, ctl project.Controller) RBACUserBuilde
// NewBuilderForPolicies create a builder for the policies
func NewBuilderForPolicies(username string, policies []*types.Policy,
filters ...func(*proModels.Project, []*types.Policy) []*types.Policy) RBACUserBuilder {
return func(ctx context.Context, p *proModels.Project) types.RBACUser {
return func(_ context.Context, p *proModels.Project) types.RBACUser {
for _, filter := range filters {
policies = filter(p, policies)
}

View File

@ -11,7 +11,7 @@ import (
// NewEvaluator create evaluator for the system
func NewEvaluator(username string, policies []*types.Policy) evaluator.Evaluator {
return namespace.New(NamespaceKind, func(ctx context.Context, ns types.Namespace) evaluator.Evaluator {
return namespace.New(NamespaceKind, func(_ context.Context, _ types.Namespace) evaluator.Evaluator {
return rbac.New(&rbacUser{
username: username,
policies: policies,

View File

@ -77,7 +77,7 @@ func (s *SecurityContext) IsSolutionUser() bool {
// Can returns whether the user can do action on resource
// returns true if the corresponding user of the secret
// is jobservice or core service, otherwise returns false
func (s *SecurityContext) Can(ctx context.Context, action types.Action, resource types.Resource) bool {
func (s *SecurityContext) Can(_ context.Context, _ types.Action, _ types.Resource) bool {
if s.store == nil {
return false
}

View File

@ -49,7 +49,7 @@ func (t *tokenSecurityCtx) GetMyProjects() ([]*models.Project, error) {
return []*models.Project{}, nil
}
func (t *tokenSecurityCtx) GetProjectRoles(projectIDOrName interface{}) []int {
func (t *tokenSecurityCtx) GetProjectRoles(_ interface{}) []int {
return []int{}
}

View File

@ -30,7 +30,7 @@ type GCResult struct {
}
// NewRegistryCtl returns a mock registry server
func NewRegistryCtl(config map[string]interface{}) (*httptest.Server, error) {
func NewRegistryCtl(_ map[string]interface{}) (*httptest.Server, error) {
m := []*RequestHandlerMapping{}
gcr := GCResult{true, "hello-world", time.Now(), time.Now()}

View File

@ -49,7 +49,7 @@ func (fc *FakeClient) GetUserInfo(token string) (*UserInfo, error) {
}
// UpdateConfig ...
func (fc *FakeClient) UpdateConfig(cfg *ClientConfig) error {
func (fc *FakeClient) UpdateConfig(_ *ClientConfig) error {
return nil
}

View File

@ -25,7 +25,7 @@ type v1alpha1Parser struct {
regCli reg.Client
}
func (p *v1alpha1Parser) Parse(ctx context.Context, artifact *artifact.Artifact, manifest []byte) error {
func (p *v1alpha1Parser) Parse(_ context.Context, artifact *artifact.Artifact, manifest []byte) error {
if artifact.ManifestMediaType != v1.MediaTypeImageManifest && artifact.ManifestMediaType != schema2.MediaTypeManifest {
return nil
}

View File

@ -37,22 +37,22 @@ type IndexProcessor struct {
}
// AbstractMetadata abstracts metadata of artifact
func (m *IndexProcessor) AbstractMetadata(ctx context.Context, artifact *artifact.Artifact, content []byte) error {
func (m *IndexProcessor) AbstractMetadata(_ context.Context, _ *artifact.Artifact, _ []byte) error {
return nil
}
// AbstractAddition abstracts the addition of artifact
func (m *IndexProcessor) AbstractAddition(ctx context.Context, artifact *artifact.Artifact, addition string) (*processor.Addition, error) {
func (m *IndexProcessor) AbstractAddition(_ context.Context, _ *artifact.Artifact, addition string) (*processor.Addition, error) {
return nil, errors.New(nil).WithCode(errors.BadRequestCode).
WithMessage("addition %s isn't supported", addition)
}
// GetArtifactType returns the artifact type
func (m *IndexProcessor) GetArtifactType(ctx context.Context, artifact *artifact.Artifact) string {
func (m *IndexProcessor) GetArtifactType(_ context.Context, _ *artifact.Artifact) string {
return ""
}
// ListAdditionTypes returns the supported addition types
func (m *IndexProcessor) ListAdditionTypes(ctx context.Context, artifact *artifact.Artifact) []string {
func (m *IndexProcessor) ListAdditionTypes(_ context.Context, _ *artifact.Artifact) []string {
return nil
}

View File

@ -64,23 +64,23 @@ func (m *ManifestProcessor) AbstractMetadata(ctx context.Context, artifact *arti
}
// AbstractAddition abstracts the addition of artifact
func (m *ManifestProcessor) AbstractAddition(ctx context.Context, artifact *artifact.Artifact, addition string) (*processor.Addition, error) {
func (m *ManifestProcessor) AbstractAddition(_ context.Context, _ *artifact.Artifact, addition string) (*processor.Addition, error) {
return nil, errors.New(nil).WithCode(errors.BadRequestCode).
WithMessage("addition %s isn't supported", addition)
}
// GetArtifactType returns the artifact type
func (m *ManifestProcessor) GetArtifactType(ctx context.Context, artifact *artifact.Artifact) string {
func (m *ManifestProcessor) GetArtifactType(_ context.Context, _ *artifact.Artifact) string {
return ""
}
// ListAdditionTypes returns the supported addition types
func (m *ManifestProcessor) ListAdditionTypes(ctx context.Context, artifact *artifact.Artifact) []string {
func (m *ManifestProcessor) ListAdditionTypes(_ context.Context, _ *artifact.Artifact) []string {
return nil
}
// UnmarshalConfig unmarshal the config blob of the artifact into the specified object "v"
func (m *ManifestProcessor) UnmarshalConfig(ctx context.Context, repository string, manifest []byte, v interface{}) error {
func (m *ManifestProcessor) UnmarshalConfig(_ context.Context, repository string, manifest []byte, v interface{}) error {
// unmarshal manifest
mani := &v1.Manifest{}
if err := json.Unmarshal(manifest, mani); err != nil {

View File

@ -58,7 +58,7 @@ type processor struct {
chartOperator chart.Operator
}
func (p *processor) AbstractAddition(ctx context.Context, artifact *artifact.Artifact, addition string) (*ps.Addition, error) {
func (p *processor) AbstractAddition(_ context.Context, artifact *artifact.Artifact, addition string) (*ps.Addition, error) {
if addition != AdditionTypeValues && addition != AdditionTypeReadme && addition != AdditionTypeDependencies {
return nil, errors.New(nil).WithCode(errors.BadRequestCode).
WithMessage("addition %s isn't supported for %s", addition, ArtifactTypeChart)
@ -122,10 +122,10 @@ func (p *processor) AbstractAddition(ctx context.Context, artifact *artifact.Art
return nil, nil
}
func (p *processor) GetArtifactType(ctx context.Context, artifact *artifact.Artifact) string {
func (p *processor) GetArtifactType(_ context.Context, _ *artifact.Artifact) string {
return ArtifactTypeChart
}
func (p *processor) ListAdditionTypes(ctx context.Context, artifact *artifact.Artifact) []string {
func (p *processor) ListAdditionTypes(_ context.Context, _ *artifact.Artifact) []string {
return []string{AdditionTypeValues, AdditionTypeReadme, AdditionTypeDependencies}
}

View File

@ -45,7 +45,7 @@ type processor struct {
manifestProcessor *base.ManifestProcessor
}
func (p *processor) AbstractMetadata(ctx context.Context, art *artifact.Artifact, manifest []byte) error {
func (p *processor) AbstractMetadata(ctx context.Context, art *artifact.Artifact, _ []byte) error {
cfgManiDgt := ""
// try to get the digest of the manifest that the config layer is referenced by
for _, reference := range art.References {
@ -72,6 +72,6 @@ func (p *processor) AbstractMetadata(ctx context.Context, art *artifact.Artifact
return p.manifestProcessor.AbstractMetadata(ctx, art, payload)
}
func (p *processor) GetArtifactType(ctx context.Context, artifact *artifact.Artifact) string {
func (p *processor) GetArtifactType(_ context.Context, _ *artifact.Artifact) string {
return ArtifactTypeCNAB
}

View File

@ -48,7 +48,7 @@ type defaultProcessor struct {
regCli registry.Client
}
func (d *defaultProcessor) GetArtifactType(ctx context.Context, artifact *artifact.Artifact) string {
func (d *defaultProcessor) GetArtifactType(_ context.Context, artifact *artifact.Artifact) string {
// try to parse the type from the media type
strs := artifactTypeRegExp.FindStringSubmatch(artifact.MediaType)
if len(strs) == 2 {
@ -57,7 +57,7 @@ func (d *defaultProcessor) GetArtifactType(ctx context.Context, artifact *artifa
// can not get the artifact type from the media type, return unknown
return ArtifactTypeUnknown
}
func (d *defaultProcessor) ListAdditionTypes(ctx context.Context, artifact *artifact.Artifact) []string {
func (d *defaultProcessor) ListAdditionTypes(_ context.Context, _ *artifact.Artifact) []string {
return nil
}
@ -126,7 +126,7 @@ func (d *defaultProcessor) AbstractMetadata(ctx context.Context, artifact *artif
return nil
}
func (d *defaultProcessor) AbstractAddition(ctx context.Context, artifact *artifact.Artifact, addition string) (*Addition, error) {
func (d *defaultProcessor) AbstractAddition(_ context.Context, artifact *artifact.Artifact, _ string) (*Addition, error) {
// Addition not support for user-defined artifact yet.
// It will be support in the future.
// return error directly

View File

@ -44,6 +44,6 @@ type indexProcessor struct {
*base.IndexProcessor
}
func (i *indexProcessor) GetArtifactType(ctx context.Context, artifact *artifact.Artifact) string {
func (i *indexProcessor) GetArtifactType(_ context.Context, _ *artifact.Artifact) string {
return ArtifactTypeImage
}

View File

@ -38,7 +38,7 @@ func init() {
type manifestV1Processor struct {
}
func (m *manifestV1Processor) AbstractMetadata(ctx context.Context, artifact *artifact.Artifact, manifest []byte) error {
func (m *manifestV1Processor) AbstractMetadata(_ context.Context, artifact *artifact.Artifact, manifest []byte) error {
mani := &schema1.Manifest{}
if err := json.Unmarshal(manifest, mani); err != nil {
return err
@ -50,15 +50,15 @@ func (m *manifestV1Processor) AbstractMetadata(ctx context.Context, artifact *ar
return nil
}
func (m *manifestV1Processor) AbstractAddition(ctx context.Context, artifact *artifact.Artifact, addition string) (*processor.Addition, error) {
func (m *manifestV1Processor) AbstractAddition(_ context.Context, _ *artifact.Artifact, addition string) (*processor.Addition, error) {
return nil, errors.New(nil).WithCode(errors.BadRequestCode).
WithMessage("addition %s isn't supported for %s(manifest version 1)", addition, ArtifactTypeImage)
}
func (m *manifestV1Processor) GetArtifactType(ctx context.Context, artifact *artifact.Artifact) string {
func (m *manifestV1Processor) GetArtifactType(_ context.Context, _ *artifact.Artifact) string {
return ArtifactTypeImage
}
func (m *manifestV1Processor) ListAdditionTypes(ctx context.Context, artifact *artifact.Artifact) []string {
func (m *manifestV1Processor) ListAdditionTypes(_ context.Context, _ *artifact.Artifact) []string {
return nil
}

View File

@ -112,10 +112,10 @@ func (m *manifestV2Processor) AbstractAddition(ctx context.Context, artifact *ar
}, nil
}
func (m *manifestV2Processor) GetArtifactType(ctx context.Context, artifact *artifact.Artifact) string {
func (m *manifestV2Processor) GetArtifactType(_ context.Context, _ *artifact.Artifact) string {
return ArtifactTypeImage
}
func (m *manifestV2Processor) ListAdditionTypes(ctx context.Context, artifact *artifact.Artifact) []string {
func (m *manifestV2Processor) ListAdditionTypes(_ context.Context, _ *artifact.Artifact) []string {
return []string{AdditionTypeBuildHistory}
}

View File

@ -128,10 +128,10 @@ func (m *Processor) AbstractAddition(ctx context.Context, artifact *artifact.Art
}, nil
}
func (m *Processor) GetArtifactType(ctx context.Context, artifact *artifact.Artifact) string {
func (m *Processor) GetArtifactType(_ context.Context, _ *artifact.Artifact) string {
return ArtifactTypeWASM
}
func (m *Processor) ListAdditionTypes(ctx context.Context, artifact *artifact.Artifact) []string {
func (m *Processor) ListAdditionTypes(_ context.Context, _ *artifact.Artifact) []string {
return []string{AdditionTypeBuildHistory}
}

View File

@ -169,7 +169,7 @@ func verifySkipAuditLogCfg(ctx context.Context, cfgs map[string]interface{}, mgr
}
// verifyValueLengthCfg verifies the cfgs which need to check the value max length to align with frontend.
func verifyValueLengthCfg(ctx context.Context, cfgs map[string]interface{}) error {
func verifyValueLengthCfg(_ context.Context, cfgs map[string]interface{}) error {
maxValue := maxValueLimitedByLength(common.UIMaxLengthLimitedOfNumber)
validateCfgs := []string{
common.TokenExpiration,

View File

@ -144,7 +144,7 @@ func (a *Handler) onPull(ctx context.Context, event *event.ArtifactEvent) error
return nil
}
func (a *Handler) updatePullTimeInCache(ctx context.Context, event *event.ArtifactEvent) {
func (a *Handler) updatePullTimeInCache(_ context.Context, event *event.ArtifactEvent) {
var tagName string
if len(event.Tags) != 0 {
tagName = event.Tags[0]
@ -158,7 +158,7 @@ func (a *Handler) updatePullTimeInCache(ctx context.Context, event *event.Artifa
a.pullTimeStore[key] = time.Now()
}
func (a *Handler) addPullCountInCache(ctx context.Context, event *event.ArtifactEvent) {
func (a *Handler) addPullCountInCache(_ context.Context, event *event.ArtifactEvent) {
a.pullCountLock.Lock()
defer a.pullCountLock.Unlock()

View File

@ -48,7 +48,7 @@ func gcCallback(ctx context.Context, p string) error {
return err
}
func gcTaskStatusChange(ctx context.Context, taskID int64, status string) error {
func gcTaskStatusChange(ctx context.Context, _ int64, status string) error {
if status == job.SuccessStatus.String() && config.QuotaPerProjectEnable(ctx) {
go func() {
err := quota.RefreshForProjects(orm.Context())

View File

@ -41,7 +41,7 @@ type Controller interface {
type controller struct{}
func (c *controller) GetHealth(ctx context.Context) *OverallHealthStatus {
func (c *controller) GetHealth(_ context.Context) *OverallHealthStatus {
var isHealthy healthy = true
components := []*ComponentHealthStatus{}
ch := make(chan *ComponentHealthStatus, len(registry))

View File

@ -469,7 +469,7 @@ func (c *controller) ListPoliciesByProject(ctx context.Context, project int64, q
}
// CheckHealth checks the instance health, for test connection
func (c *controller) CheckHealth(ctx context.Context, instance *providerModels.Instance) error {
func (c *controller) CheckHealth(_ context.Context, instance *providerModels.Instance) error {
if instance == nil {
return errors.New("instance can not be nil")
}

View File

@ -150,9 +150,8 @@ func (c *controller) Exists(ctx context.Context, projectIDOrName interface{}) (b
return true, nil
} else if errors.IsNotFoundErr(err) {
return false, nil
} else {
return false, err
}
return false, err
}
func (c *controller) Get(ctx context.Context, projectIDOrName interface{}, options ...Option) (*models.Project, error) {

View File

@ -101,15 +101,18 @@ func (c *controller) EnsureTag(ctx context.Context, art lib.ArtifactInfo, tagNam
// search the digest in cache and query with trimmed digest
var trimmedDigest string
err := c.cache.Fetch(ctx, TrimmedManifestlist+art.Digest, &trimmedDigest)
if errors.Is(err, cache.ErrNotFound) {
// skip to update digest, continue
} else if err != nil {
// for other error, return
return err
} else {
// found in redis, update the digest
if err == nil {
// it's found in redis, update the digest
art.Digest = trimmedDigest
log.Debugf("Found trimmed digest: %v", trimmedDigest)
} else {
// err != nil
if !errors.Is(err, cache.ErrNotFound) {
// for non-NotFound error return the error
return err
}
// else:
// err is a NotFound error, skip to update digest, continue
}
a, err := c.local.GetManifest(ctx, art)
if err != nil {
@ -260,7 +263,7 @@ func (c *controller) ProxyManifest(ctx context.Context, art lib.ArtifactInfo, re
return man, nil
}
func (c *controller) HeadManifest(ctx context.Context, art lib.ArtifactInfo, remote RemoteInterface) (bool, *distribution.Descriptor, error) {
func (c *controller) HeadManifest(_ context.Context, art lib.ArtifactInfo, remote RemoteInterface) (bool, *distribution.Descriptor, error) {
remoteRepo := getRemoteRepo(art)
ref := getReference(art)
return remote.ManifestExist(remoteRepo, ref)

View File

@ -81,7 +81,7 @@ func newLocalHelper() localInterface {
return l
}
func (l *localHelper) BlobExist(ctx context.Context, art lib.ArtifactInfo) (bool, error) {
func (l *localHelper) BlobExist(_ context.Context, art lib.ArtifactInfo) (bool, error) {
return l.registry.BlobExist(art.Repository, art.Digest)
}

View File

@ -63,7 +63,7 @@ type ManifestListCache struct {
}
// CacheContent ...
func (m *ManifestListCache) CacheContent(ctx context.Context, remoteRepo string, man distribution.Manifest, art lib.ArtifactInfo, r RemoteInterface, contentType string) {
func (m *ManifestListCache) CacheContent(ctx context.Context, _ string, man distribution.Manifest, art lib.ArtifactInfo, _ RemoteInterface, contentType string) {
_, payload, err := man.Payload()
if err != nil {
log.Errorf("failed to get payload, error %v", err)
@ -171,7 +171,7 @@ type ManifestCache struct {
}
// CacheContent ...
func (m *ManifestCache) CacheContent(ctx context.Context, remoteRepo string, man distribution.Manifest, art lib.ArtifactInfo, r RemoteInterface, contentType string) {
func (m *ManifestCache) CacheContent(ctx context.Context, remoteRepo string, man distribution.Manifest, art lib.ArtifactInfo, r RemoteInterface, _ string) {
var waitBlobs []distribution.Descriptor
for n := 0; n < maxManifestWait; n++ {
time.Sleep(sleepIntervalSec * time.Second)

View File

@ -198,7 +198,7 @@ func (c *controller) updateUsageWithRetry(ctx context.Context, reference, refere
options := []retry.Option{
retry.Timeout(defaultRetryTimeout),
retry.Backoff(false),
retry.Callback(func(err error, sleep time.Duration) {
retry.Callback(func(err error, _ time.Duration) {
log.G(ctx).Debugf("failed to update the quota usage for %s %s, error: %v", reference, referenceID, err)
}),
}
@ -284,7 +284,7 @@ func (c *controller) Update(ctx context.Context, u *quota.Quota) error {
}
// Driver returns quota driver for the reference
func Driver(ctx context.Context, reference string) (driver.Driver, error) {
func Driver(_ context.Context, reference string) (driver.Driver, error) {
d, ok := driver.Get(reference)
if !ok {
return nil, fmt.Errorf("quota not support for %s", reference)
@ -316,7 +316,7 @@ func reserveResources(resources types.ResourceList) func(hardLimits, used types.
}
func rollbackResources(resources types.ResourceList) func(hardLimits, used types.ResourceList) (types.ResourceList, error) {
return func(hardLimits, used types.ResourceList) (types.ResourceList, error) {
return func(_, used types.ResourceList) (types.ResourceList, error) {
newUsed := types.Subtract(used, resources)
// ensure that new used is never negative
if negativeUsed := types.IsNegative(newUsed); len(negativeUsed) > 0 {

View File

@ -42,7 +42,7 @@ type driver struct {
blobCtl blob.Controller
}
func (d *driver) Enabled(ctx context.Context, key string) (bool, error) {
func (d *driver) Enabled(ctx context.Context, _ string) (bool, error) {
// NOTE: every time load the new configurations from the db to get the latest configurations may have performance problem.
if err := d.cfg.Load(ctx); err != nil {
return false, err

View File

@ -326,7 +326,7 @@ func (t *transfer) copyChunkWithRetry(srcRepo, dstRepo, digest string, sizeFromD
}
// tryMountBlob try to check existence and mount, return true if mounted.
func (t *transfer) tryMountBlob(srcRepo, dstRepo, digest string) (bool, error) {
func (t *transfer) tryMountBlob(_, dstRepo, digest string) (bool, error) {
if t.shouldStop() {
return false, errStopped
}

View File

@ -55,7 +55,7 @@ func init() {
}
}
func scanAllCallback(ctx context.Context, param string) error {
func scanAllCallback(ctx context.Context, _ string) error {
_, err := scanCtl.ScanAll(ctx, task.ExecutionTriggerSchedule, true)
return err
}

View File

@ -23,7 +23,7 @@ func init() {
}
}
func cleanupCallBack(ctx context.Context, param string) error {
func cleanupCallBack(ctx context.Context, _ string) error {
err := cleanupController.Start(ctx, true, task.ExecutionTriggerSchedule)
if err != nil {
logger.Errorf("System artifact cleanup job encountered errors: %v", err)

View File

@ -131,7 +131,7 @@ func (c *controller) GetInfo(ctx context.Context, opt Options) (*Data, error) {
return res, nil
}
func (c *controller) GetCapacity(ctx context.Context) (*imagestorage.Capacity, error) {
func (c *controller) GetCapacity(_ context.Context) (*imagestorage.Capacity, error) {
systeminfo.Init()
return imagestorage.GlobalDriver.Cap()
}
@ -142,14 +142,14 @@ func (c *controller) GetCA(ctx context.Context) (io.ReadCloser, error) {
if len(testRootCertPath) > 0 {
path = testRootCertPath
}
if _, err := os.Stat(path); err == nil {
var err error
if _, err = os.Stat(path); err == nil {
return os.Open(path)
} else if os.IsNotExist(err) {
return nil, errors.NotFoundError(fmt.Errorf("cert not found in path: %s", path))
} else {
logger.Errorf("Failed to stat the cert, path: %s, error: %v", path, err)
return nil, err
}
logger.Errorf("Failed to stat the cert, path: %s, error: %v", path, err)
return nil, err
}
// NewController return an instance of controller

View File

@ -52,7 +52,7 @@ func init() {
}
}
func sweepCallback(ctx context.Context, p string) error {
func sweepCallback(ctx context.Context, _ string) error {
params := &SweepParams{ExecRetainCounts: job.GetExecutionSweeperCount()}
return SweepCtl.Start(ctx, params, task.ExecutionTriggerSchedule)
}

View File

@ -88,35 +88,35 @@ type DefaultAuthenticateHelper struct {
}
// Authenticate ...
func (d *DefaultAuthenticateHelper) Authenticate(ctx context.Context, m models.AuthModel) (*models.User, error) {
func (d *DefaultAuthenticateHelper) Authenticate(_ context.Context, _ models.AuthModel) (*models.User, error) {
return nil, ErrNotSupported
}
// OnBoardUser will check if a user exists in user table, if not insert the user and
// put the id in the pointer of user model, if it does exist, fill in the user model based
// on the data record of the user
func (d *DefaultAuthenticateHelper) OnBoardUser(ctx context.Context, u *models.User) error {
func (d *DefaultAuthenticateHelper) OnBoardUser(_ context.Context, _ *models.User) error {
return ErrNotSupported
}
// SearchUser - Get user information from account repository
func (d *DefaultAuthenticateHelper) SearchUser(ctx context.Context, username string) (*models.User, error) {
func (d *DefaultAuthenticateHelper) SearchUser(_ context.Context, username string) (*models.User, error) {
log.Errorf("Not support searching user, username: %s", username)
return nil, libErrors.NotFoundError(ErrNotSupported).WithMessage("%s not found", username)
}
// PostAuthenticate - Update user information after authenticate, such as OnBoard or sync info etc
func (d *DefaultAuthenticateHelper) PostAuthenticate(ctx context.Context, u *models.User) error {
func (d *DefaultAuthenticateHelper) PostAuthenticate(_ context.Context, _ *models.User) error {
return nil
}
// OnBoardGroup - OnBoardGroup, it will set the ID of the user group, if altGroupName is not empty, take the altGroupName as groupName in harbor DB.
func (d *DefaultAuthenticateHelper) OnBoardGroup(ctx context.Context, u *model.UserGroup, altGroupName string) error {
func (d *DefaultAuthenticateHelper) OnBoardGroup(_ context.Context, _ *model.UserGroup, _ string) error {
return ErrNotSupported
}
// SearchGroup - Search ldap group by group key, groupKey is the unique attribute of group in authenticator, for LDAP, the key is group DN
func (d *DefaultAuthenticateHelper) SearchGroup(ctx context.Context, groupKey string) (*model.UserGroup, error) {
func (d *DefaultAuthenticateHelper) SearchGroup(_ context.Context, groupKey string) (*model.UserGroup, error) {
log.Errorf("Not support searching group, group key: %s", groupKey)
return nil, libErrors.NotFoundError(ErrNotSupported).WithMessage("%s not found", groupKey)
}

View File

@ -102,13 +102,12 @@ func (a *Auth) Authenticate(ctx context.Context, m models.AuthModel) (*models.Us
return user, nil
} else if resp.StatusCode == http.StatusUnauthorized {
return nil, auth.NewErrAuth(string(data))
} else {
data, err := io.ReadAll(resp.Body)
if err != nil {
log.Warningf("Failed to read response body, error: %v", err)
}
return nil, fmt.Errorf("failed to authenticate, status code: %d, text: %s", resp.StatusCode, string(data))
}
data, err = io.ReadAll(resp.Body)
if err != nil {
log.Warningf("Failed to read response body, error: %v", err)
}
return nil, fmt.Errorf("failed to authenticate, status code: %d, text: %s", resp.StatusCode, string(data))
}
func (a *Auth) tokenReview(ctx context.Context, sessionID string) (*models.User, error) {
@ -191,7 +190,7 @@ func (a *Auth) SearchGroup(ctx context.Context, groupKey string) (*model.UserGro
}
// OnBoardGroup create user group entity in Harbor DB, altGroupName is not used.
func (a *Auth) OnBoardGroup(ctx context.Context, u *model.UserGroup, altGroupName string) error {
func (a *Auth) OnBoardGroup(ctx context.Context, u *model.UserGroup, _ string) error {
// if group name provided, on board the user group
if len(u.GroupName) == 0 {
return errors.New("should provide a group name")

View File

@ -58,9 +58,8 @@ func (ah *authHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
_, err := rw.Write([]byte(fmt.Sprintf(`{"session_id": "%s"}`, e.sessionID)))
if err != nil {
panic(err)
} else {
return
}
return
}
}
http.Error(rw, fmt.Sprintf("Do not find entry in entrylist, username: %s", html.EscapeString(u)), http.StatusUnauthorized)
@ -89,9 +88,8 @@ func (rth *reviewTokenHandler) ServeHTTP(rw http.ResponseWriter, req *http.Reque
_, err := rw.Write([]byte(fmt.Sprintf(reviewStatusTpl, e.username)))
if err != nil {
panic(err)
} else {
return
}
return
}
}
http.Error(rw, html.EscapeString(fmt.Sprintf("failed to match token: %s, entrylist: %+v", reviewData.Spec.Token, rth.entries)), http.StatusUnauthorized)

View File

@ -54,7 +54,7 @@ func (d *Auth) SearchUser(ctx context.Context, username string) (*models.User, e
}
// OnBoardUser -
func (d *Auth) OnBoardUser(ctx context.Context, u *models.User) error {
func (d *Auth) OnBoardUser(_ context.Context, _ *models.User) error {
return nil
}

View File

@ -16,7 +16,7 @@ type Auth struct {
}
// SearchGroup is skipped in OIDC mode, so it makes sure any group will be onboarded.
func (a *Auth) SearchGroup(ctx context.Context, groupKey string) (*model.UserGroup, error) {
func (a *Auth) SearchGroup(_ context.Context, groupKey string) (*model.UserGroup, error) {
return &model.UserGroup{
GroupName: groupKey,
GroupType: common.OIDCGroupType,
@ -24,7 +24,7 @@ func (a *Auth) SearchGroup(ctx context.Context, groupKey string) (*model.UserGro
}
// OnBoardGroup create user group entity in Harbor DB, altGroupName is not used.
func (a *Auth) OnBoardGroup(ctx context.Context, u *model.UserGroup, altGroupName string) error {
func (a *Auth) OnBoardGroup(ctx context.Context, u *model.UserGroup, _ string) error {
// if group name provided, on board the user group
if len(u.GroupName) == 0 || u.GroupType != common.OIDCGroupType {
return fmt.Errorf("invalid input group for OIDC mode: %v", *u)

View File

@ -145,7 +145,7 @@ type accessFilter interface {
type registryFilter struct {
}
func (reg registryFilter) filter(ctx context.Context, ctl project.Controller,
func (reg registryFilter) filter(ctx context.Context, _ project.Controller,
a *token.ResourceActions) error {
// Do not filter if the request is to access registry catalog
if a.Name != "catalog" {

View File

@ -47,7 +47,7 @@ type Store struct {
}
// Set value in redis session
func (rs *Store) Set(ctx context.Context, key, value interface{}) error {
func (rs *Store) Set(_ context.Context, key, value interface{}) error {
rs.lock.Lock()
defer rs.lock.Unlock()
rs.values[key] = value
@ -55,7 +55,7 @@ func (rs *Store) Set(ctx context.Context, key, value interface{}) error {
}
// Get value in redis session
func (rs *Store) Get(ctx context.Context, key interface{}) interface{} {
func (rs *Store) Get(_ context.Context, key interface{}) interface{} {
rs.lock.RLock()
defer rs.lock.RUnlock()
if v, ok := rs.values[key]; ok {
@ -65,7 +65,7 @@ func (rs *Store) Get(ctx context.Context, key interface{}) interface{} {
}
// Delete value in redis session
func (rs *Store) Delete(ctx context.Context, key interface{}) error {
func (rs *Store) Delete(_ context.Context, key interface{}) error {
rs.lock.Lock()
defer rs.lock.Unlock()
delete(rs.values, key)
@ -73,7 +73,7 @@ func (rs *Store) Delete(ctx context.Context, key interface{}) error {
}
// Flush clear all values in redis session
func (rs *Store) Flush(ctx context.Context) error {
func (rs *Store) Flush(_ context.Context) error {
rs.lock.Lock()
defer rs.lock.Unlock()
rs.values = make(map[interface{}]interface{})
@ -81,12 +81,12 @@ func (rs *Store) Flush(ctx context.Context) error {
}
// SessionID get redis session id
func (rs *Store) SessionID(ctx context.Context) string {
func (rs *Store) SessionID(_ context.Context) string {
return rs.sid
}
// SessionRelease save session values to redis
func (rs *Store) SessionRelease(ctx context.Context, w http.ResponseWriter) {
func (rs *Store) SessionRelease(ctx context.Context, _ http.ResponseWriter) {
b, err := session.EncodeGob(rs.values)
if err != nil {
return
@ -193,11 +193,11 @@ func (rp *Provider) SessionDestroy(ctx context.Context, sid string) error {
}
// SessionGC Implement method, no used.
func (rp *Provider) SessionGC(ctx context.Context) {
func (rp *Provider) SessionGC(_ context.Context) {
}
// SessionAll return all activeSession
func (rp *Provider) SessionAll(ctx context.Context) int {
func (rp *Provider) SessionAll(_ context.Context) int {
return 0
}

View File

@ -1,6 +1,6 @@
module github.com/goharbor/harbor/src
go 1.20
go 1.21
require (
github.com/FZambia/sentinel v1.1.0

View File

@ -119,6 +119,7 @@ github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d h1:UrqY+r/OJnIp5u0s1SbQ8dVfLCZJsnvazdBP5hS4iRs=
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/Unknwon/goconfig v0.0.0-20160216183935-5f601ca6ef4d h1:RjxaKUAINjr+fYbaYjpdBUZc8R3+wF/Yr2XkDHho4Sg=
@ -389,6 +390,7 @@ github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
github.com/docker/docker v20.10.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE=
github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go v0.0.0-20160303222718-d30aec9fd63c h1:Ggg7IiOtghyZzn3ozi31kPHpV6qSjMgmesXaWCijYNM=
github.com/docker/go v0.0.0-20160303222718-d30aec9fd63c/go.mod h1:CADgU4DSXK5QUlFslkQu2yW2TKzFZcXq/leZfM0UH5Q=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
@ -400,6 +402,7 @@ github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHz
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4=
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
@ -412,11 +415,13 @@ github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFP
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw=
github.com/elazarl/go-bindata-assetfs v1.0.1/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao2r4iyvLdACqsl/Ljk=
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful/v3 v3.10.1 h1:rc42Y5YTp7Am7CS630D7JmhRjq4UlEUuEKfrDac4bSQ=
github.com/emicklei/go-restful/v3 v3.10.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@ -441,6 +446,7 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
@ -557,6 +563,7 @@ github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
@ -662,6 +669,7 @@ github.com/google/certificate-transparency-go v1.0.21 h1:Yf1aXowfZ2nuboBsg7iYGLm
github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg=
github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54=
github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@ -675,6 +683,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v35 v35.2.0/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
@ -903,6 +912,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
@ -918,6 +928,7 @@ github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
@ -955,6 +966,7 @@ github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOq
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA=
github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
@ -984,6 +996,7 @@ github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGq
github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo=
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw=
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA=
github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@ -1049,6 +1062,7 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys=
github.com/onsi/gomega v1.23.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
@ -1172,6 +1186,7 @@ github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
@ -1190,6 +1205,7 @@ github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9Nz
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
@ -1276,6 +1292,7 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
@ -1746,6 +1763,7 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@ -1959,6 +1977,7 @@ k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM=
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E=
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4=
k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5 h1:kmDqav+P+/5e1i9tFfHq1qcF3sOrDp+YEkVDAHu7Jwk=

View File

@ -83,7 +83,7 @@ func (gc *GarbageCollector) ShouldRetry() bool {
}
// Validate implements the interface in job/Interface
func (gc *GarbageCollector) Validate(params job.Parameters) error {
func (gc *GarbageCollector) Validate(_ job.Parameters) error {
return nil
}

View File

@ -46,7 +46,7 @@ func (wj *WebhookJob) ShouldRetry() bool {
}
// Validate implements the interface in job/Interface
func (wj *WebhookJob) Validate(params job.Parameters) error {
func (wj *WebhookJob) Validate(_ job.Parameters) error {
return nil
}
@ -84,7 +84,7 @@ func (wj *WebhookJob) init(ctx job.Context, params map[string]interface{}) error
}
// execute webhook job
func (wj *WebhookJob) execute(ctx job.Context, params map[string]interface{}) error {
func (wj *WebhookJob) execute(_ job.Context, params map[string]interface{}) error {
payload := params["payload"].(string)
address := params["address"].(string)

View File

@ -47,7 +47,7 @@ func (j *Job) ShouldRetry() bool {
}
// Validate is implementation of same method in Interface.
func (j *Job) Validate(params job.Parameters) error {
func (j *Job) Validate(_ job.Parameters) error {
return nil
}

View File

@ -73,7 +73,7 @@ func (r *Replication) ShouldRetry() bool {
}
// Validate does nothing
func (r *Replication) Validate(params job.Parameters) error {
func (r *Replication) Validate(_ job.Parameters) error {
return nil
}

View File

@ -57,7 +57,7 @@ func (sde *ScanDataExport) ShouldRetry() bool {
// Validate Indicate whether the parameters of job are valid.
// Return:
// error if parameters are not valid. NOTES: If no parameters needed, directly return nil.
func (sde *ScanDataExport) Validate(params job.Parameters) error {
func (sde *ScanDataExport) Validate(_ job.Parameters) error {
return nil
}
@ -190,24 +190,24 @@ func (sde *ScanDataExport) writeCsvFile(ctx job.Context, params job.Parameters,
return err
}
projectIds := filterCriteria.Projects
if len(projectIds) == 0 {
projectIDs := filterCriteria.Projects
if len(projectIDs) == 0 {
return nil
}
// extract the repository ids if any repositories have been specified
repoIds, err := sde.filterProcessor.ProcessRepositoryFilter(systemContext, filterCriteria.Repositories, projectIds)
repoIDs, err := sde.filterProcessor.ProcessRepositoryFilter(systemContext, filterCriteria.Repositories, projectIDs)
if err != nil {
return err
}
if len(repoIds) == 0 {
if len(repoIDs) == 0 {
logger.Infof("No repositories found with specified names: %v", filterCriteria.Repositories)
return nil
}
// filter artifacts by tags
arts, err := sde.filterProcessor.ProcessTagFilter(systemContext, filterCriteria.Tags, repoIds)
arts, err := sde.filterProcessor.ProcessTagFilter(systemContext, filterCriteria.Tags, repoIDs)
if err != nil {
return err
}

View File

@ -21,11 +21,11 @@ func (c *Cleanup) ShouldRetry() bool {
return true
}
func (c *Cleanup) Validate(params job.Parameters) error {
func (c *Cleanup) Validate(_ job.Parameters) error {
return nil
}
func (c *Cleanup) Run(ctx job.Context, params job.Parameters) error {
func (c *Cleanup) Run(ctx job.Context, _ job.Parameters) error {
logger := ctx.GetLogger()
logger.Infof("Running system data artifact cleanup job...")
c.init()

View File

@ -27,6 +27,6 @@ func FileGetterFactory(options ...OptionItem) (getter.Interface, error) {
}
// DBGetterFactory creates a getter for the DB logger
func DBGetterFactory(options ...OptionItem) (getter.Interface, error) {
func DBGetterFactory(_ ...OptionItem) (getter.Interface, error) {
return getter.NewDBGetter(), nil
}

View File

@ -95,11 +95,10 @@ func (rj *RedisJob) Run(j *work.Job) (err error) {
<-time.After(time.Duration(b) * time.Millisecond)
span.AddEvent("retrying to get job stat")
continue
} else {
// Exit and never try.
// Directly return without retry again as we have no way to restore the stats again.
j.Fails = 10000000000 // never retry
}
// Exit and never try.
// Directly return without retry again as we have no way to restore the stats again.
j.Fails = 10000000000 // never retry
}
// Log error and exit

View File

@ -344,15 +344,15 @@ func (bs *Bootstrap) loadAndRunRedisWorkerPool(
// Get a redis connection pool
func (bs *Bootstrap) getRedisPool(redisPoolConfig *config.RedisPoolConfig) *redis.Pool {
if pool, err := redislib.GetRedisPool("JobService", redisPoolConfig.RedisURL, &redislib.PoolParam{
pool, err := redislib.GetRedisPool("JobService", redisPoolConfig.RedisURL, &redislib.PoolParam{
PoolMaxIdle: 6,
PoolIdleTimeout: time.Duration(redisPoolConfig.IdleTimeoutSecond) * time.Second,
DialConnectionTimeout: dialConnectionTimeout,
DialReadTimeout: dialReadTimeout,
DialWriteTimeout: dialWriteTimeout,
}); err != nil {
})
if err != nil {
panic(err)
} else {
return pool
}
return pool
}

View File

@ -154,7 +154,7 @@ func (w *basicWorker) Start() error {
logger.Infof("Basic worker is started")
// Start the reaper
w.knownJobs.Range(func(k interface{}, v interface{}) bool {
w.knownJobs.Range(func(k interface{}, _ interface{}) bool {
w.reaper.jobTypes = append(w.reaper.jobTypes, k.(string))
return true
@ -251,7 +251,7 @@ func (w *basicWorker) Schedule(jobName string, params job.Parameters, runAfterSe
}
// PeriodicallyEnqueue job
func (w *basicWorker) PeriodicallyEnqueue(jobName string, params job.Parameters, cronSetting string, isUnique bool, webHook string) (*job.Stats, error) {
func (w *basicWorker) PeriodicallyEnqueue(jobName string, params job.Parameters, cronSetting string, _ bool, webHook string) (*job.Stats, error) {
p := &period.Policy{
ID: utils.MakeIdentifier(),
JobName: jobName,
@ -369,7 +369,7 @@ func (w *basicWorker) StopJob(jobID string) error {
}
// RetryJob retry the job
func (w *basicWorker) RetryJob(jobID string) error {
func (w *basicWorker) RetryJob(_ string) error {
return errors.New("not implemented")
}

View File

@ -136,7 +136,7 @@ func (r *reaper) syncOutdatedStats() error {
// Loop all the in progress jobs to check if they're really in progress or
// status is hung.
h := func(k string, v int64) (err error) {
h := func(k string, _ int64) (err error) {
defer func() {
if errs.IsObjectNotFoundError(err) {
// As the job stats is lost and we don't have chance to restore it, then directly discard it.

View File

@ -60,7 +60,7 @@ func (c *Cache) Contains(ctx context.Context, key string) bool {
}
// Delete delete item from cache by key
func (c *Cache) Delete(ctx context.Context, key string) error {
func (c *Cache) Delete(_ context.Context, key string) error {
c.storage.Delete(c.opts.Key(key))
return nil
}
@ -89,12 +89,12 @@ func (c *Cache) Fetch(ctx context.Context, key string, value interface{}) error
}
// Ping ping the cache
func (c *Cache) Ping(ctx context.Context) error {
func (c *Cache) Ping(_ context.Context) error {
return nil
}
// Save cache the value by key
func (c *Cache) Save(ctx context.Context, key string, value interface{}, expiration ...time.Duration) error {
func (c *Cache) Save(_ context.Context, key string, value interface{}, expiration ...time.Duration) error {
data, err := c.opts.Codec.Encode(value)
if err != nil {
return fmt.Errorf("failed to encode value, key %s, error: %v", key, err)
@ -118,7 +118,7 @@ func (c *Cache) Save(ctx context.Context, key string, value interface{}, expirat
}
// Scan scans the keys matched by match string
func (c *Cache) Scan(ctx context.Context, match string) (cache.Iterator, error) {
func (c *Cache) Scan(_ context.Context, match string) (cache.Iterator, error) {
var keys []string
c.storage.Range(func(k, v interface{}) bool {
matched := true
@ -147,7 +147,7 @@ type ScanIterator struct {
}
// Next checks whether has the next element
func (i *ScanIterator) Next(ctx context.Context) bool {
func (i *ScanIterator) Next(_ context.Context) bool {
i.mu.Lock()
defer i.mu.Unlock()

View File

@ -112,7 +112,7 @@ func InitWithSettings(cfgs map[string]interface{}, kp ...encrypt.KeyProvider) {
}
// GetCfgManager return the current config manager
func GetCfgManager(ctx context.Context) Manager {
func GetCfgManager(_ context.Context) Manager {
return DefaultMgr()
}

View File

@ -38,7 +38,7 @@ type Type interface {
type StringType struct {
}
func (t *StringType) validate(str string) error {
func (t *StringType) validate(_ string) error {
return nil
}
@ -177,7 +177,7 @@ func (t *BoolType) get(str string) (interface{}, error) {
type PasswordType struct {
}
func (t *PasswordType) validate(str string) error {
func (t *PasswordType) validate(_ string) error {
return nil
}

View File

@ -37,7 +37,7 @@ func NewFileKeyProvider(path string) KeyProvider {
}
// Get returns the key read from file
func (f *FileKeyProvider) Get(params map[string]interface{}) (string, error) {
func (f *FileKeyProvider) Get(_ map[string]interface{}) (string, error) {
b, err := os.ReadFile(f.path)
if err != nil {
return "", err
@ -51,6 +51,6 @@ type PresetKeyProvider struct {
}
// Get ...
func (p *PresetKeyProvider) Get(params map[string]interface{}) (string, error) {
func (p *PresetKeyProvider) Get(_ map[string]interface{}) (string, error) {
return p.Key, nil
}

View File

@ -116,7 +116,7 @@ func PaginationOnRawSQL(query *q.Query, sql string, params []interface{}) (strin
}
// QuerySetterForCount creates the query setter used for count with the sort and pagination information ignored
func QuerySetterForCount(ctx context.Context, model interface{}, query *q.Query, ignoredCols ...string) (orm.QuerySeter, error) {
func QuerySetterForCount(ctx context.Context, model interface{}, query *q.Query, _ ...string) (orm.QuerySeter, error) {
query = q.MustClone(query)
query.Sorts = nil
query.PageSize = 0

View File

@ -70,7 +70,7 @@ func GetRedisPool(name string, rawurl string, param *PoolParam) (*redis.Pool, er
Dial: func() (redis.Conn, error) {
return redis.DialURL(rawurl)
},
TestOnBorrow: func(c redis.Conn, t time.Time) error {
TestOnBorrow: func(c redis.Conn, _ time.Time) error {
_, err := c.Do("PING")
return err
},
@ -88,9 +88,8 @@ func GetRedisPool(name string, rawurl string, param *PoolParam) (*redis.Pool, er
}
knownPool.Store(name, pool)
return pool, nil
} else {
return nil, fmt.Errorf("bad redis url: not support scheme %s", u.Scheme)
}
return nil, fmt.Errorf("bad redis url: not support scheme %s", u.Scheme)
}
func getSentinelPool(u *url.URL, param *PoolParam, name string) (*redis.Pool, error) {
@ -158,7 +157,7 @@ func getSentinelPool(u *url.URL, param *PoolParam, name string) (*redis.Pool, er
log.Debug(name, "dial redis master:", masterAddr, "db:", db)
return redis.Dial("tcp", masterAddr, redisOptions...)
},
TestOnBorrow: func(c redis.Conn, t time.Time) error {
TestOnBorrow: func(c redis.Conn, _ time.Time) error {
if !sentinel.TestRole(c, "master") {
return fmt.Errorf("check role failed, %s", name)
}

View File

@ -94,7 +94,7 @@ func Get(kind, decoration, pattern, extras string) (selector.Selector, error) {
func Index() []*IndexedMeta {
all := make([]*IndexedMeta, 0)
index.Range(func(k, v interface{}) bool {
index.Range(func(_, v interface{}) bool {
if item, ok := v.(*indexedItem); ok {
all = append(all, item.Meta)
return true

View File

@ -50,7 +50,7 @@ func (s *selector) Select(artifacts []*iselector.Candidate) (selected []*iselect
}
// New is factory method for label selector
func New(decoration string, pattern interface{}, extras string) iselector.Selector {
func New(decoration string, pattern interface{}, _ string) iselector.Selector {
labels := make([]string, 0)
if pattern != nil {

View File

@ -82,7 +82,7 @@ func (s *selector) Select(artifacts []*sl.Candidate) (selected []*sl.Candidate,
}
// New is factory method for vulnerability severity selector
func New(decoration string, pattern interface{}, extras string) sl.Selector {
func New(decoration string, pattern interface{}, _ string) sl.Selector {
var sev int
if pattern != nil {
sev, _ = pattern.(int)

View File

@ -64,7 +64,7 @@ func (s *selector) Select(artifacts []*sl.Candidate) (selected []*sl.Candidate,
}
// New is factory method for signature selector
func New(decoration string, pattern interface{}, extras string) sl.Selector {
func New(decoration string, pattern interface{}, _ string) sl.Selector {
var e bool
if pattern != nil {
e, _ = pattern.(bool)

View File

@ -35,7 +35,7 @@ type LoggerManager struct {
}
// Init redirect the audit log to the forward endpoint
func (a *LoggerManager) Init(ctx context.Context, logEndpoint string) {
func (a *LoggerManager) Init(_ context.Context, logEndpoint string) {
var w io.Writer
w, err := syslog.Dial("tcp", logEndpoint,
syslog.LOG_INFO, "audit")

View File

@ -123,7 +123,7 @@ func (b *Blob) IsManifest() bool {
}
// FilterByArtifactDigest returns orm.QuerySeter with artifact digest filter
func (b *Blob) FilterByArtifactDigest(ctx context.Context, qs orm.QuerySeter, key string, value interface{}) orm.QuerySeter {
func (b *Blob) FilterByArtifactDigest(_ context.Context, qs orm.QuerySeter, _ string, value interface{}) orm.QuerySeter {
v, ok := value.(string)
if !ok {
return qs
@ -133,7 +133,7 @@ func (b *Blob) FilterByArtifactDigest(ctx context.Context, qs orm.QuerySeter, ke
}
// FilterByArtifactDigests returns orm.QuerySeter with artifact digests filter
func (b *Blob) FilterByArtifactDigests(ctx context.Context, qs orm.QuerySeter, key string, value interface{}) orm.QuerySeter {
func (b *Blob) FilterByArtifactDigests(_ context.Context, qs orm.QuerySeter, _ string, value interface{}) orm.QuerySeter {
artifactDigests, ok := value.([]string)
if !ok {
return qs
@ -148,7 +148,7 @@ func (b *Blob) FilterByArtifactDigests(ctx context.Context, qs orm.QuerySeter, k
}
// FilterByProjectID returns orm.QuerySeter with project id filter
func (b *Blob) FilterByProjectID(ctx context.Context, qs orm.QuerySeter, key string, value interface{}) orm.QuerySeter {
func (b *Blob) FilterByProjectID(_ context.Context, qs orm.QuerySeter, _ string, value interface{}) orm.QuerySeter {
projectID, ok := value.(int64)
if !ok {
return qs

View File

@ -87,12 +87,12 @@ func (bm *BaseManager) WithCacheClient(cc cache.Cache) *BaseManager {
}
// CacheClient returns the cache client.
func (bm *BaseManager) CacheClient(ctx context.Context) cache.Cache {
func (bm *BaseManager) CacheClient(_ context.Context) cache.Cache {
return bm.cacheClient
}
// ResourceType returns the resource type.
func (bm *BaseManager) ResourceType(ctx context.Context) string {
func (bm *BaseManager) ResourceType(_ context.Context) string {
return bm.resourceType
}

View File

@ -48,7 +48,7 @@ func (d *Driver) Load(context.Context) (map[string]interface{}, error) {
}
// Save only save user config setting to driver, for example: database, REST
func (d *Driver) Save(ctx context.Context, cfg map[string]interface{}) error {
func (d *Driver) Save(_ context.Context, cfg map[string]interface{}) error {
d.Lock()
defer d.Unlock()
for k, v := range cfg {

View File

@ -134,7 +134,7 @@ func (c *CfgManager) Save(ctx context.Context) error {
}
// Get ...
func (c *CfgManager) Get(ctx context.Context, key string) *metadata.ConfigureValue {
func (c *CfgManager) Get(_ context.Context, key string) *metadata.ConfigureValue {
configValue, err := c.Store.Get(key)
if err != nil {
log.Debugf("failed to get key %v, error: %v, maybe default value not defined before get", key, err)
@ -144,7 +144,7 @@ func (c *CfgManager) Get(ctx context.Context, key string) *metadata.ConfigureVal
}
// Set ...
func (c *CfgManager) Set(ctx context.Context, key string, value interface{}) {
func (c *CfgManager) Set(_ context.Context, key string, value interface{}) {
configValue, err := metadata.NewCfgValue(key, utils.GetStrValueOfAnyType(value))
if err != nil {
log.Errorf("error when setting key: %v, error %v", key, err)

View File

@ -41,7 +41,7 @@ type Value struct {
}
// Load - load config data from REST server
func (h *Driver) Load(ctx context.Context) (map[string]interface{}, error) {
func (h *Driver) Load(_ context.Context) (map[string]interface{}, error) {
cfgMap := map[string]interface{}{}
origMap := map[string]*Value{}
log.Infof("get configuration from url: %+v", h.configRESTURL)
@ -59,6 +59,6 @@ func (h *Driver) Load(ctx context.Context) (map[string]interface{}, error) {
}
// Save - Save config data to REST server by PUT method
func (h *Driver) Save(ctx context.Context, cfg map[string]interface{}) error {
func (h *Driver) Save(_ context.Context, cfg map[string]interface{}) error {
return h.client.Put(h.configRESTURL, cfg)
}

View File

@ -68,10 +68,10 @@ func (e *Exporter) RegisterCollector(collectors ...collector) error {
return nil
}
func newServer(opt *Opt, r *prometheus.Registry) *http.Server {
func newServer(opt *Opt, _ *prometheus.Registry) *http.Server {
exporterMux := http.NewServeMux()
exporterMux.Handle(opt.MetricsPath, promhttp.Handler())
exporterMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
exporterMux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
_, _ = w.Write([]byte(`<html>
<head><title>Harbor Exporter</title></head>
<body>

View File

@ -94,6 +94,6 @@ func initRepositoryMgr(cacheEnabled bool) {
}
}
func initManifestManager(cacheEnabled bool) {
func initManifestManager(_ bool) {
ManifestMgr = cachedManifest.NewManager()
}

View File

@ -45,7 +45,7 @@ func NewPoolManager() PoolManager {
return &poolManager{}
}
func (p poolManager) List(ctx context.Context, monitorClient JobServiceMonitorClient) ([]*WorkerPool, error) {
func (p poolManager) List(_ context.Context, monitorClient JobServiceMonitorClient) ([]*WorkerPool, error) {
workerPool := make([]*WorkerPool, 0)
wh, err := monitorClient.WorkerPoolHeartbeats()
if err != nil {

View File

@ -30,7 +30,7 @@ func NewQueueClient() QueueManager {
return &queueManagerImpl{}
}
func (w *queueManagerImpl) List(ctx context.Context, monitClient JobServiceMonitorClient) ([]*Queue, error) {
func (w *queueManagerImpl) List(_ context.Context, monitClient JobServiceMonitorClient) ([]*Queue, error) {
resultQueues := make([]*Queue, 0)
queues, err := monitClient.Queues()
if err != nil {

View File

@ -108,7 +108,7 @@ func (r *redisClientImpl) StopPendingJobs(ctx context.Context, jobType string) (
}
// removeJobStatusInRedis remove job status track information from redis, to avoid performance impact when the jobIDs is too large, use batch to remove
func (r *redisClientImpl) removeJobStatusInRedis(ctx context.Context, jobIDs []string) {
func (r *redisClientImpl) removeJobStatusInRedis(_ context.Context, jobIDs []string) {
conn := r.redisPool.Get()
defer conn.Close()
for _, id := range jobIDs {
@ -128,13 +128,13 @@ func (r *redisClientImpl) removeJobStatusInRedis(ctx context.Context, jobIDs []s
}
}
func (r *redisClientImpl) AllJobTypes(ctx context.Context) ([]string, error) {
func (r *redisClientImpl) AllJobTypes(_ context.Context) ([]string, error) {
conn := r.redisPool.Get()
defer conn.Close()
return redis.Strings(conn.Do("SMEMBERS", fmt.Sprintf("{%s}:known_jobs", r.namespace)))
}
func (r *redisClientImpl) PauseJob(ctx context.Context, jobName string) error {
func (r *redisClientImpl) PauseJob(_ context.Context, jobName string) error {
log.Infof("pause job type:%s", jobName)
redisKeyJobPaused := fmt.Sprintf("{%s}:jobs:%s:paused", r.namespace, jobName)
conn := r.redisPool.Get()
@ -143,7 +143,7 @@ func (r *redisClientImpl) PauseJob(ctx context.Context, jobName string) error {
return err
}
func (r *redisClientImpl) UnpauseJob(ctx context.Context, jobName string) error {
func (r *redisClientImpl) UnpauseJob(_ context.Context, jobName string) error {
log.Infof("unpause job %s", jobName)
redisKeyJobPaused := fmt.Sprintf("{%s}:jobs:%s:paused", r.namespace, jobName)
conn := r.redisPool.Get()

View File

@ -40,7 +40,7 @@ func NewWorkerManager() WorkerManager {
return &workerManagerImpl{taskMgr: task.NewManager()}
}
func (w *workerManagerImpl) List(ctx context.Context, monitClient JobServiceMonitorClient, poolID string) ([]*Worker, error) {
func (w *workerManagerImpl) List(_ context.Context, monitClient JobServiceMonitorClient, poolID string) ([]*Worker, error) {
wphs, err := monitClient.WorkerPoolHeartbeats()
if err != nil {
return nil, err

View File

@ -35,11 +35,11 @@ func New() Manager {
type manager struct {
}
func (m *manager) Ping(ctx context.Context, cfg cfgModels.LdapConf) (bool, error) {
func (m *manager) Ping(_ context.Context, cfg cfgModels.LdapConf) (bool, error) {
return TestConfig(cfg)
}
func (m *manager) SearchUser(ctx context.Context, sess *Session, username string) ([]model.User, error) {
func (m *manager) SearchUser(_ context.Context, sess *Session, username string) ([]model.User, error) {
users := make([]model.User, 0)
if err := sess.Open(); err != nil {
return users, err
@ -119,7 +119,7 @@ func (m *manager) ImportUser(ctx context.Context, sess *Session, ldapImportUsers
return failedImportUser, nil
}
func (m *manager) SearchGroup(ctx context.Context, sess *Session, groupName, groupDN string) ([]model.Group, error) {
func (m *manager) SearchGroup(_ context.Context, sess *Session, groupName, groupDN string) ([]model.Group, error) {
err := sess.Open()
if err != nil {
return nil, err

View File

@ -109,7 +109,7 @@ func (d *dao) GetProjectMember(ctx context.Context, queryMember models.Member, q
return members, err
}
func (d *dao) GetTotalOfProjectMembers(ctx context.Context, projectID int64, query *q.Query, roles ...int) (int, error) {
func (d *dao) GetTotalOfProjectMembers(ctx context.Context, projectID int64, _ *q.Query, roles ...int) (int, error) {
log.Debugf("Query condition %+v", projectID)
if projectID == 0 {
return 0, fmt.Errorf("failed to get total of project members, project id required %v", projectID)

View File

@ -63,7 +63,7 @@ func (h *HookMetaData) Resolve(evt *Event) error {
}
// Build an event by metadata
func (e *Event) Build(ctx context.Context, metadata ...Metadata) error {
func (e *Event) Build(_ context.Context, metadata ...Metadata) error {
for _, md := range metadata {
if err := md.Resolve(e); err != nil {
log.Debugf("failed to resolve event metadata: %v", md)

View File

@ -66,7 +66,7 @@ type Default struct{}
}
}
*/
func (d *Default) Format(ctx context.Context, he *model.HookEvent) (http.Header, []byte, error) {
func (d *Default) Format(_ context.Context, he *model.HookEvent) (http.Header, []byte, error) {
if he == nil {
return nil, nil, errors.Errorf("HookEvent should not be nil")
}

View File

@ -12,7 +12,7 @@ type fakeVerifier struct {
secret string
}
func (fv *fakeVerifier) VerifySecret(ctx context.Context, name string, secret string) (*UserInfo, error) {
func (fv *fakeVerifier) VerifySecret(_ context.Context, name string, secret string) (*UserInfo, error) {
if secret != fv.secret {
return nil, verifyError(errors.New("mismatch"))
}

View File

@ -14,7 +14,7 @@ func (nah *NoneAuthHandler) Mode() string {
}
// Authorize implements @Handler.Authorize
func (nah *NoneAuthHandler) Authorize(req *http.Request, cred *Credential) error {
func (nah *NoneAuthHandler) Authorize(req *http.Request, _ *Credential) error {
if req == nil {
return errors.New("nil request cannot be authorized")
}

View File

@ -31,7 +31,7 @@ type Evaluator struct {
}
// HasPermission always return true for the system administrator
func (e *Evaluator) HasPermission(ctx context.Context, resource types.Resource, action types.Action) bool {
func (e *Evaluator) HasPermission(_ context.Context, resource types.Resource, action types.Action) bool {
log.Debugf("system administrator %s require %s action for resource %s", e.username, action, resource)
// scanner-pull is for scanner to bypass the policy checking so admin user should not have this permission
return action != rbac.ActionScannerPull

View File

@ -88,18 +88,18 @@ func (a *adapter) LoadPolicy(model model.Model) error {
return nil
}
func (a *adapter) SavePolicy(model model.Model) error {
func (a *adapter) SavePolicy(_ model.Model) error {
return errNotImplemented
}
func (a *adapter) AddPolicy(sec string, ptype string, rule []string) error {
func (a *adapter) AddPolicy(_ string, _ string, _ []string) error {
return errNotImplemented
}
func (a *adapter) RemovePolicy(sec string, ptype string, rule []string) error {
func (a *adapter) RemovePolicy(_ string, _ string, _ []string) error {
return errNotImplemented
}
func (a *adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {
func (a *adapter) RemoveFilteredPolicy(_ string, _ string, _ int, _ ...string) error {
return errNotImplemented
}

View File

@ -40,7 +40,7 @@ func (s *regexpStore) Get(key string, build func(string) *regexp.Regexp) *regexp
func (s *regexpStore) Purge() {
var keys []interface{}
s.entries.Range(func(key, value interface{}) bool {
s.entries.Range(func(key, _ interface{}) bool {
keys = append(keys, key)
return true
})

View File

@ -34,7 +34,7 @@ type Evaluator struct {
}
// HasPermission returns true when the rbac user has action permission for the resource
func (e *Evaluator) HasPermission(ctx context.Context, resource types.Resource, action types.Action) bool {
func (e *Evaluator) HasPermission(_ context.Context, resource types.Resource, action types.Action) bool {
e.once.Do(func() {
e.enforcer = makeEnforcer(e.rbacUser)
})

View File

@ -148,7 +148,7 @@ func (p *Project) AutoScan() bool {
}
// FilterByPublic returns orm.QuerySeter with public filter
func (p *Project) FilterByPublic(ctx context.Context, qs orm.QuerySeter, key string, value interface{}) orm.QuerySeter {
func (p *Project) FilterByPublic(_ context.Context, qs orm.QuerySeter, _ string, value interface{}) orm.QuerySeter {
subQuery := `SELECT project_id FROM project_metadata WHERE name = 'public' AND value = '%s'`
if isTrue(value) {
subQuery = fmt.Sprintf(subQuery, "true")
@ -159,7 +159,7 @@ func (p *Project) FilterByPublic(ctx context.Context, qs orm.QuerySeter, key str
}
// FilterByOwner returns orm.QuerySeter with owner filter
func (p *Project) FilterByOwner(ctx context.Context, qs orm.QuerySeter, key string, value interface{}) orm.QuerySeter {
func (p *Project) FilterByOwner(_ context.Context, qs orm.QuerySeter, _ string, value interface{}) orm.QuerySeter {
username, ok := value.(string)
if !ok {
return qs
@ -169,7 +169,7 @@ func (p *Project) FilterByOwner(ctx context.Context, qs orm.QuerySeter, key stri
}
// FilterByMember returns orm.QuerySeter with member filter
func (p *Project) FilterByMember(ctx context.Context, qs orm.QuerySeter, key string, value interface{}) orm.QuerySeter {
func (p *Project) FilterByMember(_ context.Context, qs orm.QuerySeter, _ string, value interface{}) orm.QuerySeter {
query, ok := value.(*MemberQuery)
if !ok {
return qs
@ -197,7 +197,7 @@ func (p *Project) FilterByMember(ctx context.Context, qs orm.QuerySeter, key str
}
// FilterByNames returns orm.QuerySeter with name filter
func (p *Project) FilterByNames(ctx context.Context, qs orm.QuerySeter, key string, value interface{}) orm.QuerySeter {
func (p *Project) FilterByNames(_ context.Context, qs orm.QuerySeter, _ string, value interface{}) orm.QuerySeter {
query, ok := value.(*NamesQuery)
if !ok {
return qs

View File

@ -46,7 +46,7 @@ func (resource ResourceName) FormatValue(value int64) string {
type ResourceList map[ResourceName]int64
// Validate validates this resource list
func (resources ResourceList) Validate(formats strfmt.Registry) error {
func (resources ResourceList) Validate(_ strfmt.Registry) error {
return nil
}

View File

@ -325,7 +325,7 @@ func (a *adapter) FetchArtifacts(filters []*model.Filter) (resources []*model.Re
return
}
func (a *adapter) listReposByNamespace(region string, namespace string, c *cr.Client) (repos []aliRepo, err error) {
func (a *adapter) listReposByNamespace(_ string, namespace string, c *cr.Client) (repos []aliRepo, err error) {
var reposReq = cr.CreateGetRepoListByNamespaceRequest()
var reposResp = cr.CreateGetRepoListByNamespaceResponse()
reposReq.SetDomain(a.domain)

View File

@ -193,6 +193,6 @@ func (a *adapter) listArtifacts(repository string, filters []*model.Filter) ([]*
return filter.DoFilterArtifacts(artifacts, filters)
}
func (a *adapter) DeleteManifest(repository, reference string) error {
func (a *adapter) DeleteManifest(_, _ string) error {
return nil
}

View File

@ -146,7 +146,7 @@ func (a *adapter) ListNamespaces(query *model.NamespaceQuery) ([]*model.Namespac
}
// ConvertResourceMetadata convert resource metadata for Huawei SWR
func (a *adapter) ConvertResourceMetadata(resourceMetadata *model.ResourceMetadata, namespace *model.Namespace) (*model.ResourceMetadata, error) {
func (a *adapter) ConvertResourceMetadata(resourceMetadata *model.ResourceMetadata, _ *model.Namespace) (*model.ResourceMetadata, error) {
metadata := &model.ResourceMetadata{
Repository: resourceMetadata.Repository,
Vtags: resourceMetadata.Vtags,

View File

@ -28,7 +28,7 @@ import (
)
// FetchArtifacts gets resources from Huawei SWR
func (a *adapter) FetchArtifacts(filters []*model.Filter) ([]*model.Resource, error) {
func (a *adapter) FetchArtifacts(_ []*model.Filter) ([]*model.Resource, error) {
resources := []*model.Resource{}
urls := fmt.Sprintf("%s/dockyard/v2/repositories?filter=center::self", a.registry.URL)
@ -111,9 +111,9 @@ func (a *adapter) ManifestExist(repository, reference string) (exist bool, desc
}
contentType := resp.Header.Get("Content-Type")
contentLen := resp.Header.Get("Content-Length")
len, _ := strconv.Atoi(contentLen)
contentLenInt, _ := strconv.Atoi(contentLen)
return exist, &distribution.Descriptor{MediaType: contentType, Size: int64(len)}, nil
return exist, &distribution.Descriptor{MediaType: contentType, Size: int64(contentLenInt)}, nil
}
// DeleteManifest delete the manifest of Huawei SWR

View File

@ -342,7 +342,7 @@ func (a *adapter) preparePushBlob(repository string) (string, error) {
return "", err
}
func (a *adapter) ackPushBlob(repository, digest, location, size string) error {
func (a *adapter) ackPushBlob(repository, digest, location, _ string) error {
url := fmt.Sprintf("%s/v2/%s/blobs/uploads/%s?digest=%s", a.registry.URL, repository, location, digest)
req, err := http.NewRequest(http.MethodPut, url, nil)
if err != nil {

Some files were not shown because too many files have changed in this diff Show More