Bug
detectStack() derives a Go project name with:
For versioned Go modules such as github.com/user/my-go-app/v2, this returns v2 instead of the repository/project segment my-go-app.
That project name is later used by cloneAndDetect()/build --from fallback naming, so versioned Go modules can get confusing generated names and build output labels.
Repro
Create a go.mod containing:
module github.com/user/my-go-app/v2
go 1.21
Run stack detection through sh1pt build --from <repo> or the CLI test helper. The detected project name is v2.
Expected
Version suffixes like /v2 should be recognized as Go module major-version suffixes, and the project name should be my-go-app.
Proposed fix
Add a small Go module name helper that ignores a trailing /vN segment when there is a previous module path segment, with focused regression coverage.
Bug
detectStack()derives a Go project name with:For versioned Go modules such as
github.com/user/my-go-app/v2, this returnsv2instead of the repository/project segmentmy-go-app.That project name is later used by
cloneAndDetect()/build --fromfallback naming, so versioned Go modules can get confusing generated names and build output labels.Repro
Create a
go.modcontaining:Run stack detection through
sh1pt build --from <repo>or the CLI test helper. The detected project name isv2.Expected
Version suffixes like
/v2should be recognized as Go module major-version suffixes, and the project name should bemy-go-app.Proposed fix
Add a small Go module name helper that ignores a trailing
/vNsegment when there is a previous module path segment, with focused regression coverage.