Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intial major version bump double incremented #242

Open
wfscheper opened this issue Apr 19, 2024 · 1 comment
Open

Intial major version bump double incremented #242

wfscheper opened this issue Apr 19, 2024 · 1 comment

Comments

@wfscheper
Copy link
Contributor

Describe the bug
I started with a Go module at major version 2, and committed at feat! that included incrementing the module version to v3. Running gotagger, it reported the version as v4.0.0.

To Reproduce
Steps to reproduce the behavior:

git init
go mod init example.com/foo/v2
# create basic main.go
git add .
git commit -m 'chore: initial commit'
git tag -m "Release test" v2.0.0
# change module name to v3
git commit -a -m 'feat!: bump major version to v3'

Running gotagger now will report v4.0.0 as the version:

gotagger -debug
Apr 19 09:54:29.035000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:77 > updating logger v=1
Apr 19 09:54:29.035000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/cmd/gotagger/main.go:191 > reading config file logger=main path=gotagger.json v=1
Apr 19 09:54:29.035000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/cmd/gotagger/main.go:240 > calculating version logger=main start="2024-04-19 09:54:29.035700061 -0400 EDT m=+0.008781649" v=1
Apr 19 09:54:29.035000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:184 > finding modules logger=gotagger v=1
Apr 19 09:54:29.035000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:216 > not recursing into directory: ignored by default logger=gotagger path=/tmp/tmp.LqRdtnfYDH/tmp.FCIYvB0SLG/.git v=1
Apr 19 09:54:29.035000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:230 > found go module logger=gotagger path=/tmp/tmp.LqRdtnfYDH/tmp.FCIYvB0SLG/go.mod v=1
Apr 19 09:54:29.035000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:279 > adding moddule logger=gotagger module=example.com/foo/v3 modulePath=. modulePrefix= path=/tmp/tmp.LqRdtnfYDH/tmp.FCIYvB0SLG/go.mod v=1
Apr 19 09:54:29.038000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:480 > enforcing module versioning logger=gotagger v=1
Apr 19 09:54:29.038000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:492 > versioning modules logger=gotagger v=1
Apr 19 09:54:29.039000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:517 > found tags logger=gotagger module=example.com/foo/v3 tags=["v2.0.0"] v=1
Apr 19 09:54:29.039000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:357 > finding latest tag for module logger=gotagger module=example.com/foo/v3 module_path=. module_prefix= v=1
Apr 19 09:54:29.039000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:374 > ignoring modules greater than v4.0.0 logger=gotagger module=example.com/foo/v3 module_path=. module_prefix= v=1
Apr 19 09:54:29.041000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:677 > group commits by module logger=gotagger v=1
Apr 19 09:54:29.041000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:688 > module affected by commit commit=2ca4ee2e1d08c3982ee6fb27ad982fefc2f20d86 logger=gotagger module=example.com/foo/v3 path=go.mod v=1
Apr 19 09:54:29.041000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:688 > module affected by commit commit=4a5636e293a90fec8e508f8e081cf98e59fcfc27 logger=gotagger module=example.com/foo/v3 path=go.mod v=1
Apr 19 09:54:29.041000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:688 > module affected by commit commit=4a5636e293a90fec8e508f8e081cf98e59fcfc27 logger=gotagger module=example.com/foo/v3 path=main.go v=1
Apr 19 09:54:29.041000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:410 > determining version increment from commits logger=gotagger v=1
Apr 19 09:54:29.041000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:417 > breaking change found commit=2ca4ee2e1d08c3982ee6fb27ad982fefc2f20d86 logger=gotagger v=1
Apr 19 09:54:29.041000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/gotagger.go:302 > incrementing major version logger=gotagger v=1
Apr 19 09:54:29.041000 DBG /go/pkg/mod/github.com/sassoftware/[email protected]/cmd/gotagger/main.go:243 > done calculating version duration=5.815803ms logger=main v=1
v4.0.0

Expected behavior
Version to be v3.0.0.

Desktop (please complete the following information):

  • OS: Linux, MacOS
  • Version: v0.9.1

Additional context
This does not occur with gotagger v0.9.0.

@wfscheper
Copy link
Contributor Author

Two things to note:

  • All commits are being scanned, because gotagger isn't restricting them to commits since the last tag.
  • This was introduced by fix: return minimum version from module #212, so that now the module version is getting incremented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant