Skip to content

Commit c3e6205

Browse files
committedNov 16, 2021
Move version to main package
1 parent 9410471 commit c3e6205

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed
 

‎.goreleaser.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ builds:
2020
- -a
2121
ldflags:
2222
- -extldflags "-static"
23-
- -X github.com/yannh/kubeconform/pkg/config.version={{.Tag}}
23+
- -X main.version={{.Tag}}
2424

2525
archives:
2626
- format: tar.gz

‎cmd/kubeconform/main.go

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import (
1515
"github.com/yannh/kubeconform/pkg/validator"
1616
)
1717

18+
var version = "development"
19+
1820
func processResults(cancel context.CancelFunc, o output.Output, validationResults <-chan validator.Result, exitOnError bool) <-chan bool {
1921
success := true
2022
result := make(chan bool)
@@ -49,6 +51,7 @@ func realMain() int {
4951
if cfg.Help {
5052
return 0
5153
} else if cfg.Version {
54+
fmt.Println(version)
5255
return 0
5356
} else if out != "" {
5457
fmt.Println(out)

‎pkg/config/config.go

-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
"strings"
99
)
1010

11-
var version = "development"
12-
1311
type Config struct {
1412
Cache string
1513
CPUProfileFile string
@@ -102,9 +100,5 @@ func FromFlags(progName string, args []string) (Config, string, error) {
102100
flags.Usage()
103101
}
104102

105-
if c.Version {
106-
fmt.Println(version)
107-
}
108-
109103
return c, buf.String(), err
110104
}

0 commit comments

Comments
 (0)
Please sign in to comment.