Bump golangci-lint and fix lint

This commit is contained in:
Tim Hockin 2024-06-08 18:47:07 -07:00
parent 9042405ea0
commit b5b0558d58
3 changed files with 13 additions and 3 deletions

View File

@ -67,7 +67,7 @@ jobs:
uses: golangci/golangci-lint-action@v6 uses: golangci/golangci-lint-action@v6
with: with:
working-directory: git-sync working-directory: git-sync
version: v1.53.3 version: v1.59.0
- name: make lint - name: make lint
working-directory: git-sync working-directory: git-sync

View File

@ -281,6 +281,6 @@ lint-staticcheck:
go run honnef.co/go/tools/cmd/staticcheck@2023.1.3 go run honnef.co/go/tools/cmd/staticcheck@2023.1.3
lint-golangci-lint: lint-golangci-lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3 run go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.0 run
lint: lint-staticcheck lint-golangci-lint lint: lint-staticcheck lint-golangci-lint

12
main.go
View File

@ -142,7 +142,7 @@ func main() {
flVersion := pflag.Bool("version", false, "print the version and exit") flVersion := pflag.Bool("version", false, "print the version and exit")
flHelp := pflag.BoolP("help", "h", false, "print help text and exit") flHelp := pflag.BoolP("help", "h", false, "print help text and exit")
pflag.BoolVarP(flHelp, "__?", "?", false, "print help text and exit") // support -? as an alias to -h pflag.BoolVarP(flHelp, "__?", "?", false, "print help text and exit") // support -? as an alias to -h
pflag.CommandLine.MarkHidden("__?") mustMarkHidden("__?")
flManual := pflag.Bool("man", false, "print the full manual and exit") flManual := pflag.Bool("man", false, "print the full manual and exit")
flVerbose := pflag.IntP("verbose", "v", flVerbose := pflag.IntP("verbose", "v",
@ -923,6 +923,16 @@ func mustMarkDeprecated(name string, usageMessage string) {
} }
} }
// mustMarkHidden is a helper around pflag.CommandLine.MarkHidden.
// It panics if there is an error (as these indicate a coding issue).
// This makes it easier to keep the linters happy.
func mustMarkHidden(name string) {
err := pflag.CommandLine.MarkHidden(name)
if err != nil {
panic(fmt.Sprintf("error marking flag %q as hidden: %v", name, err))
}
}
// makeAbsPath makes an absolute path from a path which might be absolute // makeAbsPath makes an absolute path from a path which might be absolute
// or relative. If the path is already absolute, it will be used. If it is // or relative. If the path is already absolute, it will be used. If it is
// not absolute, it will be joined with the provided root. If the path is // not absolute, it will be joined with the provided root. If the path is