Skip to content

Commit

Permalink
Merge pull request moby#5256 from tonistiigi/golangci-lint-v1.60.1
Browse files Browse the repository at this point in the history
ci: update golangci-lint to v1.60.1
  • Loading branch information
AkihiroSuda authored Aug 17, 2024
2 parents 1d44dd6 + df0d9d7 commit 51c2a75
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ linters:
disable-all: true

linters-settings:
staticcheck:
checks:
- "all"
gocritic:
disabled-checks:
- "ifElseChain"
Expand Down Expand Up @@ -98,6 +101,7 @@ linters-settings:
- "empty"
- "bool-compare"
- "len"
- "negative-positive"

issues:
exclude-files:
Expand Down
4 changes: 2 additions & 2 deletions cache/contenthash/tarsum.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ func v0TarHeaderSelect(h *tar.Header) (orderedHeaders [][2]string) {

func v1TarHeaderSelect(h *tar.Header) (orderedHeaders [][2]string) {
pax := h.PAXRecords
if len(h.Xattrs) > 0 { //nolint:staticcheck // field deprecated in stdlib
if len(h.Xattrs) > 0 { // field deprecated in stdlib
if pax == nil {
pax = map[string]string{}
for k, v := range h.Xattrs { //nolint:staticcheck // field deprecated in stdlib
for k, v := range h.Xattrs { // field deprecated in stdlib
pax["SCHILY.xattr."+k] = v
}
}
Expand Down
2 changes: 1 addition & 1 deletion executor/resources/cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestReadPressureFile(t *testing.T) {
full avg10=0.12 avg60=0.34 avg300=0.56 total=9876`

tmpFile := filepath.Join(t.TempDir(), "pressure_test")
err := os.WriteFile(tmpFile, []byte(pressureContents), os.ModePerm)
err := os.WriteFile(tmpFile, []byte(pressureContents), os.ModePerm) //nolint:gosec
require.NoError(t, err)

pressure, err := parsePressureFile(tmpFile)
Expand Down
2 changes: 1 addition & 1 deletion executor/runcexecutor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func exitError(ctx context.Context, err error) error {
)
select {
case <-ctx.Done():
exitErr.Err = errors.Wrapf(context.Cause(ctx), exitErr.Error())
exitErr.Err = errors.Wrap(context.Cause(ctx), exitErr.Error())
return exitErr
default:
return stack.Enable(exitErr)
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfiles/lint.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG GO_VERSION=1.22
ARG ALPINE_VERSION=3.20
ARG XX_VERSION=1.4.0
ARG PROTOLINT_VERSION=0.45.0
ARG GOLANGCI_LINT_VERSION=1.57.1
ARG GOLANGCI_LINT_VERSION=1.60.1
ARG GOPLS_VERSION=v0.20.0
# disabled: deprecated unusedvariable simplifyrange
ARG GOPLS_ANALYZERS="embeddirective fillreturns infertypeargs nonewvars noresultvalues simplifycompositelit simplifyslice stubmethods undeclaredname unusedparams useany"
Expand Down
2 changes: 1 addition & 1 deletion session/secrets/secretsprovider/secretsprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (sp *secretProvider) GetSecret(ctx context.Context, req *secrets.GetSecretR
dt, err := sp.store.GetSecret(ctx, req.ID)
if err != nil {
if errors.Is(err, secrets.ErrNotFound) {
return nil, status.Errorf(codes.NotFound, err.Error())
return nil, status.Error(codes.NotFound, err.Error())
}
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion solver/testutil/cachestorage_testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func testWalkIDsByResult(t *testing.T, st solver.CacheKeyStorage) {
func getFunctionName(i interface{}) string {
fullname := runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
dot := strings.LastIndex(fullname, ".") + 1
return strings.Title(fullname[dot:]) //nolint:staticcheck // ignoring "SA1019: strings.Title is deprecated", as for our use we don't need full unicode support
return strings.Title(fullname[dot:]) // ignoring "SA1019: strings.Title is deprecated", as for our use we don't need full unicode support
}

func rootKey(dgst digest.Digest, output solver.Index) digest.Digest {
Expand Down
2 changes: 1 addition & 1 deletion util/appcontext/appcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func Context() context.Context {
err := errors.Errorf("got %d SIGTERM/SIGINTs, forcing shutdown", retries)
cancel(err)
if retries >= exitLimit {
bklog.G(ctx).Errorf(err.Error())
bklog.G(ctx).Error(err.Error())
os.Exit(1)
}
}
Expand Down
2 changes: 1 addition & 1 deletion util/resolver/retryhandler/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func retryError(err error) bool {
return true
}
// catches TLS timeout or other network-related temporary errors
if ne := net.Error(nil); errors.As(err, &ne) && ne.Temporary() { //nolint:staticcheck // ignoring "SA1019: Temporary is deprecated", continue to propagate net.Error through the "temporary" status
if ne := net.Error(nil); errors.As(err, &ne) && ne.Temporary() { // ignoring "SA1019: Temporary is deprecated", continue to propagate net.Error through the "temporary" status
return true
}

Expand Down
2 changes: 1 addition & 1 deletion util/testutil/integration/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
func getFunctionName(i interface{}) string {
fullname := runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
dot := strings.LastIndex(fullname, ".") + 1
return strings.Title(fullname[dot:]) //nolint:staticcheck // ignoring "SA1019: strings.Title is deprecated", as for our use we don't need full unicode support
return strings.Title(fullname[dot:]) // ignoring "SA1019: strings.Title is deprecated", as for our use we don't need full unicode support
}

var localImageCache map[string]map[string]struct{}
Expand Down
2 changes: 1 addition & 1 deletion util/testutil/integration/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func FormatLogs(m map[string]*bytes.Buffer) string {
func CheckFeatureCompat(t *testing.T, sb Sandbox, features map[string]struct{}, reason ...string) {
t.Helper()
if err := HasFeatureCompat(t, sb, features, reason...); err != nil {
t.Skipf(err.Error())
t.Skip(err.Error())
}
}

Expand Down

0 comments on commit 51c2a75

Please sign in to comment.