Skip to content

Commit 5ec43d0

Browse files
committed
review
1 parent 064f43f commit 5ec43d0

15 files changed

+11
-50
lines changed

pkg/commands/internal/migrate/cloner/cloner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import (
1616
"golang.org/x/tools/imports"
1717
)
1818

19-
const newPkgName = "two"
19+
const newPkgName = "versiontwo"
2020

2121
const (
2222
srcDir = "./pkg/config"
23-
dstDir = "./pkg/commands/internal/migrate/two"
23+
dstDir = "./pkg/commands/internal/migrate/versiontwo"
2424
)
2525

2626
func main() {

pkg/commands/internal/migrate/migrate_linter_names.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -623,11 +623,6 @@ func allLinters() []LinterInfo {
623623
Presets: []string{"style"},
624624
Slow: true,
625625
},
626-
{
627-
Name: "tenv",
628-
Presets: []string{"test"},
629-
Slow: true,
630-
},
631626
{
632627
Name: "testableexamples",
633628
Presets: []string{"test"},

pkg/commands/internal/migrate/migrate_linter_names_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func Test_enableAllFilter(t *testing.T) {
148148
Fast: ptr.Pointer(true),
149149
Presets: nil,
150150
},
151-
expected: []string{"asasalint", "bodyclose", "canonicalheader", "containedctx", "contextcheck", "durationcheck", "err113", "errcheck", "errchkjson", "errname", "errorlint", "exhaustive", "exhaustruct", "exptostd", "fatcontext", "forbidigo", "forcetypeassert", "ginkgolinter", "gochecknoglobals", "gochecksumtype", "gocritic", "gosec", "gosimple", "gosmopolitan", "govet", "iface", "importas", "intrange", "ireturn", "loggercheck", "makezero", "mirror", "musttag", "nilerr", "nilnesserr", "nilnil", "noctx", "nonamedreturns", "paralleltest", "perfsprint", "protogetter", "reassign", "recvcheck", "revive", "rowserrcheck", "sloglint", "spancheck", "sqlclosecheck", "staticcheck", "stylecheck", "tagliatelle", "tenv", "testifylint", "thelper", "tparallel", "unconvert", "unparam", "unused", "usetesting", "varnamelen", "wastedassign", "wrapcheck", "zerologlint"},
151+
expected: []string{"asasalint", "bodyclose", "canonicalheader", "containedctx", "contextcheck", "durationcheck", "err113", "errcheck", "errchkjson", "errname", "errorlint", "exhaustive", "exhaustruct", "exptostd", "fatcontext", "forbidigo", "forcetypeassert", "ginkgolinter", "gochecknoglobals", "gochecksumtype", "gocritic", "gosec", "gosimple", "gosmopolitan", "govet", "iface", "importas", "intrange", "ireturn", "loggercheck", "makezero", "mirror", "musttag", "nilerr", "nilnesserr", "nilnil", "noctx", "nonamedreturns", "paralleltest", "perfsprint", "protogetter", "reassign", "recvcheck", "revive", "rowserrcheck", "sloglint", "spancheck", "sqlclosecheck", "staticcheck", "stylecheck", "tagliatelle", "testifylint", "thelper", "tparallel", "unconvert", "unparam", "unused", "usetesting", "varnamelen", "wastedassign", "wrapcheck", "zerologlint"},
152152
},
153153
{
154154
desc: "disable",
@@ -168,7 +168,7 @@ func Test_enableAllFilter(t *testing.T) {
168168
Fast: ptr.Pointer(true),
169169
Presets: nil,
170170
},
171-
expected: []string{"asasalint", "bodyclose", "canonicalheader", "containedctx", "contextcheck", "durationcheck", "err113", "errcheck", "errchkjson", "errname", "errorlint", "exhaustive", "exhaustruct", "exptostd", "fatcontext", "forbidigo", "forcetypeassert", "ginkgolinter", "gochecknoglobals", "gochecksumtype", "gocritic", "gosec", "gosimple", "gosmopolitan", "govet", "iface", "importas", "intrange", "ireturn", "lll", "loggercheck", "makezero", "mirror", "misspell", "musttag", "nilerr", "nilnesserr", "nilnil", "noctx", "nonamedreturns", "paralleltest", "perfsprint", "protogetter", "reassign", "recvcheck", "revive", "rowserrcheck", "sloglint", "spancheck", "sqlclosecheck", "staticcheck", "stylecheck", "tagliatelle", "tenv", "testifylint", "thelper", "tparallel", "unconvert", "unparam", "unused", "usetesting", "varnamelen", "wastedassign", "wrapcheck", "zerologlint"},
171+
expected: []string{"asasalint", "bodyclose", "canonicalheader", "containedctx", "contextcheck", "durationcheck", "err113", "errcheck", "errchkjson", "errname", "errorlint", "exhaustive", "exhaustruct", "exptostd", "fatcontext", "forbidigo", "forcetypeassert", "ginkgolinter", "gochecknoglobals", "gochecksumtype", "gocritic", "gosec", "gosimple", "gosmopolitan", "govet", "iface", "importas", "intrange", "ireturn", "lll", "loggercheck", "makezero", "mirror", "misspell", "musttag", "nilerr", "nilnesserr", "nilnil", "noctx", "nonamedreturns", "paralleltest", "perfsprint", "protogetter", "reassign", "recvcheck", "revive", "rowserrcheck", "sloglint", "spancheck", "sqlclosecheck", "staticcheck", "stylecheck", "tagliatelle", "testifylint", "thelper", "tparallel", "unconvert", "unparam", "unused", "usetesting", "varnamelen", "wastedassign", "wrapcheck", "zerologlint"},
172172
},
173173
{
174174
desc: "disable, enable, fast",
@@ -179,7 +179,7 @@ func Test_enableAllFilter(t *testing.T) {
179179
Fast: ptr.Pointer(true),
180180
Presets: nil,
181181
},
182-
expected: []string{"asasalint", "bodyclose", "containedctx", "contextcheck", "durationcheck", "err113", "errcheck", "errchkjson", "errorlint", "exhaustive", "exhaustruct", "exptostd", "fatcontext", "forbidigo", "forcetypeassert", "ginkgolinter", "gochecknoglobals", "gochecksumtype", "gocritic", "gosec", "gosimple", "gosmopolitan", "govet", "iface", "importas", "intrange", "ireturn", "lll", "loggercheck", "makezero", "mirror", "misspell", "musttag", "nilerr", "nilnesserr", "nilnil", "noctx", "nonamedreturns", "paralleltest", "perfsprint", "protogetter", "reassign", "recvcheck", "revive", "rowserrcheck", "sloglint", "spancheck", "sqlclosecheck", "staticcheck", "stylecheck", "tagliatelle", "tenv", "testifylint", "thelper", "tparallel", "unconvert", "unparam", "unused", "usetesting", "varnamelen", "wastedassign", "wrapcheck", "zerologlint"},
182+
expected: []string{"asasalint", "bodyclose", "containedctx", "contextcheck", "durationcheck", "err113", "errcheck", "errchkjson", "errorlint", "exhaustive", "exhaustruct", "exptostd", "fatcontext", "forbidigo", "forcetypeassert", "ginkgolinter", "gochecknoglobals", "gochecksumtype", "gocritic", "gosec", "gosimple", "gosmopolitan", "govet", "iface", "importas", "intrange", "ireturn", "lll", "loggercheck", "makezero", "mirror", "misspell", "musttag", "nilerr", "nilnesserr", "nilnil", "noctx", "nonamedreturns", "paralleltest", "perfsprint", "protogetter", "reassign", "recvcheck", "revive", "rowserrcheck", "sloglint", "spancheck", "sqlclosecheck", "staticcheck", "stylecheck", "tagliatelle", "testifylint", "thelper", "tparallel", "unconvert", "unparam", "unused", "usetesting", "varnamelen", "wastedassign", "wrapcheck", "zerologlint"},
183183
},
184184
}
185185

