Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ require (
github.com/sanposhiho/wastedassign/v2 v2.1.0
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1
github.com/sashamelentyev/interfacebloat v1.1.0
github.com/sashamelentyev/usestdlibvars v1.27.0
github.com/sashamelentyev/usestdlibvars v1.28.0
github.com/securego/gosec/v2 v2.21.4
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
github.com/shirou/gopsutil/v4 v4.24.11
Expand Down
4 changes: 2 additions & 2 deletions go.sum

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

14 changes: 14 additions & 0 deletions pkg/golinters/usestdlibvars/testdata/fix/in/usestdlibvars.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//golangcitest:args -Eusestdlibvars
//golangcitest:expected_exitcode 0
package testdata

import "net/http"

func _200() {
_ = 200
}

func _200_1() {
var w http.ResponseWriter
w.WriteHeader(200) // want `"200" can be replaced by http.StatusOK`
}
14 changes: 14 additions & 0 deletions pkg/golinters/usestdlibvars/testdata/fix/out/usestdlibvars.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//golangcitest:args -Eusestdlibvars
//golangcitest:expected_exitcode 0
package testdata

import "net/http"

func _200() {
_ = 200
}

func _200_1() {
var w http.ResponseWriter
w.WriteHeader(http.StatusOK) // want `"200" can be replaced by http.StatusOK`
}
8 changes: 8 additions & 0 deletions pkg/golinters/usestdlibvars/usestdlibvars_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ import (
func TestFromTestdata(t *testing.T) {
integration.RunTestdata(t)
}

func TestFix(t *testing.T) {
integration.RunFix(t)
}

func TestFixPathPrefix(t *testing.T) {
integration.RunFixPathPrefix(t)
}
1 change: 1 addition & 0 deletions pkg/lint/lintersdb/builder_linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
linter.NewConfig(usestdlibvars.New(&cfg.LintersSettings.UseStdlibVars)).
WithSince("v1.48.0").
WithPresets(linter.PresetStyle).
WithAutoFix().
WithURL("https://github.com/sashamelentyev/usestdlibvars"),

linter.NewConfig(usetesting.New(&cfg.LintersSettings.UseTesting)).
Expand Down
Loading