Skip to content

Commit 2ead64d

Browse files
committed
delete check conditions
1 parent 365be1c commit 2ead64d

10 files changed

+11
-62
lines changed

.golangci.example.yml

-2
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,6 @@ linters-settings:
623623
begin: true
624624

625625
tenv:
626-
# The following configurations enable checks prior to Go 1.17.
627-
force: false
628626
# The all option will run against all method in test file.
629627
# By default, only methods that take *testing.T, *testing.B, and testing.TB as arguments are checked.
630628
all: false

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ require (
6969
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
7070
github.com/shirou/gopsutil/v3 v3.21.8
7171
github.com/sirupsen/logrus v1.8.1
72-
github.com/sivchari/tenv v1.1.6
72+
github.com/sivchari/tenv v1.2.6
7373
github.com/sonatard/noctx v0.0.1
7474
github.com/sourcegraph/go-diff v0.6.1
7575
github.com/spf13/cobra v1.2.1

go.sum

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/config/linters_settings.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ type ThelperSettings struct {
460460
}
461461

462462
type TenvSettings struct {
463-
Force bool `mapstructure:"force"`
464-
All bool `mapstructure:"all"`
463+
All bool `mapstructure:"all"`
465464
}
466465

467466
type UnparamSettings struct {

pkg/golinters/tenv.go

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ func NewTenv(settings *config.TenvSettings) *goanalysis.Linter {
1919
if settings != nil {
2020
cfg = map[string]map[string]interface{}{
2121
a.Name: {
22-
tenv.F: settings.Force,
2322
tenv.A: settings.All,
2423
},
2524
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
linters-settings:
22
tenv:
3-
force: true
43
all: true

test/testdata/configs/tenv_force.yml

-3
This file was deleted.

test/testdata/tenv_all_force_test.go test/testdata/tenv_all_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// args: -Etenv
2-
// config_path: testdata/configs/tenv_all_force.yml
2+
// config_path: testdata/configs/tenv_all.yml
33
package testdata
44

55
import (

test/testdata/tenv_force_test.go

-41
This file was deleted.

test/testdata/tenv_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ func setup() {
1919
}
2020

2121
func TestF(t *testing.T) {
22-
os.Setenv("a", "b") // OK
23-
if err := os.Setenv("a", "b"); err != nil { // OK
22+
os.Setenv("a", "b") // ERROR "func TestF is not using testing.Setenv"
23+
if err := os.Setenv("a", "b"); err != nil { // ERROR "func TestF is not using testing.Setenv"
2424
_ = err
2525
}
2626
}
2727

2828
func BenchmarkF(b *testing.B) {
29-
os.Setenv("a", "b") // OK
30-
if err := os.Setenv("a", "b"); err != nil { // OK
29+
os.Setenv("a", "b") // ERROR "func BenchmarkF is not using testing.Setenv"
30+
if err := os.Setenv("a", "b"); err != nil { // ERROR "func BenchmarkF is not using testing.Setenv"
3131
_ = err
3232
}
3333
}
3434

3535
func testTB(tb testing.TB) {
36-
os.Setenv("a", "b") // OK
37-
if err := os.Setenv("a", "b"); err != nil { // OK
36+
os.Setenv("a", "b") // ERROR "func testTB is not using testing.Setenv"
37+
if err := os.Setenv("a", "b"); err != nil { // ERROR "func testTB is not using testing.Setenv"
3838
_ = err
3939
}
4040
}

0 commit comments

Comments
 (0)