build(deps): bump github.com/denis-tingaikin/go-headerfrom 0.4.3 to 0.5.0 (#4396)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
Ethan Reesor 2024-02-25 10:55:19 -06:00 committed by GitHub
parent 76ce09b56e
commit 17e736fa2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 81 additions and 4 deletions

2
go.mod
View File

@ -32,7 +32,7 @@ require (
github.com/ckaznocha/intrange v0.1.0
github.com/curioswitch/go-reassign v0.2.0
github.com/daixiang0/gci v0.12.3
github.com/denis-tingaikin/go-header v0.4.3
github.com/denis-tingaikin/go-header v0.5.0
github.com/esimonov/ifshort v1.0.4
github.com/fatih/color v1.16.0
github.com/firefart/nonamedreturns v1.0.4

4
go.sum generated
View File

@ -127,8 +127,8 @@ github.com/daixiang0/gci v0.12.3/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiE
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU=
github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c=
github.com/denis-tingaikin/go-header v0.5.0 h1:SRdnP5ZKvcO9KKRP1KJrhFR3RrlGuD+42t4429eC9k8=
github.com/denis-tingaikin/go-header v0.5.0/go.mod h1:mMenU5bWrok6Wl2UsZjy+1okegmwQ3UgWl4V1D8gjlY=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=

View File

@ -97,6 +97,17 @@ func runGoHeader(pass *analysis.Pass, conf *goheader.Configuration) ([]goanalysi
FromLinter: goHeaderName,
}
if fix := i.Fix(); fix != nil {
issue.LineRange = &result.Range{
From: issue.Line(),
To: issue.Line() + len(fix.Actual) - 1,
}
issue.Replacement = &result.Replacement{
NeedOnlyDelete: len(fix.Expected) == 0,
NewLines: fix.Expected,
}
}
issues = append(issues, goanalysis.NewIssue(&issue, pass))
}

View File

@ -486,6 +486,7 @@ func (m *Manager) GetAllSupportedLinterConfigs() []*linter.Config {
linter.NewConfig(golinters.NewGoHeader(goheaderCfg)).
WithSince("v1.28.0").
WithPresets(linter.PresetStyle).
WithAutoFix().
WithURL("https://github.com/denis-tingaikin/go-header"),
linter.NewConfig(golinters.NewGoimports(goimportsCfg)).

View File

@ -0,0 +1,9 @@
linters-settings:
goheader:
values:
const:
AUTHOR: The Awesome Project Authors
template: |-
Copyright 2024 {{ AUTHOR }}
Use of this source code is governed by LICENSE

6
test/testdata/fix/in/go-header_1.go vendored Normal file
View File

@ -0,0 +1,6 @@
// Copyright 1999 The Awesome Project Authors
//golangcitest:args -Egoheader
//golangcitest:expected_exitcode 0
//golangcitest:config_path testdata/configs/go-header-fix.yml
package p

8
test/testdata/fix/in/go-header_2.go vendored Normal file
View File

@ -0,0 +1,8 @@
/* Copyright 1999 The Awesome Project Authors
Use of this source code is governed */
//golangcitest:args -Egoheader
//golangcitest:expected_exitcode 0
//golangcitest:config_path testdata/configs/go-header-fix.yml
package p

10
test/testdata/fix/in/go-header_3.go vendored Normal file
View File

@ -0,0 +1,10 @@
/*
Copyright 1999 The Awesome
Use of this source code is governed by LICENSE
*/
//golangcitest:args -Egoheader
//golangcitest:expected_exitcode 0
//golangcitest:config_path testdata/configs/go-header-fix.yml
package p

8
test/testdata/fix/out/go-header_1.go vendored Normal file
View File

@ -0,0 +1,8 @@
// Copyright 2024 The Awesome Project Authors
//
// Use of this source code is governed by LICENSE
//golangcitest:args -Egoheader
//golangcitest:expected_exitcode 0
//golangcitest:config_path testdata/configs/go-header-fix.yml
package p

8
test/testdata/fix/out/go-header_2.go vendored Normal file
View File

@ -0,0 +1,8 @@
/* Copyright 2024 The Awesome Project Authors
Use of this source code is governed by LICENSE */
//golangcitest:args -Egoheader
//golangcitest:expected_exitcode 0
//golangcitest:config_path testdata/configs/go-header-fix.yml
package p

10
test/testdata/fix/out/go-header_3.go vendored Normal file
View File

@ -0,0 +1,10 @@
/*
Copyright 2024 The Awesome Project Authors
Use of this source code is governed by LICENSE
*/
//golangcitest:args -Egoheader
//golangcitest:expected_exitcode 0
//golangcitest:config_path testdata/configs/go-header-fix.yml
package p

View File

@ -59,7 +59,13 @@ func ParseTestDirectives(tb testing.TB, sourcePath string) *RunContext {
continue
}
if !strings.HasPrefix(line, "//golangcitest:") {
switch {
case strings.HasPrefix(line, "//golangcitest:"):
// Ok
case !strings.Contains(line, "golangcitest"):
// Assume this is a regular comment (required for go-header tests)
continue
default:
require.Failf(tb, "invalid prefix of comment line %s", line)
}