Skip to content

Domain gopkg.in has a different V2 convention

Typically, a v2 go module path looks like github.com/xieyuschen/yaml/v3, however the gopkg.in has its own convention which is gopkg.in/yaml.v3.

Since gopkg.in shares the same version suffix methodology as Go modules, the Go command accepts the .v2 in gopkg.in/yaml.v2 as a valid major version suffix. This is a special case for compatibility with gopkg.in: modules hosted at other domains need a slash suffix like /v2.

So during manipulation the go import path by adding another domain, the addition changes the convention from gopkg.in to the standard practice. As a result, the go command reports an error given the following go.mod file.

go: errors parsing go.mod:
go.mod:10:2: require cd.gas/gopkg.in/yaml.v3: version "v3.0.1" invalid: should be v0 or v1, not v3

module cd.gas/github.com/stretchr/testify

go 1.13

require (

    cd.gas/github.com/davecgh/go-spew v1.1.1
    cd.gas/github.com/pmezard/go-difflib v1.0.0
    cd.gas/github.com/stretchr/objx v0.4.0
    cd.gas/gopkg.in/yaml.v3 v3.0.1
)