Skip to content

Commit

Permalink
Bump golangci-lint and fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
thockin committed Jun 9, 2024
1 parent ba32cd1 commit 26cca48
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
working-directory: git-sync
version: v1.53.3
version: v1.59.0

- name: make lint
working-directory: git-sync
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,6 @@ lint-staticcheck:
go run honnef.co/go/tools/cmd/staticcheck@2023.1.3

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
12 changes: 11 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func main() {
flVersion := pflag.Bool("version", false, "print the version 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.CommandLine.MarkHidden("__?")
mustMarkHidden("__?")
flManual := pflag.Bool("man", false, "print the full manual and exit")

flVerbose := pflag.IntP("verbose", "v",
Expand Down Expand Up @@ -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
// 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
Expand Down

0 comments on commit 26cca48

Please sign in to comment.