-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.GoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
Go version
go version go1.25.3 linux/amd64
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/ivan/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/ivan/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1424714401=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/ivan/Code/Personal/etcd/etcd/go.mod'
GOMODCACHE='/home/ivan/.local/share/asdf/installs/golang/1.25.0/packages/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/ivan/.local/share/asdf/installs/golang/1.25.0/packages'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/ivan/.local/share/asdf/installs/golang/1.25.3/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/ivan/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN=''
GOTOOLDIR='/home/ivan/.local/share/asdf/installs/golang/1.25.3/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.3'
GOWORK='/home/ivan/Code/etcd/etcd/go.work'
PKG_CONFIG='pkg-config'What did you do?
Run go work edit -json
What did you see happen?
The output contains the JSON output according to the sample output from go help work edit, but it doesn't include the Toolchain property.
$ go work edit -json
{
"Go": "1.25.0",
"Use": [
{
"DiskPath": "."
},
{
"DiskPath": "./api"
},
{
"DiskPath": "./cache"
},
{
"DiskPath": "./client/pkg"
},
{
"DiskPath": "./client/v3"
},
{
"DiskPath": "./etcdctl"
},
{
"DiskPath": "./etcdutl"
},
{
"DiskPath": "./pkg"
},
{
"DiskPath": "./server"
},
{
"DiskPath": "./tests"
},
{
"DiskPath": "./tools/mod"
},
{
"DiskPath": "./tools/rw-heatmaps"
},
{
"DiskPath": "./tools/testgrid-analysis"
}
],
"Replace": null
}
$ head go.work
// This is a generated file. Do not edit directly.
go 1.25.0
toolchain go1.25.3
use (
.
./api
./cache
What did you expect to see?
According to go help work edit, the -json option should output:
The -json flag prints the final go.work file in JSON format instead of
writing it back to go.mod. The JSON output corresponds to these Go types:
type GoWork struct {
Go string
Toolchain string
Godebug []Godebug
Use []Use
Replace []Replace
}
type Godebug struct {
Key string
Value string
}
type Use struct {
DiskPath string
ModulePath string
}
type Replace struct {
Old Module
New Module
}
type Module struct {
Path string
Version string
}
So, I would expect the output to be:
$ go work edit -json
{
"Go": "1.25.0",
"Toolchain": "go1.25.3",
...
Similar to what go mod edit -json generates.
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.GoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.