pkg/commands/internal/migrate/migrate_linters_settings.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ func toLinterSettings(old versionone.LintersSettings) versiontwo.LintersSettings
7676
Staticcheck: toStaticCheckSettings(old),
7777
TagAlign: toTagAlignSettings(old.TagAlign),
7878
Tagliatelle: toTagliatelleSettings(old.Tagliatelle),
79-
Tenv: toTenvSettings(old.Tenv),
8079
Testifylint: toTestifylintSettings(old.Testifylint),
8180
Testpackage: toTestpackageSettings(old.Testpackage),
8281
Thelper: toThelperSettings(old.Thelper),
@@ -816,12 +815,6 @@ func toTagliatelleSettings(old versionone.TagliatelleSettings) versiontwo.Taglia
816815
return versiontwo.TagliatelleSettings{Case: tcase}
817816
}
818817

819-
func toTenvSettings(old versionone.TenvSettings) versiontwo.TenvSettings {
820-
return versiontwo.TenvSettings{
821-
All: old.All,
822-
}
823-
}
824-
825818
func toTestifylintSettings(old versionone.TestifylintSettings) versiontwo.TestifylintSettings {
826819
return versiontwo.TestifylintSettings{
827820
EnableAll: old.EnableAll,

pkg/commands/internal/migrate/testdata/linters-settings_tenv.golden.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

pkg/commands/internal/migrate/testdata/linters-settings_tenv.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

pkg/commands/internal/migrate/testdata/linters_02.golden.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ linters:
9191
- staticcheck
9292
- tagalign
9393
- tagliatelle
94-
- tenv
9594
- testableexamples
9695
- testifylint
9796
- testpackage

pkg/commands/internal/migrate/testdata/linters_03.golden.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ linters:
4141
- mnd
4242
- mycustomlinter3
4343
- mycustomlinter4
44-
- tenv
4544
formatters:
4645
enable:
4746
- gofmt

pkg/commands/internal/migrate/testdata/linters_06.golden.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ linters:
4343
- mnd
4444
- mycustomlinter3
4545
- mycustomlinter4
46-
- tenv
4746
formatters:
4847
enable:
4948
- gci

pkg/commands/internal/migrate/testdata/linters_08.golden.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ linters:
6464
- sqlclosecheck
6565
- staticcheck
6666
- tagliatelle
67-
- tenv
6867
- testifylint
6968
- thelper
7069
- tparallel

pkg/commands/internal/migrate/testdata/linters_09.golden.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ linters:
4444
- mycustomlinter3
4545
- mycustomlinter4
4646
- staticcheck
47-
- tenv
4847
formatters:
4948
enable:
5049
- gofmt

pkg/commands/internal/migrate/versiontwo/linters_settings.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/commands/migrate.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,14 @@ func (c *migrateCommand) execute(_ *cobra.Command, _ []string) error {
9898
return err
9999
}
100100

101+
c.log.Warnf("The configuration comments are not migrated.")
102+
101103
c.log.Infof("Migrating v1 configuration file: %s", srcPath)
102104

103105
ext := filepath.Ext(srcPath)
104106

105107
if c.opts.format != "" {
106-
ext = "." + strings.TrimPrefix(c.opts.format, ".")
108+
ext = "." + c.opts.format
107109
}
108110

109111
if !strings.EqualFold(filepath.Ext(srcPath), ext) {

pkg/config/base_loader.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/golangci/golangci-lint/pkg/logutils"
1717
)
1818

19-
type CFG interface {
19+
type BaseConfig interface {
2020
IsInternalTest() bool
2121
SetConfigDir(dir string)
2222
}
@@ -28,11 +28,11 @@ type BaseLoader struct {
2828

2929
log logutils.Log
3030

31-
cfg CFG
31+
cfg BaseConfig
3232
args []string
3333
}
3434

35-
func NewBaseLoader(log logutils.Log, v *viper.Viper, opts LoaderOptions, cfg CFG, args []string) *BaseLoader {
35+
func NewBaseLoader(log logutils.Log, v *viper.Viper, opts LoaderOptions, cfg BaseConfig, args []string) *BaseLoader {
3636
return &BaseLoader{
3737
opts: opts,
3838
viper: v,

pkg/config/linters_settings.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ type LintersSettings struct {
262262
Staticcheck StaticCheckSettings `mapstructure:"staticcheck"`
263263
TagAlign TagAlignSettings `mapstructure:"tagalign"`
264264
Tagliatelle TagliatelleSettings `mapstructure:"tagliatelle"`
265-
Tenv TenvSettings `mapstructure:"tenv"`
266265
Testifylint TestifylintSettings `mapstructure:"testifylint"`
267266
Testpackage TestpackageSettings `mapstructure:"testpackage"`
268267
Thelper ThelperSettings `mapstructure:"thelper"`
@@ -895,10 +894,6 @@ type ThelperOptions struct {
895894
Begin *bool `mapstructure:"begin"`
896895
}
897896

898-
type TenvSettings struct {
899-
All bool `mapstructure:"all"`
900-
}
901-
902897
type UseStdlibVarsSettings struct {
903898
HTTPMethod bool `mapstructure:"http-method"`
904899
HTTPStatusCode bool `mapstructure:"http-status-code"`

0 commit comments

Comments
 (0)