You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to test go workspaces. I have created a really simple project with the following file tree:
go.mod looks as follows:
module test1.18
go 1.18
require golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
go.work:
go 1.18
use ./local/sync
and main.go
package main
import (
"log"
"golang.org/x/sync/errgroup"
)
func main() {
var eg errgroup.Group
eg.Go(func() error {
log.Println("did a thing")
return nil
})
if err := eg.Wait(); err != nil {
log.Println("err")
}
}
What did you expect to see?
I run go run ./workspace/main.go and it works great. It uses workspace mode and replaces the sync module. However, I am trying to run go run -workfile=off ./workspace/main.go and I get the following error:
flag provided but not defined: -workfile
What did you see instead?
I would expect my program to run without using my go.work file.
I got round this by running the following instead:
GOWORK=off go run ./workspace/main.go
which worked correctly.
The text was updated successfully, but these errors were encountered:
Thanks for the prompt reply. The documentation for workspace: https://go.dev/ref/mod#workspaces references a -workfile flag so it needs to be updated :)
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am trying to test go workspaces. I have created a really simple project with the following file tree:

go.mod looks as follows:
go.work:
and main.go
What did you expect to see?
I run
go run ./workspace/main.go
and it works great. It uses workspace mode and replaces the sync module. However, I am trying to rungo run -workfile=off ./workspace/main.go
and I get the following error:What did you see instead?
I would expect my program to run without using my go.work file.
I got round this by running the following instead:
which worked correctly.
The text was updated successfully, but these errors were encountered: