Skip to content

Commit 1d2e960

Browse files
committed
chore: update implementation
1 parent 438b217 commit 1d2e960

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//golangcitest:args -Eusestdlibvars
2+
//golangcitest:expected_exitcode 0
3+
package testdata
4+
5+
import "net/http"
6+
7+
func _200() {
8+
_ = 200
9+
}
10+
11+
func _200_1() {
12+
var w http.ResponseWriter
13+
w.WriteHeader(200) // want `"200" can be replaced by http.StatusOK`
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//golangcitest:args -Eusestdlibvars
2+
//golangcitest:expected_exitcode 0
3+
package testdata
4+
5+
import "net/http"
6+
7+
func _200() {
8+
_ = 200
9+
}
10+
11+
func _200_1() {
12+
var w http.ResponseWriter
13+
w.WriteHeader(http.StatusOK) // want `"200" can be replaced by http.StatusOK`
14+
}

pkg/golinters/usestdlibvars/usestdlibvars_integration_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ import (
99
func TestFromTestdata(t *testing.T) {
1010
integration.RunTestdata(t)
1111
}
12+
13+
func TestFix(t *testing.T) {
14+
integration.RunFix(t)
15+
}
16+
17+
func TestFixPathPrefix(t *testing.T) {
18+
integration.RunFixPathPrefix(t)
19+
}

pkg/lint/lintersdb/builder_linter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
821821
linter.NewConfig(usestdlibvars.New(&cfg.LintersSettings.UseStdlibVars)).
822822
WithSince("v1.48.0").
823823
WithPresets(linter.PresetStyle).
824+
WithAutoFix().
824825
WithURL("https://github.com/sashamelentyev/usestdlibvars"),
825826

826827
linter.NewConfig(usetesting.New(&cfg.LintersSettings.UseTesting)).

0 commit comments

Comments
 (0)