Skip to content

Go modules in subdirectories #502

@BatmanAoD

Description

@BatmanAoD

When using a go module that's defined in a subdirectory of a repository, Go expects the version tag to start with the path of the parent directory of the go.mod file (reference). So for <repo>/foo/bar/go.mod, Go would expect tags of the form foo/bar/v....

When Knope encounters a go.mod file in a subdirectory, it should create a tag in this format (presumably in addition to the standard v...) when tagging a release. It would probably be simplest to check whether the go.mod is in a subdirectory relative to Knope.toml (or pwd if there isn't one), but the "right" approach would be to query git to find the repository root. (The CLI command is git rev-parse --show-toplevel; hopefully git2 provides access to this functionality.) Conversely, when determining the current version of a go.mod file, it should look for tags in this format and use them if present.

(Related to #207)

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions