guilhem/bump

Index out of Range error when repository has a single tag

Closed this issue · 0 comments

Hello, I reinstalled the error through go instead of snap (Docs need updating from go get to go download x@y and encountered the following error

# Only one tag is present
$ git tag
v1.0.0

# Attempt to bump it 
$ bump minor
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/guilhem/bump/pkg/semver.Latest({0x0, 0x0, 0x2?})
	/home/user/go/pkg/mod/github.com/guilhem/bump@v0.2.0/pkg/semver/semver.go:60 +0xc5
github.com/guilhem/bump/cmd.preRun(0xdaa0a0, {0x9ac392?, 0x0?, 0x0?})
	/home/user/go/pkg/mod/github.com/guilhem/bump@v0.2.0/cmd/root.go:116 +0x2ac
github.com/spf13/cobra.(*Command).execute(0xdaa0a0, {0xde14a0, 0x0, 0x0})
	/home/user/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:835 +0x58b
github.com/spf13/cobra.(*Command).ExecuteC(0xdaa5a0)
	/home/user/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
	/home/user/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/home/user/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:895
github.com/guilhem/bump/cmd.Execute()
	/home/user/go/pkg/mod/github.com/guilhem/bump@v0.2.0/cmd/root.go:63 +0x230
main.main()
	/home/user/go/pkg/mod/github.com/guilhem/bump@v0.2.0/main.go:21 +0x17
	
# Add a second tag
$ git tag v2.0.0-rc.1

# View both tags
$ git tag
v1.0.0
v2.0.0-rc.1

# Successful bump
$ bump minor
INFO[0000] tag choosed                                   current tag=v2.0.0-rc.1 tags="[\"v2.0.0-rc.1\"]"
INFO[0000] values                                        Current Tag=v2.0.0-rc.1 New  Tag=v2.1.0 logger="bump minor"