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 (
1616//nolint:gochecknoglobals // must be global var
1717var Version string
1818
19- //nolint:gochecknoinits // relax
20- func init () {
21- if Version == "" {
22- Version = "unknown-" + strconv .Itoa (int (time .Now ().Unix ()))
23- }
24- }
25-
2619type args struct {
2720 ConfigPath string `arg:"-c,--config"`
2821 Profile string `arg:"-p,--profile" help:"path to coverage profile"`
@@ -33,8 +26,25 @@ type args struct {
3326 ThresholdTotal int `arg:"-t,--threshold-total"`
3427}
3528
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+
3641func (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
3848}
3949
4050func (a * args ) overrideConfig (cfg testcoverage.Config ) testcoverage.Config {
@@ -84,7 +94,7 @@ func main() {
8494}
8595
8696func readConfig () (testcoverage.Config , error ) {
87- cmdArgs := args {}
97+ cmdArgs := newArgs ()
8898 arg .MustParse (& cmdArgs )
8999
90100 cfg := testcoverage.Config {}
You can’t perform that action at this time.
0 commit comments