Skip to content

Commit 17e736f

Browse files
firelizzard18ldez
andauthored
build(deps): bump github.com/denis-tingaikin/go-headerfrom 0.4.3 to 0.5.0 (#4396)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 76ce09b commit 17e736f

File tree

12 files changed

+81
-4
lines changed

12 files changed

+81
-4
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require (
3232
github.com/ckaznocha/intrange v0.1.0
3333
github.com/curioswitch/go-reassign v0.2.0
3434
github.com/daixiang0/gci v0.12.3
35-
github.com/denis-tingaikin/go-header v0.4.3
35+
github.com/denis-tingaikin/go-header v0.5.0
3636
github.com/esimonov/ifshort v1.0.4
3737
github.com/fatih/color v1.16.0
3838
github.com/firefart/nonamedreturns v1.0.4

go.sum

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/golinters/goheader.go

+11
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ func runGoHeader(pass *analysis.Pass, conf *goheader.Configuration) ([]goanalysi
9797
FromLinter: goHeaderName,
9898
}
9999

100+
if fix := i.Fix(); fix != nil {
101+
issue.LineRange = &result.Range{
102+
From: issue.Line(),
103+
To: issue.Line() + len(fix.Actual) - 1,
104+
}
105+
issue.Replacement = &result.Replacement{
106+
NeedOnlyDelete: len(fix.Expected) == 0,
107+
NewLines: fix.Expected,
108+
}
109+
}
110+
100111
issues = append(issues, goanalysis.NewIssue(&issue, pass))
101112
}
102113

pkg/lint/lintersdb/manager.go

+1
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ func (m *Manager) GetAllSupportedLinterConfigs() []*linter.Config {
486486
linter.NewConfig(golinters.NewGoHeader(goheaderCfg)).
487487
WithSince("v1.28.0").
488488
WithPresets(linter.PresetStyle).
489+
WithAutoFix().
489490
WithURL("https://github.com/denis-tingaikin/go-header"),
490491

491492
linter.NewConfig(golinters.NewGoimports(goimportsCfg)).
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
linters-settings:
2+
goheader:
3+
values:
4+
const:
5+
AUTHOR: The Awesome Project Authors
6+
template: |-
7+
Copyright 2024 {{ AUTHOR }}
8+
9+
Use of this source code is governed by LICENSE

test/testdata/fix/in/go-header_1.go

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Copyright 1999 The Awesome Project Authors
2+
3+
//golangcitest:args -Egoheader
4+
//golangcitest:expected_exitcode 0
5+
//golangcitest:config_path testdata/configs/go-header-fix.yml
6+
package p

test/testdata/fix/in/go-header_2.go

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* Copyright 1999 The Awesome Project Authors
2+
3+
Use of this source code is governed */
4+
5+
//golangcitest:args -Egoheader
6+
//golangcitest:expected_exitcode 0
7+
//golangcitest:config_path testdata/configs/go-header-fix.yml
8+
package p

test/testdata/fix/in/go-header_3.go

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
Copyright 1999 The Awesome
3+
4+
Use of this source code is governed by LICENSE
5+
*/
6+
7+
//golangcitest:args -Egoheader
8+
//golangcitest:expected_exitcode 0
9+
//golangcitest:config_path testdata/configs/go-header-fix.yml
10+
package p

test/testdata/fix/out/go-header_1.go

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright 2024 The Awesome Project Authors
2+
//
3+
// Use of this source code is governed by LICENSE
4+
5+
//golangcitest:args -Egoheader
6+
//golangcitest:expected_exitcode 0
7+
//golangcitest:config_path testdata/configs/go-header-fix.yml
8+
package p

test/testdata/fix/out/go-header_2.go

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* Copyright 2024 The Awesome Project Authors
2+
3+
Use of this source code is governed by LICENSE */
4+
5+
//golangcitest:args -Egoheader
6+
//golangcitest:expected_exitcode 0
7+
//golangcitest:config_path testdata/configs/go-header-fix.yml
8+
package p

test/testdata/fix/out/go-header_3.go

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
Copyright 2024 The Awesome Project Authors
3+
4+
Use of this source code is governed by LICENSE
5+
*/
6+
7+
//golangcitest:args -Egoheader
8+
//golangcitest:expected_exitcode 0
9+
//golangcitest:config_path testdata/configs/go-header-fix.yml
10+
package p

test/testshared/directives.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ func ParseTestDirectives(tb testing.TB, sourcePath string) *RunContext {
5959
continue
6060
}
6161

62-
if !strings.HasPrefix(line, "//golangcitest:") {
62+
switch {
63+
case strings.HasPrefix(line, "//golangcitest:"):
64+
// Ok
65+
case !strings.Contains(line, "golangcitest"):
66+
// Assume this is a regular comment (required for go-header tests)
67+
continue
68+
default:
6369
require.Failf(tb, "invalid prefix of comment line %s", line)
6470
}
6571

0 commit comments

Comments
 (0)