Skip to content

Commit f486fc1

Browse files
committed
review
1 parent 04a3085 commit f486fc1

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

Diff for: Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ test: build
3333
GL_TEST_RUN=1 go test -v -parallel 2 ./...
3434
.PHONY: test
3535

36-
# ex: T=gofmt.go make test_fix
36+
# ex: T=multiple-issues-fix.go make test_integration_fix
3737
# the value of `T` is the name of a file from `test/testdata/fix`
38-
test_fix: build
38+
test_integration_fix: build
3939
GL_TEST_RUN=1 go test -v ./test -count 1 -run TestFix/$T
40-
.PHONY: test_fix
40+
.PHONY: test_integration_fix
4141

4242
test_race: build_race
4343
GL_TEST_RUN=1 ./$(BINARY) run -v --timeout=5m

Diff for: pkg/golinters/gocritic/gocritic.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,11 @@ func (s *settingsWrapper) debugChecksFinalState() {
430430
var disabledChecks []string
431431

432432
for _, checker := range s.allCheckers {
433-
name := checker.Name
434-
if s.inferredEnabledChecks.has(name) {
435-
enabledChecks = append(enabledChecks, name)
433+
check := checker.Name
434+
if s.inferredEnabledChecks.has(check) {
435+
enabledChecks = append(enabledChecks, check)
436436
} else {
437-
disabledChecks = append(disabledChecks, name)
437+
disabledChecks = append(disabledChecks, check)
438438
}
439439
}
440440

@@ -512,25 +512,25 @@ func (s *settingsWrapper) validateCheckerTags() error {
512512
}
513513

514514
func (s *settingsWrapper) validateCheckerNames() error {
515-
for _, name := range s.EnabledChecks {
516-
if !s.allChecks.has(name) {
517-
return fmt.Errorf("enabled check %q doesn't exist, see %s's documentation", name, name)
515+
for _, check := range s.EnabledChecks {
516+
if !s.allChecks.has(check) {
517+
return fmt.Errorf("enabled check %q doesn't exist, see %s's documentation", check, name)
518518
}
519519
}
520520

521-
for _, name := range s.DisabledChecks {
522-
if !s.allChecks.has(name) {
523-
return fmt.Errorf("disabled check %q doesn't exist, see %s documentation", name, name)
521+
for _, check := range s.DisabledChecks {
522+
if !s.allChecks.has(check) {
523+
return fmt.Errorf("disabled check %q doesn't exist, see %s documentation", check, name)
524524
}
525525
}
526526

527-
for name := range s.SettingsPerCheck {
528-
lcName := strings.ToLower(name)
527+
for check := range s.SettingsPerCheck {
528+
lcName := strings.ToLower(check)
529529
if !s.allChecksLowerCased.has(lcName) {
530-
return fmt.Errorf("invalid check settings: check %q doesn't exist, see %s documentation", name, name)
530+
return fmt.Errorf("invalid check settings: check %q doesn't exist, see %s documentation", check, name)
531531
}
532532
if !s.inferredEnabledChecksLowerCased.has(lcName) {
533-
s.logger.Warnf("%s: settings were provided for disabled check %q", name, name)
533+
s.logger.Warnf("%s: settings were provided for disabled check %q", check, name)
534534
}
535535
}
536536

Diff for: test/testshared/install.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ const envGolangciLintInstalled = "GOLANGCI_LINT_INSTALLED"
2121
// The majority of tests are NOT executed inside the same process,
2222
// then this is just to limit some cases (~60 cases).
2323
var (
24-
built bool
2524
builtLock sync.RWMutex
25+
built bool
2626
)
2727

2828
func InstallGolangciLint(tb testing.TB) string {
2929
tb.Helper()
3030

31-
parentPath := findMakeFile(tb)
31+
parentPath := findMakefile(tb)
3232

3333
// Avoids concurrent builds and copies (before the end of the build).
3434
f := flock.New(filepath.Join(parentPath, "test.lock"))
@@ -37,7 +37,12 @@ func InstallGolangciLint(tb testing.TB) string {
3737
err := f.Lock()
3838
require.NoError(tb, err)
3939

40-
defer func() { _ = f.Unlock() }()
40+
defer func() {
41+
errU := f.Unlock()
42+
if errU != nil {
43+
tb.Logf("Can't unlock test.lock: %v", errU)
44+
}
45+
}()
4146

4247
builtLock.Lock()
4348
defer builtLock.Unlock()
@@ -46,10 +51,6 @@ func InstallGolangciLint(tb testing.TB) string {
4651
cmd := exec.Command("make", "-C", parentPath, "build")
4752

4853
output, err := cmd.CombinedOutput()
49-
if err != nil {
50-
tb.Log(string(output))
51-
}
52-
5354
require.NoError(tb, err, "can't install golangci-lint %s", string(output))
5455

5556
built = true
@@ -68,7 +69,7 @@ func InstallGolangciLint(tb testing.TB) string {
6869
return abs
6970
}
7071

71-
func findMakeFile(tb testing.TB) string {
72+
func findMakefile(tb testing.TB) string {
7273
tb.Helper()
7374

7475
wd, _ := os.Getwd()

0 commit comments

Comments
 (0)