mirror of
https://github.com/containers/image.git
synced 2025-04-18 19:44:05 +03:00
Merge pull request #2804 from containers/renovate/golangci-golangci-lint-2.x
chore(deps): update dependency golangci/golangci-lint to v2
This commit is contained in:
commit
816245037c
@ -1,16 +1,18 @@
|
||||
---
|
||||
run:
|
||||
concurrency: 6
|
||||
timeout: 5m
|
||||
|
||||
version: "2"
|
||||
linters:
|
||||
enable:
|
||||
- errorlint
|
||||
|
||||
linters-settings:
|
||||
errorlint:
|
||||
# See https://golangci-lint.run/usage/linters/#errorlint.
|
||||
# Only allow warnings about not using %w.
|
||||
errorf-multi: false
|
||||
asserts: false
|
||||
comparison: false
|
||||
settings:
|
||||
errorlint:
|
||||
# See https://golangci-lint.run/usage/linters/#errorlint.
|
||||
# Only allow warnings about not using %w.
|
||||
errorf-multi: false
|
||||
asserts: false
|
||||
comparison: false
|
||||
staticcheck:
|
||||
checks: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-ST1005", "-QF1008"] # golangci-lint's default, we add -ST1005 and -QF1008
|
||||
exclusions:
|
||||
presets:
|
||||
- comments
|
||||
- common-false-positives
|
||||
- std-error-handling
|
||||
|
2
Makefile
2
Makefile
@ -32,7 +32,7 @@ REGISTRIESDDIR ?= ${CONTAINERSCONFDIR}/registries.d
|
||||
# N/B: This value is managed by Renovate, manual changes are
|
||||
# possible, as long as they don't disturb the formatting
|
||||
# (i.e. DO NOT ADD A 'v' prefix!)
|
||||
GOLANGCI_LINT_VERSION := 1.64.8
|
||||
GOLANGCI_LINT_VERSION := 2.0.0
|
||||
|
||||
export PATH := $(PATH):${GOBIN}
|
||||
|
||||
|
@ -35,9 +35,9 @@ type bodyReader struct {
|
||||
|
||||
body io.ReadCloser // The currently open connection we use to read data, or nil if there is nothing to read from / close.
|
||||
lastRetryOffset int64 // -1 if N/A
|
||||
lastRetryTime time.Time // time.Time{} if N/A
|
||||
lastRetryTime time.Time // IsZero() if N/A
|
||||
offset int64 // Current offset within the blob
|
||||
lastSuccessTime time.Time // time.Time{} if N/A
|
||||
lastSuccessTime time.Time // IsZero() if N/A
|
||||
}
|
||||
|
||||
// newBodyReader creates a bodyReader for request path in c.
|
||||
@ -207,9 +207,9 @@ func (br *bodyReader) Read(p []byte) (int, error) {
|
||||
}
|
||||
|
||||
// millisecondsSinceOptional is like currentTime.Sub(tm).Milliseconds, but it returns a floating-point value.
|
||||
// If tm is time.Time{}, it returns math.NaN()
|
||||
// If tm.IsZero(), it returns math.NaN()
|
||||
func millisecondsSinceOptional(currentTime time.Time, tm time.Time) float64 {
|
||||
if tm == (time.Time{}) {
|
||||
if tm.IsZero() {
|
||||
return math.NaN()
|
||||
}
|
||||
return float64(currentTime.Sub(tm).Nanoseconds()) / 1_000_000.0
|
||||
@ -229,7 +229,7 @@ func (br *bodyReader) errorIfNotReconnecting(originalErr error, redactedURL stri
|
||||
logrus.Infof("Reading blob body from %s failed (%v), reconnecting after %d bytes…", redactedURL, originalErr, progress)
|
||||
return nil
|
||||
}
|
||||
if br.lastRetryTime == (time.Time{}) {
|
||||
if br.lastRetryTime.IsZero() {
|
||||
logrus.Infof("Reading blob body from %s failed (%v), reconnecting (first reconnection)…", redactedURL, originalErr)
|
||||
return nil
|
||||
}
|
||||
|
@ -213,12 +213,12 @@ type instanceCandidate struct {
|
||||
digest digest.Digest // Instance digest
|
||||
}
|
||||
|
||||
func (ic instanceCandidate) isPreferredOver(other *instanceCandidate, preferGzip bool) bool {
|
||||
func (ic instanceCandidate) isPreferredOver(other *instanceCandidate, preferGzip types.OptionalBool) bool {
|
||||
switch {
|
||||
case ic.platformIndex != other.platformIndex:
|
||||
return ic.platformIndex < other.platformIndex
|
||||
case ic.isZstd != other.isZstd:
|
||||
if !preferGzip {
|
||||
if preferGzip != types.OptionalBoolTrue {
|
||||
return ic.isZstd
|
||||
} else {
|
||||
return !ic.isZstd
|
||||
@ -232,10 +232,6 @@ func (ic instanceCandidate) isPreferredOver(other *instanceCandidate, preferGzip
|
||||
// chooseInstance is a private equivalent to ChooseInstanceByCompression,
|
||||
// shared by ChooseInstance and ChooseInstanceByCompression.
|
||||
func (index *OCI1IndexPublic) chooseInstance(ctx *types.SystemContext, preferGzip types.OptionalBool) (digest.Digest, error) {
|
||||
didPreferGzip := false
|
||||
if preferGzip == types.OptionalBoolTrue {
|
||||
didPreferGzip = true
|
||||
}
|
||||
wantedPlatforms := platform.WantedPlatforms(ctx)
|
||||
var bestMatch *instanceCandidate
|
||||
bestMatch = nil
|
||||
@ -251,7 +247,7 @@ func (index *OCI1IndexPublic) chooseInstance(ctx *types.SystemContext, preferGzi
|
||||
}
|
||||
candidate.platformIndex = platformIndex
|
||||
}
|
||||
if bestMatch == nil || candidate.isPreferredOver(bestMatch, didPreferGzip) {
|
||||
if bestMatch == nil || candidate.isPreferredOver(bestMatch, preferGzip) {
|
||||
bestMatch = &candidate
|
||||
}
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ func tlsCacheGet(config *restConfig) (http.RoundTripper, error) {
|
||||
// TLSConfigFor returns a tls.Config that will provide the transport level security defined
|
||||
// by the provided Config. Will return nil if no transport level security is requested.
|
||||
func tlsConfigFor(c *restConfig) (*tls.Config, error) {
|
||||
if !(c.HasCA() || c.HasCertAuth() || c.Insecure) {
|
||||
if !c.HasCA() && !c.HasCertAuth() && !c.Insecure {
|
||||
return nil, nil
|
||||
}
|
||||
if c.HasCA() && c.Insecure {
|
||||
|
@ -1048,14 +1048,10 @@ func TestSetGetCredentials(t *testing.T) {
|
||||
sys := &types.SystemContext{}
|
||||
if tc.useLegacyFormat {
|
||||
sys.LegacyFormatAuthFilePath = tmpFile.Name()
|
||||
_, err = tmpFile.WriteString(fmt.Sprintf(
|
||||
`{"%s":{"auth":"dXNlcm5hbWU6cGFzc3dvcmQ="}}`, tc.set,
|
||||
))
|
||||
_, err = fmt.Fprintf(tmpFile, `{"%s":{"auth":"dXNlcm5hbWU6cGFzc3dvcmQ="}}`, tc.set)
|
||||
} else {
|
||||
sys.AuthFilePath = tmpFile.Name()
|
||||
_, err = tmpFile.WriteString(fmt.Sprintf(
|
||||
`{"auths":{"%s":{"auth":"dXNlcm5hbWU6cGFzc3dvcmQ="}}}`, tc.set,
|
||||
))
|
||||
_, err = fmt.Fprintf(tmpFile, `{"auths":{"%s":{"auth":"dXNlcm5hbWU6cGFzc3dvcmQ="}}}`, tc.set)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -235,7 +235,7 @@ func parseShortNameValue(alias string) (reference.Named, error) {
|
||||
}
|
||||
|
||||
registry := reference.Domain(named)
|
||||
if !(strings.ContainsAny(registry, ".:") || registry == "localhost") {
|
||||
if !strings.ContainsAny(registry, ".:") && registry != "localhost" {
|
||||
return nil, fmt.Errorf("invalid alias %q: must contain registry and repository", alias)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user