-
Notifications
You must be signed in to change notification settings - Fork 10
Release/v1.0.0 #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release/v1.0.0 #49
Conversation
1. #35 2. #43 Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
Signed-off-by: Denis Tingaikin <[email protected]>
a0f3e98
to
9f351aa
Compare
Summons @ldez , @firelizzard18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR prepares the v1.0.0 release by updating copyright years, refactoring the configuration to use a new "Config" type with "vars" instead of "values", and removing legacy code files.
- Renames Configuration to Config and replaces "values" with "vars" within configuration files and related tests.
- Removes legacy source files (reader.go, location.go, issue.go) and updates the main command to use flag-based configuration and parallel processing.
- Upgrades the Go version in go.mod and adds new dependency modules while updating documentation and usage instructions.
Reviewed Changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
testdata/golangci-linter/sample.yml | Updated template and values usage with dot notation. |
testdata/fix/fix.yml | Replaces "values" with "vars" and renames keys for consistency. |
testdata/constvalue/constvalue.yml | Changes from "const" under "values" to using "vars". |
testdata/cgo/* | Minor updates for dot notation in templates. |
reader.go, location.go, issue.go | Legacy files removed. |
option.go | Removed lowercasing of keys in WithValues, preserving case. |
config.go | Renamed type and adjusted error handling in GetTemplate and GetValues. |
cmd/go-header/main.go | Refactored main function and flag handling. |
analyzer_test.go | Test adjustments to match new config format and tempDir usage. |
analyzer.go & analysis.go | Major refactor of analysis and fix generation with parallel processing. |
README.md | Updated installation, usage, and feature table with minor text changes. |
.go-header.yml | Updated configuration to match new vars format and key naming. |
.github/workflows/ci.yml | Adjusted Go version and file path usage in CI. |
Comments suppressed due to low confidence (3)
config.go:77
- Returning an empty string instead of an error when TemplatePath is missing may lead to silent failures. Consider providing a clear error message instead.
if c.TemplatePath == "" {
.go-header.yml:2
- [nitpick] There is a potential inconsistency between the variable naming in configuration and documentation (using an underscore here versus a hyphen elsewhere). Ensure that key names like MOD_YEAR_RANGE are documented and used consistently.
copyright_holder: "{{ .MOD_YEAR_RANGE}} Denis Tingaikin"
option.go:33
- [nitpick] The change from lowercasing configuration keys to preserving their original casing may affect users if configuration files use lower-case keys. Verify that this change is intentional and documented.
a.values[k] = v
Golangci-linter update: golangci/golangci-lint#5791 |
It could be great to not use the default template markers |
FYI: Golangci tests result on the latest commit https://github.com/golangci/golangci-lint/actions/runs/14947962804/job/41993802062 |
Do you mean the backward compatibility with {{ XXX }}? |
No, I mean not to use go template default markers But the breaking change is also a problem. |
I'm just thinking about adding a simple migration mechanism on these changes and rollback changes here in configuration golangci/golangci-lint#5791 Does it sound acceptable to resolve the comment? |
Currently, go-header is integrated with text/template, so template markers are acceptable and go template functions can be used by folks in headers. 😀 Please add more details if I missed something. |
If the configuration of linter uses the default Go template markers, it is a problem if I want to use Go templates on the global configuration. I asked the same thing to golicenser. |
Is marker {{ XXX }} acceptable, or should we do a break change with the previous go-header version and use another marker? |
I would prefer a compatibility layer:
|
Signed-off-by: Denis Tingaikin <[email protected]>
8d9eaca
to
b24f0bb
Compare
@ldez Thanks, done. |
This is not really what I expected: you are still using I was expecting something like that: template.New("header").Delims("[[","]]") Maybe the delimiters can be an option (we will not expose them inside the golangci-lint configuration). |
End, Start token.Pos | ||
} | ||
|
||
func (a *Analyzer) skipCodeGen(file *ast.File) ([]*ast.CommentGroup, []*ast.Comment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ast.IsGenerated(file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the function skipCodeGen is still needed to pass test with cgo from the golangci-linter repo. ast.IsGenerated(file)
applied in another place, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that cgo should not be supported by this linter because the header of a cgo file is special, which will lead to false positives.
Signed-off-by: Denis Tingaikin <[email protected]>
OK, I've used delims in text/template. Also, added tests:
Also, checked that tests still passing on this branch golangci/golangci-lint#5791 Do we need to fix anything else before merging this? |
It depends on what you expect of the PR. |
The current goal is to fix issues from folks and be able to update go-header in golangci-lint. OK, I think it's a good starting point to continue improving the go-header. My next plan is:
@ldez Many thanks for the assistance, and feel free to contribute changes ;) |
Motivation
Fixes next issues:
Improves performance and uses modern go tools.
Now go-header based on analysis.Analyzer, text/template and regexp.