Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Go workspaces broken in 1.24rc2 #420

@nstandif

Description

@nstandif

What version of Go are you using (go version)?

$ go version
go version go1.24rc2 darwin/arm64

Does this issue reproduce with the latest release?

I am running the 1.24rc2 toolchain.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN='/Users/nathan/go/bin'
GOCACHE='/Users/nathan/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/nathan/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/rw/w0xs2vj159b0np2r601b709w0000gn/T/go-build503003425=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/nathan/git/tule/connector/go.mod'
GOMODCACHE='/Users/nathan/go/pkg/mod'
GONOPROXY='buf.build/gen/go,github.com/stratus-ai'
GONOSUMDB='buf.build/gen/go,github.com/stratus-ai'
GOOS='darwin'
GOPATH='/Users/nathan/go'
GOPRIVATE='buf.build/gen/go,github.com/stratus-ai'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/nathan/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24rc2.darwin-arm64'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/Users/nathan/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/nathan/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24rc2.darwin-arm64/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.24rc2'
GOWORK='/Users/nathan/git/tule/go.work'
PKG_CONFIG='pkg-config'
GOROOT/bin/go version: go version go1.24rc2 darwin/arm64
GOROOT/bin/go tool compile -V: compile version go1.24rc2
uname -v: Darwin Kernel Version 24.2.0: Fri Dec  6 19:03:40 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6041
ProductName:		macOS
ProductVersion:		15.2
BuildVersion:		24C101
lldb --version: lldb-1600.0.39.109
Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)

What did you do?

Ran go generate in a main module in a workspace containing wire injectors.

//go:build wireinject
// +build wireinject

package main

import (
	"github.com/google/wire"
          ...
)

var SuperSet = wire.NewSet(...)

func initializeSvcCmd() *cmd.SvcCmd {
	panic(wire.Build(SuperSet))
}

What did you expect to see?

No errors.

What did you see instead?

$ go generate
go: -mod may only be set to readonly or vendor when in workspace mode, but it is set to "mod"
	Remove the -mod flag to use the default readonly value, 
	or set GOWORK=off to disable workspace mode.
wire_gen.go:3: running "go": exit status 1

In wire_gen.go, this is produced:

// Code generated by Wire. DO NOT EDIT.

//go:generate go run -mod=mod github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject

For now, the workaround would be to set GOWORK=off env variable when running go generate. However, this may may be overlooked in a CI/CD pipeline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions