Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: workspace problems #52271

Closed
haraldrudell opened this issue Apr 11, 2022 · 3 comments
Closed

cmd/go: workspace problems #52271

haraldrudell opened this issue Apr 11, 2022 · 3 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@haraldrudell
Copy link

Version: go1.18
Repro in latest release
macOS 12.3.1 M1 Max

In order to reduce imports in a large package, I used a workspace with embedded go.mod. This no work with go workspace sync

github.com/haraldrudell/parl
┠ go.work: use ./mains, use .
┠ go.mod: next to no dependencies
┠ mains
 └ go.mod: requires the internet

Problem 1: “go work sync” for importer no work

go work sync
go: github.com/haraldrudell/parl/mains@v0.4.4: reading github.com/haraldrudell/parl/mains/mains/go.mod at revision mains/v0.4.4: unknown revision mains/v0.4.4
1-21:11:23 foxyboy@c66 import-parl%
Note: import-parl is a project that runs something from every package. It’s got a similar module set-up, too, for its imports

Problem 2: no version tags on pkg.go.dev

Although mains package is in the same repository with the same git tags,
mains doesn’t get a version or version history:

https://pkg.go.dev/github.com/haraldrudell/parl/mains
— Version: v0.0.0-20220411030804-48d01f316f70

https://pkg.go.dev/github.com/haraldrudell/parl
— Version: v0.4.3

Problem 3: go get -u

go get -u doesn’t seem to like life either. You have to specify the specific versions

go get github.com/haraldrudell/parl/mains@v0.4.4

What did you expect to see?

  • I expected go work sync to complete successfully with status code 0
  • I expected the mains sub-package to be of version v0.4.3
  • I expected go get -u to upgrade to latest available version

What did you see instead?

status code 1: error
Version: v0.0.0-20220411030804-48d01f316f70

Note: I am a target of HoffmanMoritzPincus. Anything with my name on it may be quickly hidden, discredited or closed

@dmitshur dmitshur changed the title affected/package: go workspace sync cmd/go: go workspace sync problems Apr 11, 2022
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 11, 2022
@dmitshur dmitshur changed the title cmd/go: go workspace sync problems cmd/go: workspace problems Apr 11, 2022
@dmitshur
Copy link
Contributor

CC @matloob.

@haraldrudell
Copy link
Author

haraldrudell commented Apr 12, 2022

It seems the cause is that the sub-packages do not get version number from the repository git tag.
Instead of using the version of the top package, they have git versions like v0.0.0-20220412173619-21bc3de3d441, the time there being utc

If they are upgraded using:
go get -u github.com/haraldrudell/parl/mains@latest
it works

Version work with additional git tags:
git tag --annotate mains/v0.4.8 --message="mains/v0.4.8"

This can be closed

@dmitshur dmitshur added this to the Backlog milestone May 22, 2022
@dmitshur dmitshur added the GoCommand cmd/go label May 22, 2022
@dmitshur
Copy link
Contributor

Modules inside subdirectories indeed need to be tagged separately, as described at https://go.dev/ref/mod#module-path and https://go.dev/ref/mod#vcs-version. Since I understand there's no more issue here, closing.

@dmitshur dmitshur closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2022
@golang golang locked and limited conversation to collaborators May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants