From 6a1e2233a8f044eacd10041c0320e45251ec0ee1 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Fri, 15 Jul 2022 14:35:55 +0200 Subject: [PATCH 1/2] tests: use directives instead of comments --- pkg/golinters/gofmt_test.go | 2 +- test/linters_test.go | 56 +++++++++++-------- test/testdata/asciicheck.go | 2 +- test/testdata/bidichk.go | 2 +- test/testdata/bodyclose.go | 2 +- test/testdata/containedctx.go | 2 +- test/testdata/contextcheck.go | 2 +- test/testdata/cyclop.go | 4 +- test/testdata/deadcode.go | 2 +- test/testdata/decorder.go | 4 +- test/testdata/decorder_default.go | 2 +- test/testdata/default_exclude.go | 4 +- test/testdata/depguard.go | 4 +- test/testdata/depguard_additional_guards.go | 4 +- test/testdata/depguard_ignore_file_rules.go | 4 +- test/testdata/dogsled.go | 2 +- test/testdata/dupl.go | 4 +- test/testdata/durationcheck.go | 2 +- test/testdata/errcheck.go | 2 +- test/testdata/errcheck_exclude.go | 6 +- test/testdata/errcheck_exclude_functions.go | 4 +- test/testdata/errcheck_ignore.go | 4 +- test/testdata/errcheck_ignore_default.go | 4 +- test/testdata/errcheck_type_assertions.go | 4 +- test/testdata/errchkjson.go | 4 +- .../errchkjson_check_error_free_encoding.go | 4 +- test/testdata/errchkjson_no_exported.go | 4 +- test/testdata/errname.go | 2 +- test/testdata/errorlint.go | 2 +- test/testdata/errorlint_asserts.go | 4 +- test/testdata/errorlint_comparison.go | 4 +- test/testdata/errorlint_errorf.go | 4 +- test/testdata/execinquery.go | 2 +- test/testdata/exhaustive.go | 2 +- test/testdata/exhaustive_default.go | 4 +- test/testdata/exhaustive_generated.go | 2 +- .../exhaustive_ignore_enum_members.go | 4 +- test/testdata/exhaustivestruct.go | 2 +- test/testdata/exhaustivestruct_custom.go | 4 +- test/testdata/exhaustruct.go | 2 +- test/testdata/exhaustruct_custom.go | 4 +- test/testdata/exportloopref.go | 2 +- test/testdata/fix/in/gci.go | 4 +- test/testdata/fix/in/gocritic.go | 4 +- test/testdata/fix/in/godot.go | 2 +- test/testdata/fix/in/gofmt.go | 2 +- test/testdata/fix/in/gofumpt.go | 4 +- test/testdata/fix/in/goimports.go | 2 +- test/testdata/fix/in/misspell.go | 2 +- test/testdata/fix/in/nolintlint.go | 6 +- test/testdata/fix/in/whitespace.go | 6 +- test/testdata/fix/out/gci.go | 4 +- test/testdata/fix/out/gocritic.go | 4 +- test/testdata/fix/out/godot.go | 2 +- test/testdata/fix/out/gofmt.go | 2 +- test/testdata/fix/out/gofumpt.go | 4 +- test/testdata/fix/out/goimports.go | 2 +- test/testdata/fix/out/misspell.go | 2 +- test/testdata/fix/out/nolintlint.go | 6 +- test/testdata/fix/out/whitespace.go | 6 +- test/testdata/forbidigo_example.go | 4 +- test/testdata/forbidigo_example_test.go | 4 +- .../forbidigo_include_godoc_examples_test.go | 4 +- test/testdata/forcetypeassert.go | 2 +- test/testdata/funlen.go | 6 +- test/testdata/gci.go | 4 +- test/testdata/gci/gci.go | 4 +- test/testdata/go-header_bad.go | 4 +- test/testdata/go-header_good.go | 4 +- test/testdata/gochecknoglobals.go | 2 +- test/testdata/gochecknoinits.go | 2 +- test/testdata/gocognit.go | 4 +- test/testdata/goconst.go | 2 +- test/testdata/goconst_calls_enabled.go | 4 +- test/testdata/goconst_dont_ignore_test.go | 4 +- test/testdata/goconst_ignore_test.go | 4 +- test/testdata/gocritic.go | 4 +- test/testdata/gocyclo.go | 4 +- test/testdata/godot.go | 2 +- test/testdata/godox.go | 4 +- test/testdata/goerr113.go | 2 +- test/testdata/gofmt.go | 2 +- test/testdata/gofmt_no_simplify.go | 4 +- test/testdata/gofumpt.go | 2 +- test/testdata/gofumpt_with_extra.go | 4 +- test/testdata/goimports.go | 2 +- test/testdata/goimports/goimports.go | 4 +- test/testdata/golint.go | 2 +- test/testdata/gomnd.go | 2 +- test/testdata/gomodguard.go | 4 +- test/testdata/goprintffuncname.go | 2 +- test/testdata/gosec.go | 2 +- test/testdata/gosec_rules_config.go | 4 +- test/testdata/gosec_severity_confidence.go | 4 +- test/testdata/gosimple.go | 2 +- test/testdata/govet.go | 4 +- test/testdata/govet_fieldalignment.go | 4 +- test/testdata/govet_ifaceassert.go | 4 +- test/testdata/ifshort.go | 2 +- test/testdata/importas.go | 4 +- test/testdata/importas_noalias.go | 4 +- test/testdata/importas_strict.go | 4 +- test/testdata/ineffassign.go | 2 +- test/testdata/interfacer.go | 2 +- test/testdata/ireturn_allow.go | 4 +- test/testdata/ireturn_default.go | 2 +- test/testdata/ireturn_reject_stdlib.go | 4 +- test/testdata/lll.go | 4 +- test/testdata/maintidx.go | 2 +- test/testdata/maintidx_under_100.go | 4 +- test/testdata/makezero.go | 2 +- test/testdata/makezero_always.go | 4 +- test/testdata/maligned.go | 2 +- test/testdata/misspell.go | 4 +- test/testdata/nakedret.go | 2 +- test/testdata/nestif.go | 4 +- test/testdata/nilerr.go | 2 +- test/testdata/nilnil.go | 2 +- test/testdata/nlreturn-block-size.go | 4 +- test/testdata/nlreturn.go | 2 +- test/testdata/noctx.go | 2 +- test/testdata/nolintlint.go | 10 ++-- test/testdata/nolintlint_unused.go | 6 +- test/testdata/nonamedreturns.go | 2 +- test/testdata/nonamedreturns_custom.go | 4 +- test/testdata/nosnakecase.go | 2 +- test/testdata/nosprintfhostport.go | 2 +- test/testdata/notcompiles/typecheck.go | 2 +- .../notcompiles/typecheck_many_issues.go | 2 +- test/testdata/paralleltest.go | 2 +- test/testdata/prealloc.go | 2 +- test/testdata/predeclared.go | 2 +- test/testdata/predeclared_custom.go | 4 +- test/testdata/promlinter.go | 2 +- test/testdata/revive.go | 4 +- test/testdata/revive_default.go | 2 +- test/testdata/rowserrcheck.go | 2 +- test/testdata/scopelint.go | 2 +- test/testdata/sqlclosecheck.go | 2 +- test/testdata/staticcheck.go | 2 +- test/testdata/staticcheck_in_megacheck.go | 2 +- test/testdata/structcheck.go | 2 +- test/testdata/stylecheck.go | 2 +- test/testdata/stylecheck_not_in_megacheck.go | 2 +- test/testdata/tagliatelle.go | 2 +- test/testdata/tenv.go | 4 +- test/testdata/tenv_all.go | 4 +- test/testdata/tenv_all_test.go | 4 +- test/testdata/tenv_go118.go | 2 +- test/testdata/tenv_test.go | 2 +- test/testdata/testpackage_test.go | 2 +- test/testdata/thelper.go | 2 +- test/testdata/thelper_go118.go | 2 +- test/testdata/thelper_with_options.go | 4 +- test/testdata/unconvert.go | 2 +- test/testdata/unparam.go | 2 +- test/testdata/unused.go | 2 +- test/testdata/varcheck.go | 2 +- test/testdata/varnamelen.go | 2 +- test/testdata/wastedassign.go | 2 +- test/testdata/wrapcheck.go | 2 +- test/testdata/wsl.go | 4 +- 162 files changed, 280 insertions(+), 272 deletions(-) diff --git a/pkg/golinters/gofmt_test.go b/pkg/golinters/gofmt_test.go index 9c8148ad0e6a..c9be0b1ed4b5 100644 --- a/pkg/golinters/gofmt_test.go +++ b/pkg/golinters/gofmt_test.go @@ -310,7 +310,7 @@ index 2c9f78d..c0d5791 100644 --- a/gofmt.go +++ b/gofmt.go @@ -1,9 +1,9 @@ - //args: -Egofmt + //golangcitest:args -Egofmt package p - func gofmt(a, b int) int { diff --git a/test/linters_test.go b/test/linters_test.go index d821a83847b8..a5d2a3c0ab7b 100644 --- a/test/linters_test.go +++ b/test/linters_test.go @@ -248,7 +248,7 @@ type runContext struct { func buildConfigFromShortRepr(t *testing.T, repr string, config map[string]interface{}) { kv := strings.Split(repr, "=") - require.Len(t, kv, 2) + require.Len(t, kv, 2, "repr: %s", repr) keyParts := strings.Split(kv[0], ".") require.True(t, len(keyParts) >= 2, len(keyParts)) @@ -308,47 +308,55 @@ func extractRunContextFromComments(t *testing.T, sourcePath string) *runContext continue } - line = strings.TrimLeft(strings.TrimPrefix(line, "//"), " ") - if strings.HasPrefix(line, "args: ") { + if !strings.HasPrefix(line, "//golangcitest:") { + require.Failf(t, "invalid prefix of comment line %s", line) + } + + // TODO(ldez) replace that by strings.Cut when we will drop go1.17 + var before string + var after string + if i := strings.Index(line, " "); i >= 0 { + before = line[:i] + after = strings.TrimSpace(line[i+len(" "):]) + } else { + require.Failf(t, "invalid prefix of comment line %s", line) + } + + switch before { + case "//golangcitest:args": require.Nil(t, rc.args) - args := strings.TrimPrefix(line, "args: ") - require.NotEmpty(t, args) - rc.args = strings.Split(args, " ") + require.NotEmpty(t, after) + rc.args = strings.Split(after, " ") continue - } - if strings.HasPrefix(line, "config: ") { - repr := strings.TrimPrefix(line, "config: ") - require.NotEmpty(t, repr) + case "//golangcitest:config": + require.NotEmpty(t, after) if rc.config == nil { rc.config = map[string]interface{}{} } - buildConfigFromShortRepr(t, repr, rc.config) + buildConfigFromShortRepr(t, after, rc.config) continue - } - if strings.HasPrefix(line, "config_path: ") { - configPath := strings.TrimPrefix(line, "config_path: ") - require.NotEmpty(t, configPath) - rc.configPath = configPath + case "//golangcitest:config_path": + require.NotEmpty(t, after) + rc.configPath = after continue - } - if strings.HasPrefix(line, "expected_linter: ") { - expectedLinter := strings.TrimPrefix(line, "expected_linter: ") - require.NotEmpty(t, expectedLinter) - rc.expectedLinter = expectedLinter + case "//golangcitest:expected_linter": + require.NotEmpty(t, after) + rc.expectedLinter = after continue - } - require.Fail(t, "invalid prefix of comment line %s", line) + default: + require.Failf(t, "invalid prefix of comment line %s", line) + } } // guess the expected linter if none is specified if rc.expectedLinter == "" { for _, arg := range rc.args { if strings.HasPrefix(arg, "-E") && !strings.Contains(arg, ",") { - require.Empty(t, rc.expectedLinter, "could not infer expected linter for errors because multiple linters are enabled. Please use the `expected_linter: ` directive in your test to indicate the linter-under-test.") //nolint:lll + require.Empty(t, rc.expectedLinter, "could not infer expected linter for errors because multiple linters are enabled. Please use the `//golangcitest:expected_linter ` directive in your test to indicate the linter-under-test.") //nolint:lll rc.expectedLinter = arg[2:] } } diff --git a/test/testdata/asciicheck.go b/test/testdata/asciicheck.go index 0eeb036f29b4..772cc9d6dba4 100644 --- a/test/testdata/asciicheck.go +++ b/test/testdata/asciicheck.go @@ -1,4 +1,4 @@ -//args: -Easciicheck +//golangcitest:args -Easciicheck package testdata import ( diff --git a/test/testdata/bidichk.go b/test/testdata/bidichk.go index 858839e6d4cb..05e971a0a35b 100644 --- a/test/testdata/bidichk.go +++ b/test/testdata/bidichk.go @@ -1,4 +1,4 @@ -//args: -Ebidichk +//golangcitest:args -Ebidichk package testdata import "fmt" diff --git a/test/testdata/bodyclose.go b/test/testdata/bodyclose.go index 4445715ecb20..ca12d777c874 100644 --- a/test/testdata/bodyclose.go +++ b/test/testdata/bodyclose.go @@ -1,4 +1,4 @@ -//args: -Ebodyclose +//golangcitest:args -Ebodyclose package testdata import ( diff --git a/test/testdata/containedctx.go b/test/testdata/containedctx.go index ef8fc9fce6db..c68aed5f1c70 100644 --- a/test/testdata/containedctx.go +++ b/test/testdata/containedctx.go @@ -1,4 +1,4 @@ -// args: -Econtainedctx +//golangcitest:args -Econtainedctx package testdata import "context" diff --git a/test/testdata/contextcheck.go b/test/testdata/contextcheck.go index 093e9337d0f7..c153b7718936 100644 --- a/test/testdata/contextcheck.go +++ b/test/testdata/contextcheck.go @@ -1,4 +1,4 @@ -//args: -Econtextcheck +//golangcitest:args -Econtextcheck package testdata import "context" diff --git a/test/testdata/cyclop.go b/test/testdata/cyclop.go index 50ce7e4b7969..23870aba4eda 100644 --- a/test/testdata/cyclop.go +++ b/test/testdata/cyclop.go @@ -1,5 +1,5 @@ -//args: -Ecyclop -//config: linters-settings.cyclop.max-complexity=15 +//golangcitest:args -Ecyclop +//golangcitest:config linters-settings.cyclop.max-complexity=15 package testdata func cyclopComplexFunc(s string) { // ERROR "calculated cyclomatic complexity for function cyclopComplexFunc is 22, max is 15" diff --git a/test/testdata/deadcode.go b/test/testdata/deadcode.go index 82379efdddca..1d2cdd9d1238 100644 --- a/test/testdata/deadcode.go +++ b/test/testdata/deadcode.go @@ -1,4 +1,4 @@ -//args: -Edeadcode +//golangcitest:args -Edeadcode package testdata var y int diff --git a/test/testdata/decorder.go b/test/testdata/decorder.go index 5cc325cce2e4..4f409db4074c 100644 --- a/test/testdata/decorder.go +++ b/test/testdata/decorder.go @@ -1,5 +1,5 @@ -// args: -Edecorder -// config_path: testdata/configs/decorder.yml +//golangcitest:args -Edecorder +//golangcitest:config_path testdata/configs/decorder.yml package testdata import "math" diff --git a/test/testdata/decorder_default.go b/test/testdata/decorder_default.go index 69e85a7dac10..a568cf4ca0bc 100644 --- a/test/testdata/decorder_default.go +++ b/test/testdata/decorder_default.go @@ -1,4 +1,4 @@ -// args: -Edecorder +//golangcitest:args -Edecorder package testdata import "math" diff --git a/test/testdata/default_exclude.go b/test/testdata/default_exclude.go index d5e4422886b2..3c2a13a919c3 100644 --- a/test/testdata/default_exclude.go +++ b/test/testdata/default_exclude.go @@ -1,5 +1,5 @@ -//args: -Estylecheck,golint --internal-cmd-test -//config_path: testdata/configs/default_exclude.yml +//golangcitest:args -Estylecheck,golint --internal-cmd-test +//golangcitest:config_path testdata/configs/default_exclude.yml /*Package testdata ...*/ package testdata diff --git a/test/testdata/depguard.go b/test/testdata/depguard.go index 1c3a4a858471..b5c2ec265681 100644 --- a/test/testdata/depguard.go +++ b/test/testdata/depguard.go @@ -1,5 +1,5 @@ -//args: -Edepguard -//config_path: testdata/configs/depguard.yml +//golangcitest:args -Edepguard +//golangcitest:config_path testdata/configs/depguard.yml package testdata import ( diff --git a/test/testdata/depguard_additional_guards.go b/test/testdata/depguard_additional_guards.go index d41ba42673d8..337b1bf21979 100644 --- a/test/testdata/depguard_additional_guards.go +++ b/test/testdata/depguard_additional_guards.go @@ -1,5 +1,5 @@ -//args: -Edepguard -//config_path: testdata/configs/depguard_additional_guards.yml +//golangcitest:args -Edepguard +//golangcitest:config_path testdata/configs/depguard_additional_guards.yml package testdata import ( diff --git a/test/testdata/depguard_ignore_file_rules.go b/test/testdata/depguard_ignore_file_rules.go index e5131cb7b421..cb3cdc438ade 100644 --- a/test/testdata/depguard_ignore_file_rules.go +++ b/test/testdata/depguard_ignore_file_rules.go @@ -1,5 +1,5 @@ -//args: -Edepguard -//config_path: testdata/configs/depguard_ignore_file_rules.yml +//golangcitest:args -Edepguard +//golangcitest:config_path testdata/configs/depguard_ignore_file_rules.yml package testdata // NOTE - No lint errors becuase this file is ignored diff --git a/test/testdata/dogsled.go b/test/testdata/dogsled.go index 8604a2d7944b..1d1ade7119a0 100644 --- a/test/testdata/dogsled.go +++ b/test/testdata/dogsled.go @@ -1,4 +1,4 @@ -//args: -Edogsled +//golangcitest:args -Edogsled package testdata func Dogsled() { diff --git a/test/testdata/dupl.go b/test/testdata/dupl.go index 14edae39bc80..109372f84355 100644 --- a/test/testdata/dupl.go +++ b/test/testdata/dupl.go @@ -1,5 +1,5 @@ -//args: -Edupl -//config: linters-settings.dupl.threshold=20 +//golangcitest:args -Edupl +//golangcitest:config linters-settings.dupl.threshold=20 package testdata type DuplLogger struct{} diff --git a/test/testdata/durationcheck.go b/test/testdata/durationcheck.go index 483f55c58488..b7cd68168e57 100644 --- a/test/testdata/durationcheck.go +++ b/test/testdata/durationcheck.go @@ -1,4 +1,4 @@ -//args: -Edurationcheck +//golangcitest:args -Edurationcheck package testdata import ( diff --git a/test/testdata/errcheck.go b/test/testdata/errcheck.go index dc4343507a09..a894ea3e9492 100644 --- a/test/testdata/errcheck.go +++ b/test/testdata/errcheck.go @@ -1,4 +1,4 @@ -//args: -Eerrcheck +//golangcitest:args -Eerrcheck package testdata import ( diff --git a/test/testdata/errcheck_exclude.go b/test/testdata/errcheck_exclude.go index 461fd48b1566..69af590a75a6 100644 --- a/test/testdata/errcheck_exclude.go +++ b/test/testdata/errcheck_exclude.go @@ -1,6 +1,6 @@ -//args: -Eerrcheck -//config: linters-settings.errcheck.check-blank=true -//config: linters-settings.errcheck.exclude=testdata/errcheck/exclude.txt +//golangcitest:args -Eerrcheck +//golangcitest:config linters-settings.errcheck.check-blank=true +//golangcitest:config linters-settings.errcheck.exclude=testdata/errcheck/exclude.txt package testdata import ( diff --git a/test/testdata/errcheck_exclude_functions.go b/test/testdata/errcheck_exclude_functions.go index 9ad8dda6cd97..ff17ab9a7198 100644 --- a/test/testdata/errcheck_exclude_functions.go +++ b/test/testdata/errcheck_exclude_functions.go @@ -1,5 +1,5 @@ -//args: -Eerrcheck -//config_path: testdata/errcheck/exclude_functions.yml +//golangcitest:args -Eerrcheck +//golangcitest:config_path testdata/errcheck/exclude_functions.yml package testdata import ( diff --git a/test/testdata/errcheck_ignore.go b/test/testdata/errcheck_ignore.go index 8528d78bae32..508101e85f66 100644 --- a/test/testdata/errcheck_ignore.go +++ b/test/testdata/errcheck_ignore.go @@ -1,5 +1,5 @@ -//args: -Eerrcheck -//config_path: testdata/errcheck/ignore_config.yml +//golangcitest:args -Eerrcheck +//golangcitest:config_path testdata/errcheck/ignore_config.yml package testdata import ( diff --git a/test/testdata/errcheck_ignore_default.go b/test/testdata/errcheck_ignore_default.go index 18b090c20eb8..961c9cdaabbe 100644 --- a/test/testdata/errcheck_ignore_default.go +++ b/test/testdata/errcheck_ignore_default.go @@ -1,5 +1,5 @@ -//args: -Eerrcheck -//config: linters-settings.errcheck.check-blank=true +//golangcitest:args -Eerrcheck +//golangcitest:config linters-settings.errcheck.check-blank=true package testdata import ( diff --git a/test/testdata/errcheck_type_assertions.go b/test/testdata/errcheck_type_assertions.go index a85d69ddfbfd..9a581fb2273b 100644 --- a/test/testdata/errcheck_type_assertions.go +++ b/test/testdata/errcheck_type_assertions.go @@ -1,5 +1,5 @@ -//args: -Eerrcheck -//config: linters-settings.errcheck.check-type-assertions=true +//golangcitest:args -Eerrcheck +//golangcitest:config linters-settings.errcheck.check-type-assertions=true package testdata func ErrorTypeAssertion(filter map[string]interface{}) bool { diff --git a/test/testdata/errchkjson.go b/test/testdata/errchkjson.go index e35a29454320..b74411a709d5 100644 --- a/test/testdata/errchkjson.go +++ b/test/testdata/errchkjson.go @@ -1,5 +1,5 @@ -// args: -Eerrchkjson -// config_path: testdata/configs/errchkjson.yml +//golangcitest:args -Eerrchkjson +//golangcitest:config_path testdata/configs/errchkjson.yml package testdata import ( diff --git a/test/testdata/errchkjson_check_error_free_encoding.go b/test/testdata/errchkjson_check_error_free_encoding.go index d19adf803ca4..fde6deee170b 100644 --- a/test/testdata/errchkjson_check_error_free_encoding.go +++ b/test/testdata/errchkjson_check_error_free_encoding.go @@ -1,5 +1,5 @@ -// args: -Eerrchkjson -// config_path: testdata/configs/errchkjson_check_error_free_encoding.yml +//golangcitest:args -Eerrchkjson +//golangcitest:config_path testdata/configs/errchkjson_check_error_free_encoding.yml package testdata import ( diff --git a/test/testdata/errchkjson_no_exported.go b/test/testdata/errchkjson_no_exported.go index 97880f502899..ef5cc42d8e8b 100644 --- a/test/testdata/errchkjson_no_exported.go +++ b/test/testdata/errchkjson_no_exported.go @@ -1,5 +1,5 @@ -// args: -Eerrchkjson -// config_path: testdata/configs/errchkjson_no_exported.yml +//golangcitest:args -Eerrchkjson +//golangcitest:config_path testdata/configs/errchkjson_no_exported.yml package testdata import ( diff --git a/test/testdata/errname.go b/test/testdata/errname.go index 8b44e0b78f56..a5ccd436f8aa 100644 --- a/test/testdata/errname.go +++ b/test/testdata/errname.go @@ -1,4 +1,4 @@ -//args: -Eerrname +//golangcitest:args -Eerrname package testdata import ( diff --git a/test/testdata/errorlint.go b/test/testdata/errorlint.go index 7d191cae0499..5dda3c864ad4 100644 --- a/test/testdata/errorlint.go +++ b/test/testdata/errorlint.go @@ -1,4 +1,4 @@ -//args: -Eerrorlint +//golangcitest:args -Eerrorlint package testdata import ( diff --git a/test/testdata/errorlint_asserts.go b/test/testdata/errorlint_asserts.go index 31f53a59abcc..a38a58f4bd05 100644 --- a/test/testdata/errorlint_asserts.go +++ b/test/testdata/errorlint_asserts.go @@ -1,5 +1,5 @@ -//args: -Eerrorlint -//config_path: testdata/configs/errorlint_asserts.yml +//golangcitest:args -Eerrorlint +//golangcitest:config_path testdata/configs/errorlint_asserts.yml package testdata import ( diff --git a/test/testdata/errorlint_comparison.go b/test/testdata/errorlint_comparison.go index 1bef52ed2b8f..0b37f988ad8e 100644 --- a/test/testdata/errorlint_comparison.go +++ b/test/testdata/errorlint_comparison.go @@ -1,5 +1,5 @@ -//args: -Eerrorlint -//config_path: testdata/configs/errorlint_comparison.yml +//golangcitest:args -Eerrorlint +//golangcitest:config_path testdata/configs/errorlint_comparison.yml package testdata import ( diff --git a/test/testdata/errorlint_errorf.go b/test/testdata/errorlint_errorf.go index 5d3cb85603d5..52ed9feb3fcb 100644 --- a/test/testdata/errorlint_errorf.go +++ b/test/testdata/errorlint_errorf.go @@ -1,5 +1,5 @@ -//args: -Eerrorlint -//config_path: testdata/configs/errorlint_errorf.yml +//golangcitest:args -Eerrorlint +//golangcitest:config_path testdata/configs/errorlint_errorf.yml package testdata import ( diff --git a/test/testdata/execinquery.go b/test/testdata/execinquery.go index 2c4c742fc412..bcf3ba83289d 100644 --- a/test/testdata/execinquery.go +++ b/test/testdata/execinquery.go @@ -1,4 +1,4 @@ -// args: -Eexecinquery +//golangcitest:args -Eexecinquery package testdata import ( diff --git a/test/testdata/exhaustive.go b/test/testdata/exhaustive.go index 171c6e817fc8..18b8a35b14df 100644 --- a/test/testdata/exhaustive.go +++ b/test/testdata/exhaustive.go @@ -1,4 +1,4 @@ -//args: -Eexhaustive +//golangcitest:args -Eexhaustive package testdata type Direction int diff --git a/test/testdata/exhaustive_default.go b/test/testdata/exhaustive_default.go index 50898eba2469..ff2fcf57fc8c 100644 --- a/test/testdata/exhaustive_default.go +++ b/test/testdata/exhaustive_default.go @@ -1,5 +1,5 @@ -//args: -Eexhaustive -//config_path: testdata/configs/exhaustive_default.yml +//golangcitest:args -Eexhaustive +//golangcitest:config_path testdata/configs/exhaustive_default.yml package testdata type Direction int diff --git a/test/testdata/exhaustive_generated.go b/test/testdata/exhaustive_generated.go index ab9a351d6192..82618d38e4ab 100644 --- a/test/testdata/exhaustive_generated.go +++ b/test/testdata/exhaustive_generated.go @@ -1,4 +1,4 @@ -//args: -Eexhaustive +//golangcitest:args -Eexhaustive package testdata // Code generated by some program. DO NOT EDIT. diff --git a/test/testdata/exhaustive_ignore_enum_members.go b/test/testdata/exhaustive_ignore_enum_members.go index 65bf8fc8d76f..da7a5b43010e 100644 --- a/test/testdata/exhaustive_ignore_enum_members.go +++ b/test/testdata/exhaustive_ignore_enum_members.go @@ -1,5 +1,5 @@ -//args: -Eexhaustive -//config_path: testdata/configs/exhaustive_ignore_enum_members.yml +//golangcitest:args -Eexhaustive +//golangcitest:config_path testdata/configs/exhaustive_ignore_enum_members.yml package testdata type Direction int diff --git a/test/testdata/exhaustivestruct.go b/test/testdata/exhaustivestruct.go index fde230dfdce1..000a8f494af6 100644 --- a/test/testdata/exhaustivestruct.go +++ b/test/testdata/exhaustivestruct.go @@ -1,4 +1,4 @@ -// args: -Eexhaustivestruct --internal-cmd-test +//golangcitest:args -Eexhaustivestruct --internal-cmd-test package testdata import "time" diff --git a/test/testdata/exhaustivestruct_custom.go b/test/testdata/exhaustivestruct_custom.go index 156b7b631552..55a9127ced78 100644 --- a/test/testdata/exhaustivestruct_custom.go +++ b/test/testdata/exhaustivestruct_custom.go @@ -1,5 +1,5 @@ -// args: -Eexhaustivestruct --internal-cmd-test -// config_path: testdata/configs/exhaustivestruct.yml +//golangcitest:args -Eexhaustivestruct --internal-cmd-test +//golangcitest:config_path testdata/configs/exhaustivestruct.yml package testdata import "time" diff --git a/test/testdata/exhaustruct.go b/test/testdata/exhaustruct.go index 6860e5e40e20..6da51f4f0acc 100644 --- a/test/testdata/exhaustruct.go +++ b/test/testdata/exhaustruct.go @@ -1,4 +1,4 @@ -// args: -Eexhaustruct +//golangcitest:args -Eexhaustruct package testdata import "time" diff --git a/test/testdata/exhaustruct_custom.go b/test/testdata/exhaustruct_custom.go index 27e7b6a74c22..352ea9110b1a 100644 --- a/test/testdata/exhaustruct_custom.go +++ b/test/testdata/exhaustruct_custom.go @@ -1,5 +1,5 @@ -// args: -Eexhaustruct -// config_path: testdata/configs/exhaustruct.yml +//golangcitest:args -Eexhaustruct +//golangcitest:config_path testdata/configs/exhaustruct.yml package testdata import "time" diff --git a/test/testdata/exportloopref.go b/test/testdata/exportloopref.go index f71a3902be53..0fe98b1acf52 100644 --- a/test/testdata/exportloopref.go +++ b/test/testdata/exportloopref.go @@ -1,4 +1,4 @@ -//args: -Eexportloopref +//golangcitest:args -Eexportloopref package testdata import "fmt" diff --git a/test/testdata/fix/in/gci.go b/test/testdata/fix/in/gci.go index 4efb0541063e..9a2be3fa59ab 100644 --- a/test/testdata/fix/in/gci.go +++ b/test/testdata/fix/in/gci.go @@ -1,5 +1,5 @@ -//args: -Egci -//config_path: testdata/configs/gci.yml +//golangcitest:args -Egci +//golangcitest:config_path testdata/configs/gci.yml package gci import ( diff --git a/test/testdata/fix/in/gocritic.go b/test/testdata/fix/in/gocritic.go index 80a42b5812f6..a3cecf045ba4 100644 --- a/test/testdata/fix/in/gocritic.go +++ b/test/testdata/fix/in/gocritic.go @@ -1,5 +1,5 @@ -// args: -Egocritic -// config_path: testdata/configs/gocritic-fix.yml +//golangcitest:args -Egocritic +//golangcitest:config_path testdata/configs/gocritic-fix.yml package p import ( diff --git a/test/testdata/fix/in/godot.go b/test/testdata/fix/in/godot.go index 01fc19e8de39..806978fbfe5a 100644 --- a/test/testdata/fix/in/godot.go +++ b/test/testdata/fix/in/godot.go @@ -1,4 +1,4 @@ -//args: -Egodot +//golangcitest:args -Egodot package p /* diff --git a/test/testdata/fix/in/gofmt.go b/test/testdata/fix/in/gofmt.go index 2c9f78d5b559..9c35dc4787be 100644 --- a/test/testdata/fix/in/gofmt.go +++ b/test/testdata/fix/in/gofmt.go @@ -1,4 +1,4 @@ -//args: -Egofmt +//golangcitest:args -Egofmt package p func gofmt(a, b int) int { diff --git a/test/testdata/fix/in/gofumpt.go b/test/testdata/fix/in/gofumpt.go index 0870f31fa674..1fc4a8d6ada6 100644 --- a/test/testdata/fix/in/gofumpt.go +++ b/test/testdata/fix/in/gofumpt.go @@ -1,5 +1,5 @@ -//args: -Egofumpt -//config: linters-settings.gofumpt.extra-rules=true +//golangcitest:args -Egofumpt +//golangcitest:config linters-settings.gofumpt.extra-rules=true package p import "fmt" diff --git a/test/testdata/fix/in/goimports.go b/test/testdata/fix/in/goimports.go index 975dc8839b8f..8e2248c587d5 100644 --- a/test/testdata/fix/in/goimports.go +++ b/test/testdata/fix/in/goimports.go @@ -1,4 +1,4 @@ -//args: -Egofmt,goimports +//golangcitest:args -Egofmt,goimports package p import ( diff --git a/test/testdata/fix/in/misspell.go b/test/testdata/fix/in/misspell.go index 171c6b9becc3..ac2ef6c1eaa3 100644 --- a/test/testdata/fix/in/misspell.go +++ b/test/testdata/fix/in/misspell.go @@ -1,4 +1,4 @@ -//args: -Emisspell +//golangcitest:args -Emisspell package p import "log" diff --git a/test/testdata/fix/in/nolintlint.go b/test/testdata/fix/in/nolintlint.go index b023113c915f..8b484ffbcf34 100644 --- a/test/testdata/fix/in/nolintlint.go +++ b/test/testdata/fix/in/nolintlint.go @@ -1,6 +1,6 @@ -//args: -Enolintlint -Elll -//expected_linter: nolintlint -//config: linters-settings.nolintlint.allow-leading-space=false +//golangcitest:args -Enolintlint -Elll +//golangcitest:expected_linter nolintlint +//golangcitest:config linters-settings.nolintlint.allow-leading-space=false package p import "fmt" diff --git a/test/testdata/fix/in/whitespace.go b/test/testdata/fix/in/whitespace.go index 787ffbbbcc75..b720d3c3802a 100644 --- a/test/testdata/fix/in/whitespace.go +++ b/test/testdata/fix/in/whitespace.go @@ -1,6 +1,6 @@ -//args: -Ewhitespace -//config: linters-settings.whitespace.multi-if=true -//config: linters-settings.whitespace.multi-func=true +//golangcitest:args -Ewhitespace +//golangcitest:config linters-settings.whitespace.multi-if=true +//golangcitest:config linters-settings.whitespace.multi-func=true package p import "fmt" diff --git a/test/testdata/fix/out/gci.go b/test/testdata/fix/out/gci.go index c35c11ac7871..af4e2e80fc8a 100644 --- a/test/testdata/fix/out/gci.go +++ b/test/testdata/fix/out/gci.go @@ -1,5 +1,5 @@ -//args: -Egci -//config_path: testdata/configs/gci.yml +//golangcitest:args -Egci +//golangcitest:config_path testdata/configs/gci.yml package gci import ( diff --git a/test/testdata/fix/out/gocritic.go b/test/testdata/fix/out/gocritic.go index a4fa277d7d28..943e81425596 100644 --- a/test/testdata/fix/out/gocritic.go +++ b/test/testdata/fix/out/gocritic.go @@ -1,5 +1,5 @@ -// args: -Egocritic -// config_path: testdata/configs/gocritic-fix.yml +//golangcitest:args -Egocritic +//golangcitest:config_path testdata/configs/gocritic-fix.yml package p import ( diff --git a/test/testdata/fix/out/godot.go b/test/testdata/fix/out/godot.go index 5d78681bf4c6..7c29db76cf9b 100644 --- a/test/testdata/fix/out/godot.go +++ b/test/testdata/fix/out/godot.go @@ -1,4 +1,4 @@ -//args: -Egodot +//golangcitest:args -Egodot package p /* diff --git a/test/testdata/fix/out/gofmt.go b/test/testdata/fix/out/gofmt.go index c0d579101762..724fb76e5694 100644 --- a/test/testdata/fix/out/gofmt.go +++ b/test/testdata/fix/out/gofmt.go @@ -1,4 +1,4 @@ -//args: -Egofmt +//golangcitest:args -Egofmt package p func gofmt(a, b int) int { diff --git a/test/testdata/fix/out/gofumpt.go b/test/testdata/fix/out/gofumpt.go index 0ae95af95dee..a0ca50b05e66 100644 --- a/test/testdata/fix/out/gofumpt.go +++ b/test/testdata/fix/out/gofumpt.go @@ -1,5 +1,5 @@ -// args: -Egofumpt -// config: linters-settings.gofumpt.extra-rules=true +//golangcitest:args -Egofumpt +//golangcitest:config linters-settings.gofumpt.extra-rules=true package p import "fmt" diff --git a/test/testdata/fix/out/goimports.go b/test/testdata/fix/out/goimports.go index a5a698bb433a..21c25a69238e 100644 --- a/test/testdata/fix/out/goimports.go +++ b/test/testdata/fix/out/goimports.go @@ -1,4 +1,4 @@ -//args: -Egofmt,goimports +//golangcitest:args -Egofmt,goimports package p func goimports(a, b int) int { diff --git a/test/testdata/fix/out/misspell.go b/test/testdata/fix/out/misspell.go index 98ea5144f840..7f3649415227 100644 --- a/test/testdata/fix/out/misspell.go +++ b/test/testdata/fix/out/misspell.go @@ -1,4 +1,4 @@ -//args: -Emisspell +//golangcitest:args -Emisspell package p import "log" diff --git a/test/testdata/fix/out/nolintlint.go b/test/testdata/fix/out/nolintlint.go index 39f112d9d3bd..8858f3eeecbd 100644 --- a/test/testdata/fix/out/nolintlint.go +++ b/test/testdata/fix/out/nolintlint.go @@ -1,6 +1,6 @@ -//args: -Enolintlint -Elll -//expected_linter: nolintlint -//config: linters-settings.nolintlint.allow-leading-space=false +//golangcitest:args -Enolintlint -Elll +//golangcitest:expected_linter nolintlint +//golangcitest:config linters-settings.nolintlint.allow-leading-space=false package p import "fmt" diff --git a/test/testdata/fix/out/whitespace.go b/test/testdata/fix/out/whitespace.go index a6856f25a056..df6e3fa68a97 100644 --- a/test/testdata/fix/out/whitespace.go +++ b/test/testdata/fix/out/whitespace.go @@ -1,6 +1,6 @@ -//args: -Ewhitespace -//config: linters-settings.whitespace.multi-if=true -//config: linters-settings.whitespace.multi-func=true +//golangcitest:args -Ewhitespace +//golangcitest:config linters-settings.whitespace.multi-if=true +//golangcitest:config linters-settings.whitespace.multi-func=true package p import "fmt" diff --git a/test/testdata/forbidigo_example.go b/test/testdata/forbidigo_example.go index 3e7c3b95040a..ef5de706d0e1 100644 --- a/test/testdata/forbidigo_example.go +++ b/test/testdata/forbidigo_example.go @@ -1,5 +1,5 @@ -//args: -Eforbidigo -//config_path: testdata/configs/forbidigo.yml +//golangcitest:args -Eforbidigo +//golangcitest:config_path testdata/configs/forbidigo.yml package testdata import ( diff --git a/test/testdata/forbidigo_example_test.go b/test/testdata/forbidigo_example_test.go index bf1f711d3fbc..8582c8d5d687 100644 --- a/test/testdata/forbidigo_example_test.go +++ b/test/testdata/forbidigo_example_test.go @@ -1,5 +1,5 @@ -//args: -Eforbidigo -//config_path: testdata/configs/forbidigo.yml +//golangcitest:args -Eforbidigo +//golangcitest:config_path testdata/configs/forbidigo.yml package testdata import "fmt" diff --git a/test/testdata/forbidigo_include_godoc_examples_test.go b/test/testdata/forbidigo_include_godoc_examples_test.go index 42049edc1514..9812af1ce152 100644 --- a/test/testdata/forbidigo_include_godoc_examples_test.go +++ b/test/testdata/forbidigo_include_godoc_examples_test.go @@ -1,5 +1,5 @@ -//args: -Eforbidigo -//config: linters-settings.forbidigo.exclude-godoc-examples=false +//golangcitest:args -Eforbidigo +//golangcitest:config linters-settings.forbidigo.exclude-godoc-examples=false package testdata import "fmt" diff --git a/test/testdata/forcetypeassert.go b/test/testdata/forcetypeassert.go index 6febae596907..7f415b2274e8 100644 --- a/test/testdata/forcetypeassert.go +++ b/test/testdata/forcetypeassert.go @@ -1,4 +1,4 @@ -//args: -Eforcetypeassert +//golangcitest:args -Eforcetypeassert package testdata import "fmt" diff --git a/test/testdata/funlen.go b/test/testdata/funlen.go index e37e35525525..5dbbf195d2f7 100644 --- a/test/testdata/funlen.go +++ b/test/testdata/funlen.go @@ -1,6 +1,6 @@ -//args: -Efunlen -//config: linters-settings.funlen.lines=20 -//config: linters-settings.funlen.statements=10 +//golangcitest:args -Efunlen +//golangcitest:config linters-settings.funlen.lines=20 +//golangcitest:config linters-settings.funlen.statements=10 package testdata func TooManyLines() { // ERROR `Function 'TooManyLines' is too long \(22 > 20\)` diff --git a/test/testdata/gci.go b/test/testdata/gci.go index 66effef786b6..a63de6b5465b 100644 --- a/test/testdata/gci.go +++ b/test/testdata/gci.go @@ -1,5 +1,5 @@ -//args: -Egci -//config_path: testdata/configs/gci.yml +//golangcitest:args -Egci +//golangcitest:config_path testdata/configs/gci.yml package testdata import ( diff --git a/test/testdata/gci/gci.go b/test/testdata/gci/gci.go index 2875032513e1..8f83dc21ebfb 100644 --- a/test/testdata/gci/gci.go +++ b/test/testdata/gci/gci.go @@ -1,5 +1,5 @@ -//args: -Egci -//config_path: testdata/configs/gci.yml +//golangcitest:args -Egci +//golangcitest:config_path testdata/configs/gci.yml package gci import ( diff --git a/test/testdata/go-header_bad.go b/test/testdata/go-header_bad.go index 2f24969b9e70..9c9de0b6a825 100644 --- a/test/testdata/go-header_bad.go +++ b/test/testdata/go-header_bad.go @@ -1,5 +1,5 @@ /*MY TITLE!*/ // ERROR `Expected:TITLE\., Actual: TITLE!` -// args: -Egoheader -// config_path: testdata/configs/go-header.yml +//golangcitest:args -Egoheader +//golangcitest:config_path testdata/configs/go-header.yml package testdata diff --git a/test/testdata/go-header_good.go b/test/testdata/go-header_good.go index e1586db3c092..744698111d86 100644 --- a/test/testdata/go-header_good.go +++ b/test/testdata/go-header_good.go @@ -1,5 +1,5 @@ /*MY TITLE.*/ -// args: -Egoheader -// config_path: testdata/configs/go-header.yml +//golangcitest:args -Egoheader +//golangcitest:config_path testdata/configs/go-header.yml package testdata diff --git a/test/testdata/gochecknoglobals.go b/test/testdata/gochecknoglobals.go index 02a1ab7b72e1..a2c1f82c1336 100644 --- a/test/testdata/gochecknoglobals.go +++ b/test/testdata/gochecknoglobals.go @@ -1,4 +1,4 @@ -//args: -Egochecknoglobals +//golangcitest:args -Egochecknoglobals package testdata import ( diff --git a/test/testdata/gochecknoinits.go b/test/testdata/gochecknoinits.go index 226fad451150..5ea8060d430b 100644 --- a/test/testdata/gochecknoinits.go +++ b/test/testdata/gochecknoinits.go @@ -1,4 +1,4 @@ -//args: -Egochecknoinits +//golangcitest:args -Egochecknoinits package testdata import "fmt" diff --git a/test/testdata/gocognit.go b/test/testdata/gocognit.go index dd18c0e82ac7..79a4a0f1ef6e 100644 --- a/test/testdata/gocognit.go +++ b/test/testdata/gocognit.go @@ -1,5 +1,5 @@ -//args: -Egocognit -//config: linters-settings.gocognit.min-complexity=2 +//golangcitest:args -Egocognit +//golangcitest:config linters-settings.gocognit.min-complexity=2 package testdata func GoCognit_CC4_GetWords(number int) string { // ERROR "cognitive complexity 4 of func .* is high .*" diff --git a/test/testdata/goconst.go b/test/testdata/goconst.go index 5942c5667201..6996acb845b8 100644 --- a/test/testdata/goconst.go +++ b/test/testdata/goconst.go @@ -1,4 +1,4 @@ -//args: -Egoconst +//golangcitest:args -Egoconst package testdata import "fmt" diff --git a/test/testdata/goconst_calls_enabled.go b/test/testdata/goconst_calls_enabled.go index dd1a0babb43a..d813ad236a2d 100644 --- a/test/testdata/goconst_calls_enabled.go +++ b/test/testdata/goconst_calls_enabled.go @@ -1,5 +1,5 @@ -//args: -Egoconst -//config: linters-settings.goconst.ignore-calls=false +//golangcitest:args -Egoconst +//golangcitest:config linters-settings.goconst.ignore-calls=false package testdata import "fmt" diff --git a/test/testdata/goconst_dont_ignore_test.go b/test/testdata/goconst_dont_ignore_test.go index a097ef8286f9..51ebd97ae555 100644 --- a/test/testdata/goconst_dont_ignore_test.go +++ b/test/testdata/goconst_dont_ignore_test.go @@ -1,5 +1,5 @@ -//args: -Egoconst -//config: linters-settings.goconst.ignore-tests=false +//golangcitest:args -Egoconst +//golangcitest:config linters-settings.goconst.ignore-tests=false package testdata import ( diff --git a/test/testdata/goconst_ignore_test.go b/test/testdata/goconst_ignore_test.go index 3d265dd54e46..9ef9eb129a94 100644 --- a/test/testdata/goconst_ignore_test.go +++ b/test/testdata/goconst_ignore_test.go @@ -1,5 +1,5 @@ -//args: -Egoconst -//config: linters-settings.goconst.ignore-tests=true +//golangcitest:args -Egoconst +//golangcitest:config linters-settings.goconst.ignore-tests=true package testdata import ( diff --git a/test/testdata/gocritic.go b/test/testdata/gocritic.go index 1768304d1a7f..d3b59fce3f22 100644 --- a/test/testdata/gocritic.go +++ b/test/testdata/gocritic.go @@ -1,5 +1,5 @@ -//args: -Egocritic -//config_path: testdata/configs/gocritic.yml +//golangcitest:args -Egocritic +//golangcitest:config_path testdata/configs/gocritic.yml package testdata import ( diff --git a/test/testdata/gocyclo.go b/test/testdata/gocyclo.go index a5a6b1a4fdd2..ca5b85ca8b44 100644 --- a/test/testdata/gocyclo.go +++ b/test/testdata/gocyclo.go @@ -1,5 +1,5 @@ -//args: -Egocyclo -//config: linters-settings.gocyclo.min-complexity=20 +//golangcitest:args -Egocyclo +//golangcitest:config linters-settings.gocyclo.min-complexity=20 package testdata import "net/http" diff --git a/test/testdata/godot.go b/test/testdata/godot.go index 819ce941c72f..ece6e3d22368 100644 --- a/test/testdata/godot.go +++ b/test/testdata/godot.go @@ -1,4 +1,4 @@ -//args: -Egodot +//golangcitest:args -Egodot package testdata // Godot checks top-level comments // ERROR "Comment should end in a period" diff --git a/test/testdata/godox.go b/test/testdata/godox.go index 59a751db5914..c86b9c26bff3 100644 --- a/test/testdata/godox.go +++ b/test/testdata/godox.go @@ -1,5 +1,5 @@ -//args: -Egodox -//config: linters-settings.godox.keywords=FIXME,TODO +//golangcitest:args -Egodox +//golangcitest:config linters-settings.godox.keywords=FIXME,TODO package testdata func todoLeftInCode() { diff --git a/test/testdata/goerr113.go b/test/testdata/goerr113.go index 6c76c232ef4a..28c13990696b 100644 --- a/test/testdata/goerr113.go +++ b/test/testdata/goerr113.go @@ -1,4 +1,4 @@ -//args: -Egoerr113 +//golangcitest:args -Egoerr113 package testdata import "os" diff --git a/test/testdata/gofmt.go b/test/testdata/gofmt.go index 61c93d286d03..cf4bef614b07 100644 --- a/test/testdata/gofmt.go +++ b/test/testdata/gofmt.go @@ -1,4 +1,4 @@ -//args: -Egofmt +//golangcitest:args -Egofmt package testdata import "fmt" diff --git a/test/testdata/gofmt_no_simplify.go b/test/testdata/gofmt_no_simplify.go index c5cfd58aef26..98267ad3abce 100644 --- a/test/testdata/gofmt_no_simplify.go +++ b/test/testdata/gofmt_no_simplify.go @@ -1,5 +1,5 @@ -//args: -Egofmt -//config: linters-settings.gofmt.simplify=false +//golangcitest:args -Egofmt +//golangcitest:config linters-settings.gofmt.simplify=false package testdata import "fmt" diff --git a/test/testdata/gofumpt.go b/test/testdata/gofumpt.go index b2a19546e8b0..4570a2bc1dd9 100644 --- a/test/testdata/gofumpt.go +++ b/test/testdata/gofumpt.go @@ -1,4 +1,4 @@ -// args: -Egofumpt +//golangcitest:args -Egofumpt package testdata import "fmt" diff --git a/test/testdata/gofumpt_with_extra.go b/test/testdata/gofumpt_with_extra.go index f2ed40af2676..00c7f21e13d6 100644 --- a/test/testdata/gofumpt_with_extra.go +++ b/test/testdata/gofumpt_with_extra.go @@ -1,5 +1,5 @@ -// args: -Egofumpt -// config: linters-settings.gofumpt.extra-rules=true +//golangcitest:args -Egofumpt +//golangcitest:config linters-settings.gofumpt.extra-rules=true package testdata import "fmt" diff --git a/test/testdata/goimports.go b/test/testdata/goimports.go index 48e0f0b15cb2..39eb0f6cf429 100644 --- a/test/testdata/goimports.go +++ b/test/testdata/goimports.go @@ -1,4 +1,4 @@ -//args: -Egoimports +//golangcitest:args -Egoimports package testdata import ( diff --git a/test/testdata/goimports/goimports.go b/test/testdata/goimports/goimports.go index 64021fa90a71..a614bb5921df 100644 --- a/test/testdata/goimports/goimports.go +++ b/test/testdata/goimports/goimports.go @@ -1,5 +1,5 @@ -//args: -Egoimports -//config: linters-settings.goimports.local-prefixes=github.com/golangci/golangci-lint +//golangcitest:args -Egoimports +//golangcitest:config linters-settings.goimports.local-prefixes=github.com/golangci/golangci-lint package goimports import ( diff --git a/test/testdata/golint.go b/test/testdata/golint.go index c4e1148e2205..2671f2e83b9f 100644 --- a/test/testdata/golint.go +++ b/test/testdata/golint.go @@ -1,4 +1,4 @@ -//args: -Egolint --internal-cmd-test +//golangcitest:args -Egolint --internal-cmd-test package testdata var Go_lint string // ERROR "don't use underscores in Go names; var `Go_lint` should be `GoLint`" diff --git a/test/testdata/gomnd.go b/test/testdata/gomnd.go index 204018b7a093..26e53f2999b8 100644 --- a/test/testdata/gomnd.go +++ b/test/testdata/gomnd.go @@ -1,4 +1,4 @@ -//args: -Egomnd +//golangcitest:args -Egomnd package testdata import ( diff --git a/test/testdata/gomodguard.go b/test/testdata/gomodguard.go index 45a47cd81f5e..5b98163959df 100644 --- a/test/testdata/gomodguard.go +++ b/test/testdata/gomodguard.go @@ -1,5 +1,5 @@ -//args: -Egomodguard -//config_path: testdata/configs/gomodguard.yml +//golangcitest:args -Egomodguard +//golangcitest:config_path testdata/configs/gomodguard.yml package testdata import ( diff --git a/test/testdata/goprintffuncname.go b/test/testdata/goprintffuncname.go index 100977c6eb26..4a80ba06e84e 100644 --- a/test/testdata/goprintffuncname.go +++ b/test/testdata/goprintffuncname.go @@ -1,4 +1,4 @@ -//args: -Egoprintffuncname +//golangcitest:args -Egoprintffuncname package testdata func PrintfLikeFuncWithBadName(format string, args ...interface{}) { // ERROR "printf-like formatting function 'PrintfLikeFuncWithBadName' should be named 'PrintfLikeFuncWithBadNamef'" diff --git a/test/testdata/gosec.go b/test/testdata/gosec.go index a5edb9658a28..f8282cfb629d 100644 --- a/test/testdata/gosec.go +++ b/test/testdata/gosec.go @@ -1,4 +1,4 @@ -//args: -Egosec +//golangcitest:args -Egosec package testdata import ( diff --git a/test/testdata/gosec_rules_config.go b/test/testdata/gosec_rules_config.go index e2b2b4555680..3eea8114eb4a 100644 --- a/test/testdata/gosec_rules_config.go +++ b/test/testdata/gosec_rules_config.go @@ -1,5 +1,5 @@ -//args: -Egosec -//config_path: testdata/configs/gosec.yml +//golangcitest:args -Egosec +//golangcitest:config_path testdata/configs/gosec.yml package testdata import "io/ioutil" diff --git a/test/testdata/gosec_severity_confidence.go b/test/testdata/gosec_severity_confidence.go index 1bf2bd3a69c8..1b72dceafd10 100644 --- a/test/testdata/gosec_severity_confidence.go +++ b/test/testdata/gosec_severity_confidence.go @@ -1,5 +1,5 @@ -//args: -Egosec -//config_path: testdata/configs/gosec_severity_confidence.yml +//golangcitest:args -Egosec +//golangcitest:config_path testdata/configs/gosec_severity_confidence.yml package testdata import ( diff --git a/test/testdata/gosimple.go b/test/testdata/gosimple.go index 258402da51e0..51ebf15dd046 100644 --- a/test/testdata/gosimple.go +++ b/test/testdata/gosimple.go @@ -1,4 +1,4 @@ -//args: -Egosimple +//golangcitest:args -Egosimple package testdata import ( diff --git a/test/testdata/govet.go b/test/testdata/govet.go index b48056fe8730..05f2777a9e39 100644 --- a/test/testdata/govet.go +++ b/test/testdata/govet.go @@ -1,5 +1,5 @@ -//args: -Egovet -//config: linters-settings.govet.check-shadowing=true +//golangcitest:args -Egovet +//golangcitest:config linters-settings.govet.check-shadowing=true package testdata import ( diff --git a/test/testdata/govet_fieldalignment.go b/test/testdata/govet_fieldalignment.go index 618e3f6e1fc7..20e3790da3f3 100644 --- a/test/testdata/govet_fieldalignment.go +++ b/test/testdata/govet_fieldalignment.go @@ -1,5 +1,5 @@ -//args: -Egovet -//config: linters-settings.govet.enable=fieldalignment +//golangcitest:args -Egovet +//golangcitest:config linters-settings.govet.enable=fieldalignment package testdata type gvfaGood struct { diff --git a/test/testdata/govet_ifaceassert.go b/test/testdata/govet_ifaceassert.go index 9a4253aa0465..3e2020ccd3e2 100644 --- a/test/testdata/govet_ifaceassert.go +++ b/test/testdata/govet_ifaceassert.go @@ -1,5 +1,5 @@ -//args: -Egovet -//config: linters-settings.govet.enable=ifaceassert +//golangcitest:args -Egovet +//golangcitest:config linters-settings.govet.enable=ifaceassert package testdata import ( diff --git a/test/testdata/ifshort.go b/test/testdata/ifshort.go index 448636f0cd6f..a960b6de0644 100644 --- a/test/testdata/ifshort.go +++ b/test/testdata/ifshort.go @@ -1,4 +1,4 @@ -//args: -Eifshort +//golangcitest:args -Eifshort package testdata func DontUseShortSyntaxWhenPossible() { diff --git a/test/testdata/importas.go b/test/testdata/importas.go index f363c7e7b345..259d82262d74 100644 --- a/test/testdata/importas.go +++ b/test/testdata/importas.go @@ -1,5 +1,5 @@ -//args: -Eimportas -//config_path: testdata/configs/importas.yml +//golangcitest:args -Eimportas +//golangcitest:config_path testdata/configs/importas.yml package testdata import ( diff --git a/test/testdata/importas_noalias.go b/test/testdata/importas_noalias.go index 64bd349131ea..29554fce5212 100644 --- a/test/testdata/importas_noalias.go +++ b/test/testdata/importas_noalias.go @@ -1,5 +1,5 @@ -//args: -Eimportas -//config_path: testdata/configs/importas_noalias.yml +//golangcitest:args -Eimportas +//golangcitest:config_path testdata/configs/importas_noalias.yml package testdata import ( diff --git a/test/testdata/importas_strict.go b/test/testdata/importas_strict.go index 6f23ac720d7e..ce801870b2e8 100644 --- a/test/testdata/importas_strict.go +++ b/test/testdata/importas_strict.go @@ -1,5 +1,5 @@ -//args: -Eimportas -//config_path: testdata/configs/importas_strict.yml +//golangcitest:args -Eimportas +//golangcitest:config_path testdata/configs/importas_strict.yml package testdata import ( diff --git a/test/testdata/ineffassign.go b/test/testdata/ineffassign.go index 69d3cc81c9c1..96f7c9491d73 100644 --- a/test/testdata/ineffassign.go +++ b/test/testdata/ineffassign.go @@ -1,4 +1,4 @@ -//args: -Eineffassign +//golangcitest:args -Eineffassign package testdata import "math" diff --git a/test/testdata/interfacer.go b/test/testdata/interfacer.go index ef8010aa229f..c53b84a54b44 100644 --- a/test/testdata/interfacer.go +++ b/test/testdata/interfacer.go @@ -1,4 +1,4 @@ -//args: -Einterfacer --internal-cmd-test +//golangcitest:args -Einterfacer --internal-cmd-test package testdata import "io" diff --git a/test/testdata/ireturn_allow.go b/test/testdata/ireturn_allow.go index d6b968a2e244..3667f1c985dd 100644 --- a/test/testdata/ireturn_allow.go +++ b/test/testdata/ireturn_allow.go @@ -1,5 +1,5 @@ -// args: -Eireturn -// config_path: testdata/configs/ireturn.yml +//golangcitest:args -Eireturn +//golangcitest:config_path testdata/configs/ireturn.yml package testdata type ( diff --git a/test/testdata/ireturn_default.go b/test/testdata/ireturn_default.go index 0f9afd48f3a8..0b6fb80dbc40 100644 --- a/test/testdata/ireturn_default.go +++ b/test/testdata/ireturn_default.go @@ -1,4 +1,4 @@ -// args: -Eireturn +//golangcitest:args -Eireturn package testdata type ( diff --git a/test/testdata/ireturn_reject_stdlib.go b/test/testdata/ireturn_reject_stdlib.go index d57d81639904..3bda7febc9e6 100644 --- a/test/testdata/ireturn_reject_stdlib.go +++ b/test/testdata/ireturn_reject_stdlib.go @@ -1,5 +1,5 @@ -// args: -Eireturn -// config_path: testdata/configs/ireturn_stdlib_reject.yml +//golangcitest:args -Eireturn +//golangcitest:config_path testdata/configs/ireturn_stdlib_reject.yml package testdata import ( diff --git a/test/testdata/lll.go b/test/testdata/lll.go index 7c3adaab83c2..e961c7b0f150 100644 --- a/test/testdata/lll.go +++ b/test/testdata/lll.go @@ -1,5 +1,5 @@ -//args: -Elll -//config: linters-settings.lll.tab-width=4 +//golangcitest:args -Elll +//golangcitest:config linters-settings.lll.tab-width=4 package testdata func Lll() { diff --git a/test/testdata/maintidx.go b/test/testdata/maintidx.go index 51f95235040c..68106aa090d9 100644 --- a/test/testdata/maintidx.go +++ b/test/testdata/maintidx.go @@ -1,4 +1,4 @@ -//args: -Emaintidx +//golangcitest:args -Emaintidx package testdata func over20() { diff --git a/test/testdata/maintidx_under_100.go b/test/testdata/maintidx_under_100.go index ce80be08d667..d8fe448663cf 100644 --- a/test/testdata/maintidx_under_100.go +++ b/test/testdata/maintidx_under_100.go @@ -1,5 +1,5 @@ -// args: -Emaintidx -// config_path: testdata/configs/maintidx_under_100.yml +//golangcitest:args -Emaintidx +//golangcitest:config_path testdata/configs/maintidx_under_100.yml package testdata func over20() { // ERROR "Function name: over20, Cyclomatic Complexity: 1, Halstead Volume: 8.00, Maintainability Index: 86" diff --git a/test/testdata/makezero.go b/test/testdata/makezero.go index 40b2ef3cd806..125603595c59 100644 --- a/test/testdata/makezero.go +++ b/test/testdata/makezero.go @@ -1,4 +1,4 @@ -//args: -Emakezero +//golangcitest:args -Emakezero package testdata import "math" diff --git a/test/testdata/makezero_always.go b/test/testdata/makezero_always.go index 633fb65c2416..622c49c5104c 100644 --- a/test/testdata/makezero_always.go +++ b/test/testdata/makezero_always.go @@ -1,5 +1,5 @@ -//args: -Emakezero -//config: linters-settings.makezero.always=true +//golangcitest:args -Emakezero +//golangcitest:config linters-settings.makezero.always=true package testdata import "math" diff --git a/test/testdata/maligned.go b/test/testdata/maligned.go index 7dbc781fb164..74586588744d 100644 --- a/test/testdata/maligned.go +++ b/test/testdata/maligned.go @@ -1,4 +1,4 @@ -//args: -Emaligned --internal-cmd-test +//golangcitest:args -Emaligned --internal-cmd-test package testdata type BadAlignedStruct struct { // ERROR "struct of size 24 bytes could be of size 16 bytes" diff --git a/test/testdata/misspell.go b/test/testdata/misspell.go index 83afb5bb6788..3e9f43d1c97c 100644 --- a/test/testdata/misspell.go +++ b/test/testdata/misspell.go @@ -1,5 +1,5 @@ -//args: -Emisspell -//config_path: testdata/configs/misspell.yml +//golangcitest:args -Emisspell +//golangcitest:config_path testdata/configs/misspell.yml package testdata func Misspell() { diff --git a/test/testdata/nakedret.go b/test/testdata/nakedret.go index 3b78c823e636..eac9ff533a24 100644 --- a/test/testdata/nakedret.go +++ b/test/testdata/nakedret.go @@ -1,4 +1,4 @@ -//args: -Enakedret +//golangcitest:args -Enakedret package testdata func NakedretIssue() (a int, b string) { diff --git a/test/testdata/nestif.go b/test/testdata/nestif.go index 6c111b252aa5..219635545601 100644 --- a/test/testdata/nestif.go +++ b/test/testdata/nestif.go @@ -1,5 +1,5 @@ -//args: -Enestif -//config: linters-settings.nestif.min-complexity=1 +//golangcitest:args -Enestif +//golangcitest:config linters-settings.nestif.min-complexity=1 package testdata func _() { diff --git a/test/testdata/nilerr.go b/test/testdata/nilerr.go index 6475f663faa2..1b71ce19cf4b 100644 --- a/test/testdata/nilerr.go +++ b/test/testdata/nilerr.go @@ -1,4 +1,4 @@ -//args: -Enilerr +//golangcitest:args -Enilerr package testdata import "os" diff --git a/test/testdata/nilnil.go b/test/testdata/nilnil.go index 34c4c8feec82..0a174d5b693e 100644 --- a/test/testdata/nilnil.go +++ b/test/testdata/nilnil.go @@ -1,4 +1,4 @@ -//args: -Enilnil +//golangcitest:args -Enilnil package testdata import ( diff --git a/test/testdata/nlreturn-block-size.go b/test/testdata/nlreturn-block-size.go index 5cf9563446b7..1321ab630af6 100644 --- a/test/testdata/nlreturn-block-size.go +++ b/test/testdata/nlreturn-block-size.go @@ -1,5 +1,5 @@ -// args: -Enlreturn -// config_path: testdata/configs/nlreturn.yml +//golangcitest:args -Enlreturn +//golangcitest:config_path testdata/configs/nlreturn.yml package testdata func foo0(n int) int { diff --git a/test/testdata/nlreturn.go b/test/testdata/nlreturn.go index 4637a65d11ba..884ef7756c42 100644 --- a/test/testdata/nlreturn.go +++ b/test/testdata/nlreturn.go @@ -1,4 +1,4 @@ -//args: -Enlreturn +//golangcitest:args -Enlreturn package testdata func cha() { diff --git a/test/testdata/noctx.go b/test/testdata/noctx.go index d29169ff6a73..70323c4f574c 100644 --- a/test/testdata/noctx.go +++ b/test/testdata/noctx.go @@ -1,4 +1,4 @@ -//args: -Enoctx +//golangcitest:args -Enoctx package testdata import ( diff --git a/test/testdata/nolintlint.go b/test/testdata/nolintlint.go index 94a882f265c2..6d3bf0539e29 100644 --- a/test/testdata/nolintlint.go +++ b/test/testdata/nolintlint.go @@ -1,8 +1,8 @@ -//args: -Enolintlint -Emisspell -//expected_linter: nolintlint -//config: linters-settings.nolintlint.require-explanation=true -//config: linters-settings.nolintlint.require-specific=true -//config: linters-settings.nolintlint.allow-leading-space=false +//golangcitest:args -Enolintlint -Emisspell +//golangcitest:expected_linter nolintlint +//golangcitest:config linters-settings.nolintlint.require-explanation=true +//golangcitest:config linters-settings.nolintlint.require-specific=true +//golangcitest:config linters-settings.nolintlint.allow-leading-space=false package testdata import "fmt" diff --git a/test/testdata/nolintlint_unused.go b/test/testdata/nolintlint_unused.go index df323bb55ed9..a343cc99960c 100644 --- a/test/testdata/nolintlint_unused.go +++ b/test/testdata/nolintlint_unused.go @@ -1,6 +1,6 @@ -//args: -Enolintlint -Evarcheck -//config: linters-settings.nolintlint.allow-unused=false -//expected_linter: nolintlint +//golangcitest:args -Enolintlint -Evarcheck +//golangcitest:config linters-settings.nolintlint.allow-unused=false +//golangcitest:expected_linter nolintlint package testdata import "fmt" diff --git a/test/testdata/nonamedreturns.go b/test/testdata/nonamedreturns.go index c2afbd27ed7d..8de01ae121bd 100644 --- a/test/testdata/nonamedreturns.go +++ b/test/testdata/nonamedreturns.go @@ -1,4 +1,4 @@ -// args: -Enonamedreturns +//golangcitest:args -Enonamedreturns package testdata import "errors" diff --git a/test/testdata/nonamedreturns_custom.go b/test/testdata/nonamedreturns_custom.go index c9289e1e9960..c4bb4f6f87be 100644 --- a/test/testdata/nonamedreturns_custom.go +++ b/test/testdata/nonamedreturns_custom.go @@ -1,5 +1,5 @@ -// args: -Enonamedreturns -// config_path: testdata/configs/nonamedreturns.yml +//golangcitest:args -Enonamedreturns +//golangcitest:config_path testdata/configs/nonamedreturns.yml package testdata import "fmt" diff --git a/test/testdata/nosnakecase.go b/test/testdata/nosnakecase.go index d52c474dd057..05d48a1d9677 100644 --- a/test/testdata/nosnakecase.go +++ b/test/testdata/nosnakecase.go @@ -1,4 +1,4 @@ -//args: -Enosnakecase +//golangcitest:args -Enosnakecase package testdata import ( diff --git a/test/testdata/nosprintfhostport.go b/test/testdata/nosprintfhostport.go index e298e5a637b8..36f23a4a3653 100644 --- a/test/testdata/nosprintfhostport.go +++ b/test/testdata/nosprintfhostport.go @@ -1,4 +1,4 @@ -//args: -Enosprintfhostport +//golangcitest:args -Enosprintfhostport package testdata import ( diff --git a/test/testdata/notcompiles/typecheck.go b/test/testdata/notcompiles/typecheck.go index 46d96c3185f7..ec8a56b53a40 100644 --- a/test/testdata/notcompiles/typecheck.go +++ b/test/testdata/notcompiles/typecheck.go @@ -1,4 +1,4 @@ -//args: -Etypecheck +//golangcitest:args -Etypecheck package testdata fun NotCompiles() { // ERROR "expected declaration, found.* fun" diff --git a/test/testdata/notcompiles/typecheck_many_issues.go b/test/testdata/notcompiles/typecheck_many_issues.go index d2dfc29a77cf..10cf5e03b916 100644 --- a/test/testdata/notcompiles/typecheck_many_issues.go +++ b/test/testdata/notcompiles/typecheck_many_issues.go @@ -1,4 +1,4 @@ -//args: -Etypecheck +//golangcitest:args -Etypecheck package testdata func TypeCheckBadCalls() { diff --git a/test/testdata/paralleltest.go b/test/testdata/paralleltest.go index 3634aac942d6..5f3dac31379d 100644 --- a/test/testdata/paralleltest.go +++ b/test/testdata/paralleltest.go @@ -1,4 +1,4 @@ -//args: -Eparalleltest +//golangcitest:args -Eparalleltest package testdata import ( diff --git a/test/testdata/prealloc.go b/test/testdata/prealloc.go index 17900b773e41..8c55b9cf08f3 100644 --- a/test/testdata/prealloc.go +++ b/test/testdata/prealloc.go @@ -1,4 +1,4 @@ -// args: -Eprealloc +//golangcitest:args -Eprealloc package testdata func Prealloc(source []int) []int { diff --git a/test/testdata/predeclared.go b/test/testdata/predeclared.go index 41bbc10151cd..b68e0893b866 100644 --- a/test/testdata/predeclared.go +++ b/test/testdata/predeclared.go @@ -1,4 +1,4 @@ -//args: -Epredeclared +//golangcitest:args -Epredeclared package testdata func hello() { diff --git a/test/testdata/predeclared_custom.go b/test/testdata/predeclared_custom.go index f5b6c0c89428..656c1f1bb4ec 100644 --- a/test/testdata/predeclared_custom.go +++ b/test/testdata/predeclared_custom.go @@ -1,5 +1,5 @@ -//args: -Epredeclared -//config_path: testdata/configs/predeclared.yml +//golangcitest:args -Epredeclared +//golangcitest:config_path testdata/configs/predeclared.yml package testdata func hello() { diff --git a/test/testdata/promlinter.go b/test/testdata/promlinter.go index 2d2c40583848..269744531715 100644 --- a/test/testdata/promlinter.go +++ b/test/testdata/promlinter.go @@ -1,4 +1,4 @@ -//args: -Epromlinter +//golangcitest:args -Epromlinter package testdata import ( diff --git a/test/testdata/revive.go b/test/testdata/revive.go index 814d7ae9046e..82bc267245ca 100644 --- a/test/testdata/revive.go +++ b/test/testdata/revive.go @@ -1,5 +1,5 @@ -//args: -Erevive -//config_path: testdata/configs/revive.yml +//golangcitest:args -Erevive +//golangcitest:config_path testdata/configs/revive.yml package testdata import ( diff --git a/test/testdata/revive_default.go b/test/testdata/revive_default.go index dff44f881a77..e8986b1b3d74 100644 --- a/test/testdata/revive_default.go +++ b/test/testdata/revive_default.go @@ -1,4 +1,4 @@ -//args: -Erevive +//golangcitest:args -Erevive package testdata import ( diff --git a/test/testdata/rowserrcheck.go b/test/testdata/rowserrcheck.go index 554760a7b9af..95c597afb1e5 100644 --- a/test/testdata/rowserrcheck.go +++ b/test/testdata/rowserrcheck.go @@ -1,4 +1,4 @@ -//args: -Erowserrcheck +//golangcitest:args -Erowserrcheck package testdata import ( diff --git a/test/testdata/scopelint.go b/test/testdata/scopelint.go index 1404841a6bc0..931e31eaa1a4 100644 --- a/test/testdata/scopelint.go +++ b/test/testdata/scopelint.go @@ -1,4 +1,4 @@ -//args: -Escopelint --internal-cmd-test +//golangcitest:args -Escopelint --internal-cmd-test package testdata import "fmt" diff --git a/test/testdata/sqlclosecheck.go b/test/testdata/sqlclosecheck.go index 40d67f66818d..8ad73a93c8fa 100644 --- a/test/testdata/sqlclosecheck.go +++ b/test/testdata/sqlclosecheck.go @@ -1,4 +1,4 @@ -//args: -Esqlclosecheck +//golangcitest:args -Esqlclosecheck package testdata import ( diff --git a/test/testdata/staticcheck.go b/test/testdata/staticcheck.go index d20f26efdb8c..da775618139b 100644 --- a/test/testdata/staticcheck.go +++ b/test/testdata/staticcheck.go @@ -1,4 +1,4 @@ -//args: -Estaticcheck +//golangcitest:args -Estaticcheck package testdata import ( diff --git a/test/testdata/staticcheck_in_megacheck.go b/test/testdata/staticcheck_in_megacheck.go index 8c8cde4255b5..7c98412727b6 100644 --- a/test/testdata/staticcheck_in_megacheck.go +++ b/test/testdata/staticcheck_in_megacheck.go @@ -1,4 +1,4 @@ -//args: -Emegacheck +//golangcitest:args -Emegacheck package testdata import "fmt" diff --git a/test/testdata/structcheck.go b/test/testdata/structcheck.go index 7f6d1b78e0f8..8e403b9e27fa 100644 --- a/test/testdata/structcheck.go +++ b/test/testdata/structcheck.go @@ -1,4 +1,4 @@ -//args: -Estructcheck +//golangcitest:args -Estructcheck package testdata type t struct { diff --git a/test/testdata/stylecheck.go b/test/testdata/stylecheck.go index a0d73053dfd9..9df377ee8fd1 100644 --- a/test/testdata/stylecheck.go +++ b/test/testdata/stylecheck.go @@ -1,4 +1,4 @@ -//args: -Estylecheck +//golangcitest:args -Estylecheck package testdata func Stylecheck(x int) { diff --git a/test/testdata/stylecheck_not_in_megacheck.go b/test/testdata/stylecheck_not_in_megacheck.go index d23fb5f11400..f1379efe07d3 100644 --- a/test/testdata/stylecheck_not_in_megacheck.go +++ b/test/testdata/stylecheck_not_in_megacheck.go @@ -1,4 +1,4 @@ -//args: -Emegacheck +//golangcitest:args -Emegacheck package testdata func StylecheckNotInMegacheck(x int) { diff --git a/test/testdata/tagliatelle.go b/test/testdata/tagliatelle.go index 42823516b1b2..bc3320f1d554 100644 --- a/test/testdata/tagliatelle.go +++ b/test/testdata/tagliatelle.go @@ -1,4 +1,4 @@ -// args: -Etagliatelle +//golangcitest:args -Etagliatelle package testdata import "time" diff --git a/test/testdata/tenv.go b/test/testdata/tenv.go index 45bebd129ba1..3ae19de9243b 100644 --- a/test/testdata/tenv.go +++ b/test/testdata/tenv.go @@ -1,5 +1,5 @@ -// args: -Etenv -// config_path: testdata/configs/tenv_all.yml +//golangcitest:args -Etenv +//golangcitest:config_path testdata/configs/tenv_all.yml package testdata import ( diff --git a/test/testdata/tenv_all.go b/test/testdata/tenv_all.go index 45bebd129ba1..3ae19de9243b 100644 --- a/test/testdata/tenv_all.go +++ b/test/testdata/tenv_all.go @@ -1,5 +1,5 @@ -// args: -Etenv -// config_path: testdata/configs/tenv_all.yml +//golangcitest:args -Etenv +//golangcitest:config_path testdata/configs/tenv_all.yml package testdata import ( diff --git a/test/testdata/tenv_all_test.go b/test/testdata/tenv_all_test.go index c870c29ba0dd..d39c27eb61e9 100644 --- a/test/testdata/tenv_all_test.go +++ b/test/testdata/tenv_all_test.go @@ -1,5 +1,5 @@ -// args: -Etenv -// config_path: testdata/configs/tenv_all.yml +//golangcitest:args -Etenv +//golangcitest:config_path testdata/configs/tenv_all.yml package testdata import ( diff --git a/test/testdata/tenv_go118.go b/test/testdata/tenv_go118.go index b99e15a9b555..0f143f72cfb1 100644 --- a/test/testdata/tenv_go118.go +++ b/test/testdata/tenv_go118.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// args: -Etenv +//golangcitest:args -Etenv package testdata import ( diff --git a/test/testdata/tenv_test.go b/test/testdata/tenv_test.go index 03977d482d8c..0e2a1d048404 100644 --- a/test/testdata/tenv_test.go +++ b/test/testdata/tenv_test.go @@ -1,4 +1,4 @@ -// args: -Etenv +//golangcitest:args -Etenv package testdata import ( diff --git a/test/testdata/testpackage_test.go b/test/testdata/testpackage_test.go index 13deccb00974..c5be3346a21a 100644 --- a/test/testdata/testpackage_test.go +++ b/test/testdata/testpackage_test.go @@ -1,2 +1,2 @@ -//args: -Etestpackage +//golangcitest:args -Etestpackage package testdata // ERROR "package should be `testdata_test` instead of `testdata`" diff --git a/test/testdata/thelper.go b/test/testdata/thelper.go index a9ec1bde6ab5..c5a4760e6728 100644 --- a/test/testdata/thelper.go +++ b/test/testdata/thelper.go @@ -1,4 +1,4 @@ -//args: -Ethelper +//golangcitest:args -Ethelper package testdata import "testing" diff --git a/test/testdata/thelper_go118.go b/test/testdata/thelper_go118.go index 1fa8c268743a..e61c68ee5ad4 100644 --- a/test/testdata/thelper_go118.go +++ b/test/testdata/thelper_go118.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -//args: -Ethelper +//golangcitest:args -Ethelper package testdata import "testing" diff --git a/test/testdata/thelper_with_options.go b/test/testdata/thelper_with_options.go index da835b536164..83c1586eb490 100644 --- a/test/testdata/thelper_with_options.go +++ b/test/testdata/thelper_with_options.go @@ -1,5 +1,5 @@ -// args: -Ethelper -// config_path: testdata/configs/thelper.yml +//golangcitest:args -Ethelper +//golangcitest:config_path testdata/configs/thelper.yml package testdata import "testing" diff --git a/test/testdata/unconvert.go b/test/testdata/unconvert.go index 4e3184154c38..ce72581e2a3c 100644 --- a/test/testdata/unconvert.go +++ b/test/testdata/unconvert.go @@ -1,4 +1,4 @@ -//args: -Eunconvert +//golangcitest:args -Eunconvert package testdata import "log" diff --git a/test/testdata/unparam.go b/test/testdata/unparam.go index 75f5f602fce5..1cba338f82e9 100644 --- a/test/testdata/unparam.go +++ b/test/testdata/unparam.go @@ -1,4 +1,4 @@ -//args: -Eunparam +//golangcitest:args -Eunparam package testdata func unparamUnused(a, b uint) uint { // ERROR "`unparamUnused` - `b` is unused" diff --git a/test/testdata/unused.go b/test/testdata/unused.go index 1fa3c0b80a19..97aa39d59ca6 100644 --- a/test/testdata/unused.go +++ b/test/testdata/unused.go @@ -1,4 +1,4 @@ -//args: -Eunused +//golangcitest:args -Eunused package testdata func fn1() {} // ERROR "func `fn1` is unused" diff --git a/test/testdata/varcheck.go b/test/testdata/varcheck.go index 39b3c5a9b439..654b7bbbce09 100644 --- a/test/testdata/varcheck.go +++ b/test/testdata/varcheck.go @@ -1,4 +1,4 @@ -//args: -Evarcheck +//golangcitest:args -Evarcheck package testdata var v string // ERROR "`v` is unused" diff --git a/test/testdata/varnamelen.go b/test/testdata/varnamelen.go index 3a49c396d798..b1f9053a6850 100644 --- a/test/testdata/varnamelen.go +++ b/test/testdata/varnamelen.go @@ -1,4 +1,4 @@ -//args: -Evarnamelen +//golangcitest:args -Evarnamelen package testdata import "math" diff --git a/test/testdata/wastedassign.go b/test/testdata/wastedassign.go index 09d658f1e564..f781d0fc9e15 100644 --- a/test/testdata/wastedassign.go +++ b/test/testdata/wastedassign.go @@ -1,4 +1,4 @@ -//args: -Ewastedassign +//golangcitest:args -Ewastedassign package testdata import "strings" diff --git a/test/testdata/wrapcheck.go b/test/testdata/wrapcheck.go index 501b0de9d5e9..386fec9f6b40 100644 --- a/test/testdata/wrapcheck.go +++ b/test/testdata/wrapcheck.go @@ -1,4 +1,4 @@ -//args: -Ewrapcheck +//golangcitest:args -Ewrapcheck package testdata import ( diff --git a/test/testdata/wsl.go b/test/testdata/wsl.go index 89fb5f732dd7..03b6988d4d70 100644 --- a/test/testdata/wsl.go +++ b/test/testdata/wsl.go @@ -1,5 +1,5 @@ -//args: -Ewsl -//config: linters-settings.wsl.tests=1 +//golangcitest:args -Ewsl +//golangcitest:config linters-settings.wsl.tests=1 package testdata import ( From 4ff249ade55337dfe05b33d823ec8bb81d028d38 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Fri, 15 Jul 2022 15:21:23 +0200 Subject: [PATCH 2/2] chore:: simple comment review --- pkg/config/linters_settings.go | 12 ++++++------ pkg/golinters/revive.go | 1 + pkg/golinters/scopelint.go | 2 ++ test/errchk.go | 2 ++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 8ff4fbd858ba..e696e54b887b 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -629,12 +629,12 @@ type WSLSettings struct { // CustomLinterSettings encapsulates the meta-data of a private linter. // For example, a private linter may be added to the golangci config file as shown below. // -// linters-settings: -// custom: -// example: -// path: /example.so -// description: The description of the linter -// original-url: github.com/golangci/example-linter +// linters-settings: +// custom: +// example: +// path: /example.so +// description: The description of the linter +// original-url: github.com/golangci/example-linter type CustomLinterSettings struct { // Path to a plugin *.so file that implements the private linter. Path string diff --git a/pkg/golinters/revive.go b/pkg/golinters/revive.go index 30306b8ac197..6384f502c2dc 100644 --- a/pkg/golinters/revive.go +++ b/pkg/golinters/revive.go @@ -34,6 +34,7 @@ type jsonObject struct { } // NewRevive returns a new Revive linter. +// //nolint:dupl func NewRevive(settings *config.ReviveSettings) *goanalysis.Linter { var mu sync.Mutex diff --git a/pkg/golinters/scopelint.go b/pkg/golinters/scopelint.go index 4a2b1bf45ac1..7054ef33a596 100644 --- a/pkg/golinters/scopelint.go +++ b/pkg/golinters/scopelint.go @@ -84,6 +84,7 @@ type Node struct { // Visit method is invoked for each node encountered by Walk. // If the result visitor w is not nil, Walk visits each of the children // of node with the visitor w, followed by a call of w.Visit(nil). +// //nolint:gocyclo,gocritic func (f *Node) Visit(node ast.Node) ast.Visitor { switch typedNode := node.(type) { @@ -173,6 +174,7 @@ func (f *Node) Visit(node ast.Node) ast.Visitor { // The variadic arguments may start with link and category types, // and must end with a format string and any arguments. +// //nolint:interfacer func (f *Node) errorf(n ast.Node, format string, args ...interface{}) { pos := f.fset.Position(n.Pos()) diff --git a/test/errchk.go b/test/errchk.go index 09710a5f8ec3..d94a055b40ec 100644 --- a/test/errchk.go +++ b/test/errchk.go @@ -24,6 +24,7 @@ var errorLineRx = regexp.MustCompile(`^\S+?: (.*)\((\S+?)\)$`) // // Sources files are supplied as fullshort slice. // It consists of pairs: full path to source file and its base name. +// //nolint:gocyclo,funlen func errorCheck(outStr string, wantAuto bool, defaultWantedLinter string, fullshort ...string) (err error) { var errs []error @@ -179,6 +180,7 @@ var ( ) // wantedErrors parses expected errors from comments in a file. +// //nolint:nakedret func wantedErrors(file, short, defaultLinter string) (errs []wantedError) { cache := make(map[string]*regexp.Regexp)