Looking for Go module path (contains version) suggestion for github.com/spdx/spdx-go-model

113 views
Skip to first unread message

Meng Zhuo

unread,
Jan 23, 2025, 10:17:04 PM1/23/25
to golang-nuts
Hi, 

What should we do if module named with version?
```
import (
    "testing"

    Spdx3_0_1 "github.com/spdx/spdx-go-model/v3_0_1"
```


Dan Kortschak

unread,
Jan 23, 2025, 10:54:00 PM1/23/25
to golan...@googlegroups.com
From the code that's in that change, the import path is
github.com/spdx/spdx-go-model/spdx_v3_0_1, not github.com/spdx/spdx-go-
model/v3_0_1.

will....@gmail.com

unread,
Jan 24, 2025, 4:40:30 PM1/24/25
to golang-nuts
Meng,

It's unclear to me what you're asking. Are you asking whether the path should be changed to be more idiomatic? I would have expected it to be github.com/spdx/spdx-go-model if the major version is 0 or 1; and github.com/spdx/spdx-go-model/v3 if the major version is 3.

Will

Meng Zhuo

unread,
Jan 24, 2025, 9:29:21 PM1/24/25
to golang-nuts
The spdx has it's own version for SPDX spec (i.e. v3_0_1)

but go module's version might conflict this.
If an user import spdx v2.3(with go mod version 1.0.0), he will end up import  `github.com/spdx/spdx-go-model/v2_...@v1.0.0 `

That's very confusing to me.

Dan Kortschak

unread,
Jan 24, 2025, 11:36:35 PM1/24/25
to golan...@googlegroups.com
On Fri, 2025-01-24 at 18:29 -0800, Meng Zhuo wrote:
> The spdx has it's own version for SPDX spec (i.e. v3_0_1)
> https://spdx.github.io/spdx-spec/v2.3/
>
> but go module's version might conflict this.
> If an user import spdx v2.3(with go mod version 1.0.0), he will end
> up import  `github.com/spdx/spdx-go-model/v2_...@v1.0.0 `
>
> That's very confusing to me.

As noted above, the version does not have a v prefix, it has the prefix
"spdx_v". This is also noted in this comment
https://github.com/spdx/spdx-go-model/pull/1#discussion_r1913449817.

So the import would be github.com/spdx/spdx-go-model/spdx_...@v1.0.0

Reply all
Reply to author
Forward
0 new messages