Skip to content
This repository was archived by the owner on Feb 5, 2026. It is now read-only.

Commit 7a5b0ae

Browse files
authored
fix: revision injection was broken due to entrypoint change (#72)
* fix: revision injection was broken due to entrypoint change * ci: use nolint comment * ci: use nolint comment for clarify
1 parent f9cf874 commit 7a5b0ae

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

.golangci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -512,12 +512,6 @@ linters:
512512
- gosec
513513
- noctx
514514
- wrapcheck
515-
- text: 'reassigning variable VersionPrinter'
516-
linters:
517-
- reassign
518-
- text: 'revision is a global variable'
519-
linters:
520-
- gochecknoglobals
521515
- text: 'BinaryPath is a global variable'
522516
linters:
523517
- gochecknoglobals

.goreleaser.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ builds:
3030
- darwin
3131
ldflags:
3232
- -s -w
33-
- -X main.version={{.Version}}
3433
- -X main.revision={{.ShortCommit}}
3534

3635
archives:

cmd/ajisai/root.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ import (
1414
"github.com/sushichan044/ajisai/version"
1515
)
1616

17-
var (
18-
// noglobals error is suppressed by golangci-lint.
19-
revision = "dev"
20-
)
21-
22-
func Run(args []string) error {
23-
// reassign error is suppressed by golangci-lint.
17+
func Run(args []string, revision string) error {
18+
//nolint:reassign // This is expected usecase by urfave/cli.
2419
cli.VersionPrinter = func(cmd *cli.Command) {
2520
root := cmd.Root()
2621
fmt.Fprintf(root.Writer, "%s version %s (revision:%s)\n", root.Name, root.Version, revision)

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ import (
77
"github.com/sushichan044/ajisai/cmd/ajisai"
88
)
99

10+
var (
11+
//nolint:gochecknoglobals // This value is overridden by goreleaser.
12+
revision = "dev"
13+
)
14+
1015
func main() {
11-
if err := ajisai.Run(os.Args); err != nil {
16+
if err := ajisai.Run(os.Args, revision); err != nil {
1217
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
1318
os.Exit(1)
1419
}

0 commit comments

Comments
 (0)