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

Open
haraldrudell opened this issue Apr 11, 2022 · 2 comments
Open

cmd/go: workspace problems #52271

haraldrudell opened this issue Apr 11, 2022 · 2 comments
Labels
NeedsInvestigation

Comments

@haraldrudell
Copy link

@haraldrudell haraldrudell commented Apr 11, 2022

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 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

@dmitshur dmitshur commented Apr 11, 2022

CC @matloob.

@haraldrudell
Copy link
Author

@haraldrudell 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

2 participants