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: "go work sync" simply panics #49591

Closed
mvdan opened this issue Nov 15, 2021 · 2 comments
Closed

cmd/go: "go work sync" simply panics #49591

mvdan opened this issue Nov 15, 2021 · 2 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@mvdan
Copy link
Member

mvdan commented Nov 15, 2021

I come with more workspaces bugs :) Using https://github.com/mvdan/sh as a sample module:

$ git rev-parse HEAD
946fb5b53d67e4a36af33c0ef2d870ed5543ee7d
$ go version
go version devel go1.18-c2397905e0 Sat Nov 13 03:33:55 2021 +0000 linux/amd64
$ go work init
$ go work sync
panic: in workspace mode, but pruning is not workspace in newRequirements

goroutine 1 [running]:
cmd/go/internal/modload.newRequirements(0x0, {0x0?, 0x0, 0x5?}, 0x0)
	/home/mvdan/tip/src/cmd/go/internal/modload/buildlist.go:118 +0x718
cmd/go/internal/modload.LoadModFile({0xad5000, 0xc000024160})
	/home/mvdan/tip/src/cmd/go/internal/modload/init.go:695 +0x599
cmd/go/internal/modload.LoadModGraph({0xad5000, 0xc000024160}, {0x0, 0x0})
	/home/mvdan/tip/src/cmd/go/internal/modload/buildlist.go:473 +0x3d
cmd/go/internal/workcmd.runSync({0xad5000, 0xc000024160}, 0xc0002a23f0?, {0x14?, 0x4?, 0x2?})
	/home/mvdan/tip/src/cmd/go/internal/workcmd/sync.go:39 +0x5e
main.invoke(0xdab5e0, {0xc0000201a0, 0x1, 0x1})
	/home/mvdan/tip/src/cmd/go/main.go:218 +0x2ee
main.main()
	/home/mvdan/tip/src/cmd/go/main.go:175 +0x78e

Even if I'm holding go work sync wrong, surely it's not expected that it would panic. cc @matloob @bcmills

@bcmills bcmills added this to the Go1.18 milestone Nov 15, 2021
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 15, 2021
@n4j
Copy link

n4j commented Nov 16, 2021

I am able to reproduce this

➜  sh git:(master) ✗ uname -a
Linux turing 5.11.0-40-generic #44~20.04.2-Ubuntu SMP Tue Oct 26 18:07:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

➜  sh git:(master) git rev-parse HEAD
423f205ca37b9933907c589bd90f0f095ccf84ec
➜  sh git:(master) go version
go version devel go1.18-9e13a8876f Mon Nov 15 23:55:09 2021 +0000 linux/amd64
➜  sh git:(master) go work init 
➜  sh git:(master) ✗ go work sync 
panic: in workspace mode, but pruning is not workspace in newRequirements

goroutine 1 [running]:
cmd/go/internal/modload.newRequirements(0x0, {0x0?, 0x0, 0x5?}, 0x0)
	/mnt/giga-chad/github/go/src/cmd/go/internal/modload/buildlist.go:118 +0x718
cmd/go/internal/modload.LoadModFile({0xad6060, 0xc00002c0b8})
	/mnt/giga-chad/github/go/src/cmd/go/internal/modload/init.go:695 +0x599
cmd/go/internal/modload.LoadModGraph({0xad6060, 0xc00002c0b8}, {0x0, 0x0})
	/mnt/giga-chad/github/go/src/cmd/go/internal/modload/buildlist.go:473 +0x3d
cmd/go/internal/workcmd.runSync({0xad6060, 0xc00002c0b8}, 0xc00002a498?, {0x14?, 0x4?, 0x2?})
	/mnt/giga-chad/github/go/src/cmd/go/internal/workcmd/sync.go:39 +0x5e
main.invoke(0xdae5e0, {0xc000020110, 0x1, 0x1})
	/mnt/giga-chad/github/go/src/cmd/go/main.go:218 +0x2ee
main.main()
	/mnt/giga-chad/github/go/src/cmd/go/main.go:175 +0x78e

@gopherbot
Copy link

Change https://golang.org/cl/365234 mentions this issue: cmd/go: fix go work sync when there are zero workspace modules

@golang golang locked and limited conversation to collaborators Nov 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants