-2

I'm having problems with versioning my modules

I have a project with module github.ext.myorg.com/aws-golang.

The new version of the my module is v4. However the running go mod tidy will always add the aws-golang v1.0.1 inside the go.mod

module github.ext.myorg.com/Public-Cloud-Core-Services/aws-golang/v4

go 1.24.8

require (
    github.ext.myorg.com/Public-Cloud-Core-Services/aws-golang v1.0.1
    github.com/aws/aws-sdk-go-v2 v1.39.5

I was more confused when I was advised by ChatGPT to create a v4 folder and move the source tree under it, which I did, and I fixed all my imports so my import would look like:

import "github.ext.myorg.com/Public-Cloud-Core-Services/aws-golang/v4/my_package"

This didn't solve the problem of go mod tidy adding the the import of v1.0.1.

I'm even more stumped when I saw the following import on my go.mod:

require (
  ....
  ....
 github.com/jackc/pgx/v5 v5.7.6
)

What stumped me was going to https://github.com/jackc/pgx/, one doesn't find "v2", "v3", "v4", "v5" even though the first line of go.mod in https://github.com/jackc/pgx/blob/master/go.mod is

module github.com/jackc/pgx/v5

In short I want to have "v4" of my module without having to import "v1.0.1" of my module, and without having to create a "v4" folder

1
  • 2
    There's lots of documentation on this, including the spec: go.dev/ref/mod#major-version-suffixes. Note that the module import path and the repository directory structure are two different things. Commented Nov 13 at 10:16

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.