File tree Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,6 @@ import (
16
16
//nolint:gochecknoglobals // must be global var
17
17
var Version string
18
18
19
- //nolint:gochecknoinits // relax
20
- func init () {
21
- if Version == "" {
22
- Version = "unknown-" + strconv .Itoa (int (time .Now ().Unix ()))
23
- }
24
- }
25
-
26
19
type args struct {
27
20
ConfigPath string `arg:"-c,--config"`
28
21
Profile string `arg:"-p,--profile" help:"path to coverage profile"`
@@ -33,8 +26,25 @@ type args struct {
33
26
ThresholdTotal int `arg:"-t,--threshold-total"`
34
27
}
35
28
29
+ func newArgs () args {
30
+ return args {
31
+ ConfigPath : `''` ,
32
+ Profile : `''` ,
33
+ LocalPrefix : `''` ,
34
+ GithubActionOutput : false ,
35
+ ThresholdFile : - 1 ,
36
+ ThresholdPackage : - 1 ,
37
+ ThresholdTotal : - 1 ,
38
+ }
39
+ }
40
+
36
41
func (args ) Version () string {
37
- return "go-test-coverage " + Version
42
+ version := Version
43
+ if version == "" {
44
+ version = "unknown-" + strconv .Itoa (int (time .Now ().Unix ()))
45
+ }
46
+
47
+ return "go-test-coverage " + version
38
48
}
39
49
40
50
func (a * args ) overrideConfig (cfg testcoverage.Config ) testcoverage.Config {
@@ -84,7 +94,7 @@ func main() {
84
94
}
85
95
86
96
func readConfig () (testcoverage.Config , error ) {
87
- cmdArgs := args {}
97
+ cmdArgs := newArgs ()
88
98
arg .MustParse (& cmdArgs )
89
99
90
100
cfg := testcoverage.Config {}
You can’t perform that action at this time.
0 commit comments