@@ -41,8 +41,8 @@ func main() {
4141 tag , err := git .DescribeTag (* tagMode , * pattern )
4242 app .FatalIfError (err , "failed to get current tag for repo" )
4343
44- current , err := semver . NewVersion ( strings . TrimPrefix ( tag , * prefix ) )
45- app .FatalIfError (err , "version %s is not semantic " , tag )
44+ current , err := getCurrentVersion ( tag )
45+ app .FatalIfError (err , "could not get current version from tag: '%s' " , tag )
4646
4747 if ! * metadata {
4848 current = unsetMetadata (current )
@@ -75,6 +75,18 @@ func main() {
7575 fmt .Println (getVersion (tag , * prefix , result .String (), * suffix , * stripPrefix ))
7676}
7777
78+ func getCurrentVersion (tag string ) (* semver.Version , error ) {
79+ var current * semver.Version
80+ var err error
81+ if tag == "" {
82+ current , err = semver .NewVersion (strings .TrimPrefix ("0.0.0" , * prefix ))
83+ } else {
84+ current , err = semver .NewVersion (strings .TrimPrefix (tag , * prefix ))
85+ }
86+ return current , err
87+
88+ }
89+
7890func getVersion (tag , prefix , result , suffix string , stripPrefix bool ) string {
7991 if stripPrefix {
8092 prefix = ""
0 commit comments