diff options
| author | Taras Madan <tarasmadan@google.com> | 2022-09-05 14:27:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-05 12:27:54 +0000 |
| commit | b2f2446b46bf02821d90ebedadae2bf7ae0e880e (patch) | |
| tree | 923cf42842918d6bebca1d6bbdc08abed54d274d /vendor/github.com/tommy-muehle | |
| parent | e6654faff4bcca4be92e9a8596fd4b77f747c39e (diff) | |
go.mod, vendor: update (#3358)
* go.mod, vendor: remove unnecessary dependencies
Commands:
1. go mod tidy
2. go mod vendor
* go.mod, vendor: update cloud.google.com/go
Commands:
1. go get -u cloud.google.com/go
2. go mod tidy
3. go mod vendor
* go.mod, vendor: update cloud.google.com/*
Commands:
1. go get -u cloud.google.com/storage cloud.google.com/logging
2. go mod tidy
3. go mod vendor
* go.mod, .golangci.yml, vendor: update *lint*
Commands:
1. go get -u golang.org/x/tools github.com/golangci/golangci-lint@v1.47.0
2. go mod tidy
3. go mod vendor
4. edit .golangci.yml to suppress new errors (resolved in the same PR later)
* all: fix lint errors
hash.go: copy() recommended by gosimple
parse.go: ent is never nil
verifier.go: signal.Notify() with unbuffered channel is bad. Have no idea why.
* .golangci.yml: adjust godot rules
check-all is deprecated, but still work
if you're hesitating too - I'll remove this commit
Diffstat (limited to 'vendor/github.com/tommy-muehle')
7 files changed, 60 insertions, 23 deletions
diff --git a/vendor/github.com/tommy-muehle/go-mnd/v2/.goreleaser.yml b/vendor/github.com/tommy-muehle/go-mnd/v2/.goreleaser.yml index e0a87b838..7516de0b9 100644 --- a/vendor/github.com/tommy-muehle/go-mnd/v2/.goreleaser.yml +++ b/vendor/github.com/tommy-muehle/go-mnd/v2/.goreleaser.yml @@ -1,3 +1,10 @@ +env: + - GO_VERSION=1.16 + +before: + hooks: + - go mod download + builds: - main: ./cmd/mnd/main.go binary: mnd @@ -17,7 +24,7 @@ archives: brews: - name: mnd - github: + tap: owner: tommy-muehle name: homebrew-tap folder: Formula @@ -25,3 +32,23 @@ brews: description: Magic number detector for Go test: | system "#{bin}/mnd --version" + install: | + bin.install "mnd" + +dockers: + - + goos: linux + goarch: amd64 + image_templates: + - "tommymuehle/go-mnd:latest" + - "tommymuehle/go-mnd:{{ .Tag }}" + build_flag_templates: + - "--build-arg=GO_VERSION={{.Env.GO_VERSION}}" + extra_files: + - checks + - cmd + - config + - analyzer.go + - entrypoint.sh + - go.mod + - go.sum diff --git a/vendor/github.com/tommy-muehle/go-mnd/v2/Dockerfile b/vendor/github.com/tommy-muehle/go-mnd/v2/Dockerfile index bb8e2b7f4..25c8d5475 100644 --- a/vendor/github.com/tommy-muehle/go-mnd/v2/Dockerfile +++ b/vendor/github.com/tommy-muehle/go-mnd/v2/Dockerfile @@ -1,4 +1,4 @@ -ARG GO_VERSION=1.15 +ARG GO_VERSION=1.16 FROM golang:${GO_VERSION}-alpine AS builder RUN apk add --update --no-cache make git curl gcc libc-dev diff --git a/vendor/github.com/tommy-muehle/go-mnd/v2/Makefile b/vendor/github.com/tommy-muehle/go-mnd/v2/Makefile index b8a32316b..a21c1dcac 100644 --- a/vendor/github.com/tommy-muehle/go-mnd/v2/Makefile +++ b/vendor/github.com/tommy-muehle/go-mnd/v2/Makefile @@ -1,6 +1,6 @@ GIT_TAG?= $(shell git describe --abbrev=0) -GO_VERSION = 1.15 +GO_VERSION = 1.16 BUILDFLAGS := '-w -s' IMAGE_REPO = "tommymuehle" diff --git a/vendor/github.com/tommy-muehle/go-mnd/v2/README.md b/vendor/github.com/tommy-muehle/go-mnd/v2/README.md index fe679e138..a29f266be 100644 --- a/vendor/github.com/tommy-muehle/go-mnd/v2/README.md +++ b/vendor/github.com/tommy-muehle/go-mnd/v2/README.md @@ -20,7 +20,7 @@ A vet analyzer to detect magic numbers. This analyzer requires Golang in version >= 1.12 because it's depends on the **go/analysis** API. ``` -go get -u github.com/tommy-muehle/go-mnd/cmd/mnd +go get -u github.com/tommy-muehle/go-mnd/v2/cmd/mnd ``` ### Github action @@ -118,7 +118,7 @@ The ```-ignored-numbers``` option let's you define a comma separated list of num For example: `-ignored-numbers=1000,10_000,3.14159264` The ```-ignored-functions``` option let's you define a comma separated list of function name regexp patterns to exclude. -For example: `-ignored-functions=math.*,http.StatusText` +For example: `-ignored-functions=math.*,http.StatusText,make` The ```-ignored-files``` option let's you define a comma separated list of filename regexp patterns to exclude. For example: `-ignored-files=magic_.*.go,.*_numbers.go` diff --git a/vendor/github.com/tommy-muehle/go-mnd/v2/analyzer.go b/vendor/github.com/tommy-muehle/go-mnd/v2/analyzer.go index 9153e0bc3..bf658f42d 100644 --- a/vendor/github.com/tommy-muehle/go-mnd/v2/analyzer.go +++ b/vendor/github.com/tommy-muehle/go-mnd/v2/analyzer.go @@ -102,6 +102,9 @@ func run(pass *analysis.Pass) (interface{}, error) { c := c i.Preorder(c.NodeFilter(), func(node ast.Node) { for _, exclude := range conf.IgnoredFiles { + if exclude.String() == "" { + continue + } if exclude.MatchString(pass.Fset.Position(node.Pos()).Filename) { return } diff --git a/vendor/github.com/tommy-muehle/go-mnd/v2/checks/argument.go b/vendor/github.com/tommy-muehle/go-mnd/v2/checks/argument.go index f0c5d71d2..5d880f0f9 100644 --- a/vendor/github.com/tommy-muehle/go-mnd/v2/checks/argument.go +++ b/vendor/github.com/tommy-muehle/go-mnd/v2/checks/argument.go @@ -41,8 +41,12 @@ func (a *ArgumentAnalyzer) Check(n ast.Node) { case *ast.CallExpr: a.checkCallExpr(expr) case *ast.GenDecl: - if expr.Tok == token.CONST { - pos := a.pass.Fset.Position(expr.TokPos) + if expr.Tok != token.CONST { + return + } + + for _, x := range expr.Specs { + pos := a.pass.Fset.Position(x.Pos()) mu.Lock() constantDefinitions[pos.Filename+":"+strconv.Itoa(pos.Line)] = true @@ -70,6 +74,10 @@ func (a *ArgumentAnalyzer) checkCallExpr(expr *ast.CallExpr) { return } } + case *ast.Ident: + if a.config.IsIgnoredFunction(f.Name) { + return + } } for i, arg := range expr.Args { @@ -82,10 +90,9 @@ func (a *ArgumentAnalyzer) checkCallExpr(expr *ast.CallExpr) { if i == 0 { a.pass.Reportf(x.Pos(), reportMsg, x.Value, ArgumentCheck) } else { - // Otherwise check the previous element type - switch expr.Args[i-1].(type) { - case *ast.ChanType: - // When it's not a simple buffered channel, report it + // Otherwise check all args + switch expr.Args[i].(type) { + case *ast.BasicLit: if a.isMagicNumber(x) { a.pass.Reportf(x.Pos(), reportMsg, x.Value, ArgumentCheck) } diff --git a/vendor/github.com/tommy-muehle/go-mnd/v2/config/config.go b/vendor/github.com/tommy-muehle/go-mnd/v2/config/config.go index a4681e37d..e186028e0 100644 --- a/vendor/github.com/tommy-muehle/go-mnd/v2/config/config.go +++ b/vendor/github.com/tommy-muehle/go-mnd/v2/config/config.go @@ -44,11 +44,10 @@ func WithOptions(options ...Option) *Config { func WithIgnoredFunctions(excludes string) Option { return func(config *Config) { - if excludes == "" { - return - } - for _, exclude := range strings.Split(excludes, ",") { + if exclude == "" { + continue + } config.IgnoredFunctions = append(config.IgnoredFunctions, regexp.MustCompile(exclude)) } } @@ -56,11 +55,10 @@ func WithIgnoredFunctions(excludes string) Option { func WithIgnoredFiles(excludes string) Option { return func(config *Config) { - if excludes == "" { - return - } - for _, exclude := range strings.Split(excludes, ",") { + if exclude == "" { + continue + } config.IgnoredFiles = append(config.IgnoredFiles, regexp.MustCompile(exclude)) } } @@ -68,11 +66,10 @@ func WithIgnoredFiles(excludes string) Option { func WithIgnoredNumbers(numbers string) Option { return func(config *Config) { - if numbers == "" { - return - } - for _, number := range strings.Split(numbers, ",") { + if number == "" { + continue + } config.IgnoredNumbers[config.removeDigitSeparator(number)] = struct{}{} } } @@ -89,6 +86,9 @@ func WithCustomChecks(checks string) Option { } for _, name := range strings.Split(checks, ",") { + if name == "" { + continue + } config.Checks[name] = true } } |
