Skip to content

Commit

Permalink
delete check conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
sivchari committed Sep 17, 2021
1 parent 365be1c commit 2ead64d
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 62 deletions.
2 changes: 0 additions & 2 deletions .golangci.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,6 @@ linters-settings:
begin: true

tenv:
# The following configurations enable checks prior to Go 1.17.
force: false
# The all option will run against all method in test file.
# By default, only methods that take *testing.T, *testing.B, and testing.TB as arguments are checked.
all: false
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ require (
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
github.com/shirou/gopsutil/v3 v3.21.8
github.com/sirupsen/logrus v1.8.1
github.com/sivchari/tenv v1.1.6
github.com/sivchari/tenv v1.2.6
github.com/sonatard/noctx v0.0.1
github.com/sourcegraph/go-diff v0.6.1
github.com/spf13/cobra v1.2.1
Expand Down
6 changes: 2 additions & 4 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,7 @@ type ThelperSettings struct {
}

type TenvSettings struct {
Force bool `mapstructure:"force"`
All bool `mapstructure:"all"`
All bool `mapstructure:"all"`
}

type UnparamSettings struct {
Expand Down
1 change: 0 additions & 1 deletion pkg/golinters/tenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func NewTenv(settings *config.TenvSettings) *goanalysis.Linter {
if settings != nil {
cfg = map[string]map[string]interface{}{
a.Name: {
tenv.F: settings.Force,
tenv.A: settings.All,
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
linters-settings:
tenv:
force: true
all: true
3 changes: 0 additions & 3 deletions test/testdata/configs/tenv_force.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// args: -Etenv
// config_path: testdata/configs/tenv_all_force.yml
// config_path: testdata/configs/tenv_all.yml
package testdata

import (
Expand Down
41 changes: 0 additions & 41 deletions test/testdata/tenv_force_test.go

This file was deleted.

12 changes: 6 additions & 6 deletions test/testdata/tenv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ func setup() {
}

func TestF(t *testing.T) {
os.Setenv("a", "b") // OK
if err := os.Setenv("a", "b"); err != nil { // OK
os.Setenv("a", "b") // ERROR "func TestF is not using testing.Setenv"
if err := os.Setenv("a", "b"); err != nil { // ERROR "func TestF is not using testing.Setenv"
_ = err
}
}

func BenchmarkF(b *testing.B) {
os.Setenv("a", "b") // OK
if err := os.Setenv("a", "b"); err != nil { // OK
os.Setenv("a", "b") // ERROR "func BenchmarkF is not using testing.Setenv"
if err := os.Setenv("a", "b"); err != nil { // ERROR "func BenchmarkF is not using testing.Setenv"
_ = err
}
}

func testTB(tb testing.TB) {
os.Setenv("a", "b") // OK
if err := os.Setenv("a", "b"); err != nil { // OK
os.Setenv("a", "b") // ERROR "func testTB is not using testing.Setenv"
if err := os.Setenv("a", "b"); err != nil { // ERROR "func testTB is not using testing.Setenv"
_ = err
}
}

0 comments on commit 2ead64d

Please sign in to comment.