Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump golangci/golangci-lint from v1.61.0 to v1.62.0 #4

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
go-version: "1.23.3" # update together with dev.dockerfile
- uses: golangci/golangci-lint-action@v6
with:
version: "v1.61.0" # update together with dev.dockerfile
version: "v1.62.0" # update together with dev.dockerfile

check-tidy:
name: go mod tidy
Expand Down
12 changes: 10 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ linters-settings:
# Default false
ignore-comments: true

gochecksumtype:
# Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed.
# Default: true
default-signifies-exhaustive: false

gocognit:
# Minimal code complexity to report.
# Default: 30 (but we recommend 10-20)
Expand Down Expand Up @@ -245,6 +250,7 @@ linters:
- gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations
- goprintffuncname # checks that printf-like functions are named with f at the end
- gosec # inspects source code for security problems
- iface # checks the incorrect use of interfaces, helping developers avoid interface pollution
- intrange # finds places where for loops could make use of an integer range
- lll # reports long lines
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
Expand All @@ -266,6 +272,7 @@ linters:
- promlinter # checks Prometheus metrics naming via promlint
- protogetter # reports direct reads from proto message fields when getters should be used
- reassign # checks that package variables are not reassigned
- recvcheck # checks for receiver type consistency
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
- rowserrcheck # checks whether Err of rows is checked successfully
- sloglint # ensure consistent code style when using log/slog
Expand Down Expand Up @@ -307,7 +314,6 @@ linters:
#- dupword # [useless without config] checks for duplicate words in the source code
#- err113 # [too strict] checks the errors handling expressions
#- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted
#- execinquery # [deprecated] checks query string in Query function which reads your Go src files and warning it finds
#- exportloopref # [not necessary from Go 1.22] checks for pointers to enclosing loop variables
#- forcetypeassert # [replaced by errcheck] finds forced type assertions
#- gofmt # [replaced by goimports] checks whether code was gofmt-ed
Expand Down Expand Up @@ -339,6 +345,7 @@ issues:
linters:
- bodyclose
- dupl
- errcheck
- funlen
- goconst
- gosec
Expand Down Expand Up @@ -372,12 +379,13 @@ issues:
- path: "operations/alphaops"
text: "SA1019: .+ is deprecated"
- path: "serviceerror"
text: "the type name .+ should conform to the `XxxError` format"
text: "the error type name .+ should conform to the `XxxError` format"
- path: "serviceerror"
linters:
- protogetter # TODO: fix
- path: "fieldmask"
linters:
- nilnil # TODO: fix or ignore
- recvcheck # TODO: fix or ignore
- testifylint # TODO: fix or ignore
- testpackage # TODO: fix or ignore
4 changes: 2 additions & 2 deletions auth/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (c *CachedServiceTokener) requestToken(ctx context.Context, background bool
return BearerToken{}, err
}

return res.(BearerToken), nil
return res.(BearerToken), nil //nolint:errcheck // ok to panic
}

type CachedBearerTokener struct {
Expand Down Expand Up @@ -268,5 +268,5 @@ func (c *CachedBearerTokener) requestToken(ctx context.Context) (BearerToken, er
return BearerToken{}, err
}

return res.(BearerToken), nil
return res.(BearerToken), nil //nolint:errcheck // ok to panic
}
2 changes: 1 addition & 1 deletion auth/service_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *CachedServiceAccount) ServiceAccount(ctx context.Context) (ServiceAccou
return ServiceAccount{}, err
}

return res.(ServiceAccount), nil
return res.(ServiceAccount), nil //nolint:errcheck // ok to panic
}

type StaticServiceAccount ServiceAccount
Expand Down
2 changes: 1 addition & 1 deletion conn/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (d *dialer) dial(ctx context.Context, address Address) (*grpc.ClientConn, e
return nil, err
}

return res.(*grpc.ClientConn), nil
return res.(*grpc.ClientConn), nil //nolint:errcheck // ok to panic
}

func (d *dialer) Close() error {
Expand Down
8 changes: 4 additions & 4 deletions conn/resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ func ContextWithResolver(ctx context.Context, resolver Resolver) context.Context
}

func ResolverFromContext(ctx context.Context) Resolver {
value := ctx.Value(resolverContextKey{})
if value == nil {
res, ok := ctx.Value(resolverContextKey{}).(Resolver)
if !ok {
return nil
}
return value.(Resolver)
return res
}

type ContextResolver struct {
Expand Down Expand Up @@ -185,7 +185,7 @@ func NewCachedResolver(logger *slog.Logger, next Resolver) *CachedResolver {

func (r *CachedResolver) Resolve(ctx context.Context, id ServiceID) (Address, error) {
if value, ok := r.cache.Load(id); ok {
return value.(Address), nil
return value.(Address), nil //nolint:errcheck // ok to panic
}

log := r.logger.With(slog.String("service", string(id)))
Expand Down
2 changes: 1 addition & 1 deletion dev.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM golang:1.23.3 AS go

# update together with .github/workflows/ci.yml
FROM golangci/golangci-lint:v1.61.0 AS linter
FROM golangci/golangci-lint:v1.62.0 AS linter

FROM go AS dev
ENV INSIDE_DEV_CONTAINER=1
Expand Down
Loading