Skip to content

Go module v2 paths detect project name as version suffix #495

@ayskobtw-lil

Description

@ayskobtw-lil

Bug

detectStack() derives a Go project name with:

modName.split('/').pop()

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions