Skip to content

Commit

Permalink
Merge pull request #2 from remerge/4648-lint-shadow
Browse files Browse the repository at this point in the history
4648 lint shadow
  • Loading branch information
akaspin authored Nov 18, 2020
2 parents 6cf56d7 + 1b98ad4 commit 0fb6a1c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: false
language: go
go:
- "1.11.11"
- "1.14"

cache:
directories:
Expand Down
6 changes: 5 additions & 1 deletion mkf/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ watch: $(TOOLS)/github.com/cespare/reflex
# Use "GOFMT_EXCLUDES" to exclude files from gofmt and goimports.
# Use "VET_FLAGS" to define vet linter flags.

lint:: .lint-mod-tidy .lint-fmt .lint-goimports .lint-vet .lint-revive .lint-fix ## run all linters
lint:: .lint-mod-tidy .lint-fmt .lint-goimports .lint-vet .lint-shadow .lint-revive .lint-fix ## run all linters

lint-mkf: check-makefile-remote
@DIFF=`git diff --name-only --relative HEAD:$(MKF_PREFIX)/ makefile/$(MKF_BRANCH):./` && echo "$$DIFF" && test -z "$$DIFF"
Expand All @@ -122,6 +122,10 @@ lint-mkf: check-makefile-remote
go vet $(VET_FLAGS) ./...
.NOTPARALLEL: .lint-vet

.lint-shadow: $(TOOLS)/golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow $(GO_SOURCES) ## run shadow linter
go vet -vettool=$< ./...
.NOTPARALLEL: .lint-shadow

REVIVE_CONFIG = $(or $(wildcard revive.toml),$(MKF_PREFIX)/revive.toml)
.lint-revive: $(TOOLS)/github.com/mgechev/revive $(GO_SOURCES) $(REVIVE_CONFIG) ## run revive linter
$< -config $(REVIVE_CONFIG) -formatter friendly -exclude ./vendor/... $(REVIVELINTER_EXCLUDES) ./...
Expand Down
6 changes: 3 additions & 3 deletions uniuri/uniuri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ func TestNew(t *testing.T) {
for i := range uris {
uris[i] = New()
}
for i, u := range uris {
for i, u1 := range uris {
for j, u2 := range uris {
if i != j && u == u2 {
t.Fatalf("not unique: %d:%q and %d:%q", i, u, j, u2)
if i != j && u1 == u2 {
t.Fatalf("not unique: %d:%q and %d:%q", i, u1, j, u2)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions uuid/uuid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ func TestConstants(t *testing.T) {
if !ok {
t.Errorf("%x: %v: not a stringer", x, v)
} else if s := v.String(); s != tt.name {
v, _ := tt.c.(int)
t.Errorf("%x: Constant %T:%d gives %q, expected %q", x, tt.c, v, s, tt.name)
v2, _ := tt.c.(int)
t.Errorf("%x: Constant %T:%d gives %q, expected %q", x, tt.c, v2, s, tt.name)
}
}
}
Expand Down

0 comments on commit 0fb6a1c

Please sign in to comment.