0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-30 22:34:13 -05:00

ci(deps): upgrade golangci-lint

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke 2024-07-21 09:40:39 +02:00
parent 1da32e58c1
commit 2f452362b8
No known key found for this signature in database
15 changed files with 51 additions and 30 deletions

View file

@ -24,7 +24,7 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.54.2
version: v1.59.1
# Optional: working directory, useful for monorepos
# working-directory: somedir

View file

@ -10,7 +10,7 @@ TOOLSDIR := $(shell pwd)/hack/tools
PATH := bin:$(TOOLSDIR)/bin:$(PATH)
STACKER := $(shell which stacker)
GOLINTER := $(TOOLSDIR)/bin/golangci-lint
GOLINTER_VERSION := v1.54.2
GOLINTER_VERSION := v1.59.1
NOTATION := $(TOOLSDIR)/bin/notation
NOTATION_VERSION := 1.0.0
COSIGN := $(TOOLSDIR)/bin/cosign

View file

@ -370,7 +370,6 @@ func pushMonolithImage(workdir, url, trepo string, repos []string, config testCo
SetQueryParam("digest", digest.String()).
SetHeader("Content-Length", fmt.Sprintf("%d", size)).
SetHeader("Content-Type", "application/octet-stream").SetBody(fhandle).Put(loc)
if err != nil {
return nil, repos, err
}
@ -385,7 +384,6 @@ func pushMonolithImage(workdir, url, trepo string, repos []string, config testCo
// upload image config blob
resp, err = client.R().
Post(fmt.Sprintf("%s/v2/%s/blobs/uploads/", url, repo))
if err != nil {
return nil, repos, err
}
@ -406,7 +404,6 @@ func pushMonolithImage(workdir, url, trepo string, repos []string, config testCo
SetQueryParam("digest", cdigest.String()).
SetBody(cblob).
Put(loc)
if err != nil {
return nil, repos, err
}
@ -450,7 +447,6 @@ func pushMonolithImage(workdir, url, trepo string, repos []string, config testCo
SetHeader("Content-Type", "application/vnd.oci.image.manifest.v1+json").
SetBody(content).
Put(fmt.Sprintf("%s/v2/%s/manifests/%s", url, repo, manifestTag))
if err != nil {
return nil, repos, err
}
@ -828,7 +824,6 @@ func pushChunkAndCollect(workdir, url, trepo string, count int,
SetHeader("Content-Type", "application/octet-stream").
SetBody(fhandle).
Patch(loc)
if err != nil {
isConnFail = true

View file

@ -1,11 +1,38 @@
run:
deadline: 60m
skip-dirs:
- "internal"
timeout: 60m
linters:
enable-all: true
disable: funlen,gocognit,exhaustivestruct,paralleltest,forbidigo,ireturn,wrapcheck,exhaustive,maintidx,exhaustruct,nosnakecase,interfacer,structcheck,varcheck,deadcode,ifshort,golint,scopelint,maligned,rowserrcheck,sqlclosecheck,revive,musttag,depguard
disable:
- funlen
- gocognit
- paralleltest
- forbidigo
- ireturn
- wrapcheck
- exhaustive
- maintidx
- exhaustruct
- rowserrcheck
- sqlclosecheck
- revive
- musttag
- depguard
- execinquery
- gomnd
- inamedparam
- protogetter
- promlinter
- perfsprint
- testifylint
- wsl
- zerologlint
- canonicalheader
- contextcheck
- mnd
- nilnil
- intrange
- copyloopvar
linters-settings:
dupl:
@ -41,22 +68,33 @@ linters-settings:
- prefix(zotregistry.dev/zot)
wsl:
allow-assign-and-anything: true
enforce-err-cuddling: true
force-err-cuddling: true
nolintlint:
allow-unused: true
gomnd:
settings:
mnd:
checks: argument,case,condition,operation,return,assign
ignored-numbers: 10,64
checks:
- argument
- case
- condition
- operation
- return
- assign
ignored-numbers:
- "10"
- "64"
gomoddirectives:
replace-allow-list:
- github.com/gorilla/mux
- github.com/testcontainers/testcontainers-go
issues:
exclude-dirs:
- "internal"
exclude-rules:
- path: pkg/extensions/search/schema.resolvers.go
linters:
- lll
- varnamelen
- gci
- path: _test\.go
linters:
- dupl

View file

@ -10452,7 +10452,6 @@ func getAllBlobs(imagePath string) []string {
p := path.Join(imagePath, "blobs", digest.Algorithm().String(), digest.Encoded())
buf, err = os.ReadFile(p)
if err != nil {
panic(err)
}

View file

@ -66,7 +66,6 @@ func (lc *LDAPClient) Connect() error {
}
err = l.StartTLS(config)
if err != nil {
lc.Log.Error().Err(err).Str("address", address).Msg("failed to establish a TLS connection")

View file

@ -472,7 +472,6 @@ func (service searchService) getReferrers(ctx context.Context, config SearchConf
referrerResp := &ispec.Index{}
_, err = makeGETRequest(ctx, referrersEndpoint, username, password, config.VerifyTLS,
config.Debug, &referrerResp, config.ResultWriter)
if err != nil {
if common.IsContextDone(ctx) {
return referrersResult{}, nil
@ -580,7 +579,6 @@ func getImage(ctx context.Context, config SearchConfig, username, password, imag
tagList := &tagListResp{}
_, err = makeGETRequest(ctx, tagListEndpoint, username, password, config.VerifyTLS,
config.Debug, &tagList, config.ResultWriter)
if err != nil {
if common.IsContextDone(ctx) {
return

View file

@ -176,7 +176,6 @@ func SetupImageTrustExtension(conf *config.Config, metaDB mTypes.MetaDB, log log
endpoint, _ := conf.Storage.CacheDriver["endpoint"].(string)
region, _ := conf.Storage.CacheDriver["region"].(string)
imgTrustStore, err = imagetrust.NewAWSImageTrustStore(region, endpoint)
if err != nil {
return err
}

View file

@ -189,7 +189,6 @@ func (cloud *CertificateAWSStorage) InitTrustpolicy(trustpolicy []byte) error {
}
_, err = cloud.secretsManagerClient.DeleteSecret(context.Background(), deleteSecretParam)
if err != nil {
return err
}

View file

@ -182,7 +182,6 @@ func generateTestData(dbDir string) error { //nolint: gocyclo
il := ispec.ImageLayout{Version: ispec.ImageLayoutVersion}
buf, err = json.Marshal(il)
if err != nil {
return err
}

View file

@ -156,7 +156,6 @@ func (ref CosignReference) SyncReferences(ctx context.Context, localRepo, remote
err = meta.SetImageMetaFromInput(ctx, localRepo, cosignTag, ispec.MediaTypeImageManifest,
referenceDigest, manifestBuf, ref.storeController.GetImageStore(localRepo),
ref.metaDB, ref.log)
if err != nil {
return refsDigests, fmt.Errorf("failed to set metadata for cosign reference in '%s@%s': %w",
localRepo, subjectDigestStr, err)

View file

@ -7158,7 +7158,6 @@ func pushBlob(url string, repoName string, buf []byte) godigest.Digest {
SetQueryParam("digest", digest.String()).
SetBody(buf).
Put(loc)
if err != nil {
panic(err)
}

View file

@ -2179,7 +2179,6 @@ func (dwr *DynamoDB) createVersionTable() error {
TableName: aws.String(dwr.VersionTablename),
UpdateExpression: aws.String("SET #V = :Version"),
})
if err != nil {
return err
}

View file

@ -12,7 +12,7 @@ import (
"github.com/rs/zerolog"
. "github.com/smartystreets/goconvey/convey"
"zotregistry.dev/zot/pkg/log" //nolint:go-staticcheck
"zotregistry.dev/zot/pkg/log"
"zotregistry.dev/zot/pkg/meta/version"
tskip "zotregistry.dev/zot/pkg/test/skip"
)

View file

@ -47,7 +47,6 @@ func UploadImage(img Image, baseURL, repo, ref string) error {
SetQueryParam("digest", digest).
SetBody(blob).
Put(baseURL + loc)
if err != nil {
return err
}
@ -156,7 +155,6 @@ func UploadImageWithBasicAuth(img Image, baseURL, repo, ref, user, password stri
SetQueryParam("digest", digest).
SetBody(blob).
Put(baseURL + loc)
if err != nil {
return err
}