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: -workfile flag appears to not work with "go test" #48576

Open
mvdan opened this issue Sep 23, 2021 · 5 comments
Open

cmd/go: -workfile flag appears to not work with "go test" #48576

mvdan opened this issue Sep 23, 2021 · 5 comments

Comments

@mvdan
Copy link
Member

@mvdan mvdan commented Sep 23, 2021

go version devel go1.18-051df0d722 Wed Sep 22 03:45:00 2021 +0000 linux/amd64

I am trying to test workspaces once again. I have lots of cloned git repositories, and often I just need to work on 2 or 3 at a time. I don't want to drop a single go.work; I need to switch between multiple workspaces depending on what I'm currently doing.

So I thought I'd drop a file like foo.work and temporarily use it via go test -workfile=../foo.work ./.... However, it appears to have no effect at all.

Worse even, it appears like go test -workfile=doesnotexist ./... also makes no difference at all. It seems like the flag is just never taking effect?

cc @matloob @bcmills @jayconrod

@mvdan
Copy link
Member Author

@mvdan mvdan commented Sep 23, 2021

I'm also surprised and slightly worried that I can't seem to find any test scripts exercising this flag :) Which probably explains why it doesn't work.

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 23, 2021

Change https://golang.org/cl/351750 mentions this issue: cmd/go: fix indentation of -workfile help text

gopherbot pushed a commit that referenced this issue Sep 23, 2021
While reading the help text for #48576,
I noticed that the output was misaligned.

Turns out it's because two lines have space indentation,
while the rest use tab indentation. Fix that.

Change-Id: Ie7c473d892ca13852fa2134f3cdef21e9210e02e
Reviewed-on: https://go-review.googlesource.com/c/go/+/351750
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
@jayconrod jayconrod added this to the Go1.18 milestone Sep 23, 2021
@jayconrod
Copy link
Contributor

@jayconrod jayconrod commented Sep 23, 2021

Reproduced with go test. go list and go build seem to work fine though, which is weird.

go list -workfile=stop.work a
go build -workfile=stop.work a
go test -workfile=stop.work a

-- stop.work --
go 1.18

directory ./a
-- a/a.go --
package a
-- a/a_test.go --
package a
-- a/go.mod --
module a

go 1.18

There are a couple test scripts that use -workfile, work.txt and work_edit.txt. We do need something more robust though.

@mvdan
Copy link
Member Author

@mvdan mvdan commented Sep 23, 2021

You're absolutely right that there are some tests, I apparently can't grep :)

@mvdan mvdan changed the title cmd/go: -workfile flag appears to not work at all cmd/go: -workfile flag appears to not work with "go test" Sep 23, 2021
@mvdan
Copy link
Member Author

@mvdan mvdan commented Oct 20, 2021

@matloob I was wondering if you've had time to look into this bug - due to my workflow with many dozens of git repositories cloned, I am largely unable to properly test and daily drive workspaces :) My current alternative is to keep moving .work files around, but that's proving to be unusable when I'm working on multiple projects concurrently, as I can only have one single go.work file with my directory layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants