strings.IndexByte was introduced in go1.2 and it can be used
effectively wherever the second argument to strings.Index is
exactly one byte long.
This avoids generating unnecessary string symbols and saves
a few calls to strings.Index.
Change-Id: I1ab5edb7c4ee9058084cfa57cbcc267c2597e793
Reviewed-on: https://go-review.googlesource.com/65930
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This belongs to a series of clean-up changes (see below) for cmd/dist.
This is change (9).
These changes include:
(1) apply minor fixes
(2) restore behavior of branchtag
(3) unleash bootstrap optimization for windows
(4) use standard generated code header
(5) remove trivial variables + functions
(6) move functions for the better
(7) simplify code segments
(8) use bytes.Buffer for code generation
(9) rename variables + functions
Change-Id: I9247433d7d07a2c99d15b0a4d23164bcbc042768
Reviewed-on: https://go-review.googlesource.com/61015
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
In general, there are no guarantee that `go` command exist on $PATH.
This CL tries to get `go` command from $GOROOT/bin instead.
There are three kinds of code we should handle:
For normal code, the CL implements goCmd() or goCmdName().
For unit tests, the CL uses testenv.GoTool() or testenv.GoToolPath().
For integration tests, the CL sets PATH=$GOROOT/bin:$PATH in cmd/dist.
Note that make.bash sets PATH=$GOROOT/bin:$PATH in the build process.
So this change is only useful when we use toolchain manually.
Updates #21875
Change-Id: I963b9f22ea732dd735363ececde4cf94a5db5ca2
Reviewed-on: https://go-review.googlesource.com/64650
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This belongs to a series of clean-up changes (see below) for cmd/dist.
This is change (8).
These changes include:
(1) apply minor fixes
(2) restore behavior of branchtag
(3) unleash bootstrap optimization for windows
(4) use standard generated code header
(5) remove trivial variables + functions
(6) move functions for the better
(7) simplify code segments
(8) use bytes.Buffer for code generation
(9) rename variables + functions
(10) remove doc.go
Change-Id: I2d5a071eb8e14690325612271432fdc5f43b108b
Reviewed-on: https://go-review.googlesource.com/61014
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This belongs to a series of clean-up changes (see below) for cmd/dist.
This is change (7).
These changes include:
(1) apply minor fixes
(2) restore behavior of branchtag
(3) unleash bootstrap optimization for windows
(4) use standard generated code header
(5) remove trivial variables + functions
(6) move functions for the better
(7) simplify code segments
(8) use bytes.Buffer for code generation
(9) rename variables + functions
(10) remove doc.go
Change-Id: Ia3c33ef060b4baaef354b729ba82ed0b28e52857
Reviewed-on: https://go-review.googlesource.com/61013
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change-Id: Ief6bad2d15461d455e7230eadd9b42b27d04ec8b
Reviewed-on: https://go-review.googlesource.com/64630
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This makes the test easier to run in isolation and easier to change,
and simplifies the code to run the tests in parallel.
updates #13467
Change-Id: I5622b5cc98276970347da18e95d071dbca3c5cc1
Reviewed-on: https://go-review.googlesource.com/63276
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Previously, test7978 failed if the user did not invoke it with
GOTRACEBACK=2 already set in their environment. Environment-sensitive
test are awkward, and in this case there is a very simple workaround:
set the traceback level to the necessary value explicitly.
Change-Id: I7d576f24138aa8a41392148eae11bbeaef558573
Reviewed-on: https://go-review.googlesource.com/63275
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This enables support for the buildmode plugin on
ppc64le.
Fixes#20756
Change-Id: I83241ff63f9b5c366fe0496cf46a3f67d75d08ac
Reviewed-on: https://go-review.googlesource.com/55850
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
The noopt builder sets GO_GCFLAGS when building the standard library.
Set it when building plugins to ensure the -shared packages built for it
have the same inlining in the export data (and thus the same package
version).
Tested locally with GO_GCFLAGS="-N -l" ./all.bash
Fixes#17937
Change-Id: Id037cfbf4af744c05c47bdc58eea60a5dba69533
Reviewed-on: https://go-review.googlesource.com/62511
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
1. remove broken verification
The runtime check assumes that no-pcln symbol entry have zero value,
but the linker emit no entries if the symbol is no-pcln.
As a result, if there are no-pcln symbols at the very end of pcln
table, it will panic.
2. correct condition of export
Handle special chracters in pluginpath correcty.
Export "go.itab.*", so different plugins can share the same itab.
Fixes#18190
Change-Id: Ia4f9c51d83ce8488a9470520f1ee9432802cfc1d
Reviewed-on: https://go-review.googlesource.com/61091
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
As of CL 42533, cmd/go will recompute its GOROOT based on the
location of its own executable. This CL plumbs that computed GOROOT
into every binary it builds using the linker -X flag. This
means binaries built with a moved cmd/go will report the GOROOT
they were built in from runtime.GOROOT().
Fixes#21313
Change-Id: I6c2c559f40f2a0c867ab60cf47c6dbc73ae5e28a
Reviewed-on: https://go-review.googlesource.com/61310
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This belongs to a series of clean-up changes (see below) for cmd/dist.
This is change (6).
These changes include:
(1) apply minor fixes
(2) restore behavior of branchtag
(3) unleash bootstrap optimization for windows
(4) use standard generated code header
(5) remove trivial variables + functions
(6) move functions for the better
(7) simplify code segments
(8) use bytes.Buffer for code generation
(9) rename variables + functions
(10) remove doc.go
Change-Id: I1c49e3427079194210a6416057100a7e94a37619
Reviewed-on: https://go-review.googlesource.com/61012
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This belongs to a series of clean-up changes (see below) for cmd/dist.
This is change (5).
These changes include:
(1) apply minor fixes
(2) restore behavior of branchtag
(3) unleash bootstrap optimization for windows
(4) use standard generated code header
(5) remove trivial variables + functions
(6) move functions for the better
(7) simplify code segments
(8) use bytes.Buffer for code generation
(9) rename variables + functions
(10) remove doc.go
Change-Id: I0efd1271b6a70bb9248d82f8a4d869556f4a557e
Reviewed-on: https://go-review.googlesource.com/61011
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This belongs to a series of clean-up changes (see below) for cmd/dist.
This is change (4).
These changes include:
(1) apply minor fixes
(2) restore behavior of branchtag
(3) unleash bootstrap optimization for windows
(4) use standard generated code header
(5) remove trivial variables + functions
(6) move functions for the better
(7) simplify code segments
(8) use bytes.Buffer for code generation
(9) rename variables + functions
(10) remove doc.go
Change-Id: I5e163f89a518f074e58bf2d44597e553c918d7e6
Reviewed-on: https://go-review.googlesource.com/61010
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This belongs to a series of clean-up changes (see below) for cmd/dist.
This is change (3).
These changes include:
(1) apply minor fixes
(2) restore behavior of branchtag
(3) unleash bootstrap optimization for windows
(4) use standard generated code header
(5) remove trivial variables + functions
(6) move functions for the better
(7) simplify code segments
(8) use bytes.Buffer for code generation
(9) rename variables + functions
(10) remove doc.go
Change-Id: I7612bbc3939e6fca3bee4b8e92c528178dd46cd7
Reviewed-on: https://go-review.googlesource.com/61023
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The behavior was changed unintentionally during the conversion from C to Go.
Reviewed-on: https://go-review.googlesource.com/2470
This belongs to a series of clean-up changes (see below) for cmd/dist.
This is change (2).
These changes include:
(1) apply minor fixes
(2) restore behavior of branchtag
(3) unleash bootstrap optimization for windows
(4) use standard generated code header
(5) remove trivial variables + functions
(6) move functions for the better
(7) simplify code segments
(8) use bytes.Buffer for code generation
(9) rename variables + functions
(10) remove doc.go
Change-Id: I53373c7211b35ed68da485c55e510871bfb81267
Reviewed-on: https://go-review.googlesource.com/61022
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This belongs to a series of clean-up changes (see below) for cmd/dist.
This is change (1).
These changes include:
(1) apply minor fixes
(2) restore behavior of branchtag
(3) unleash bootstrap optimization for windows
(4) use standard generated code header
(5) remove trivial variables + functions
(6) move functions for the better
(7) simplify code segments
(8) use bytes.Buffer for code generation
(9) rename variables + functions
(10) remove doc.go
Change-Id: I49e5f2a9b6146e2b60a067da5bac31434ffc9aaf
Reviewed-on: https://go-review.googlesource.com/60650
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run "cmd/go terminal test" after standard library tests.
Run "testing race detector" before cgo tests, not in the middle of them.
Fixes#21524
Change-Id: I32964ec6377dd070242138ec452bd8ab1821dcc5
Reviewed-on: https://go-review.googlesource.com/57230
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Joe Tsai <joetsai@google.com>
This makes it much easier to run individual failing subtests.
Use $(go env CC) instead of always defaulting to clang; this makes it
easier to test with other compilers.
Run C binaries to detect incompatible compiler/kernel pairings instead
of sniffing versions.
updates #21196
Change-Id: I0debb3cc4a4244df44b825157ffdc97b5c09338d
Reviewed-on: https://go-review.googlesource.com/52910
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Test is not run in short mode, except on builders.
Change-Id: I4456830770188951e05ac13669e834a25bf569ae
Reviewed-on: https://go-review.googlesource.com/55973
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Joe Tsai <joetsai@google.com>
Reviewed-by: Joe Tsai <joetsai@google.com>
Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
$ go tool -h says:
For more about each tool command, see 'go tool command -h'.
but it was suggested to change the suggestion to say:
see 'go doc command'
In #18313.
That would work for every tool except dist, which has no doc.go.
This change adds a doc.go file to cmd/dist.
Updates #18313
Change-Id: If67a21934b87647a69359d9c14d8de3775c587b7
Reviewed-on: https://go-review.googlesource.com/54351
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change enables buildmode c-shared on ppc64le.
A bug was fixed in runtime/rt0_linux_ppc64le.s that was necessary to
make this work. In _rt0_ppc64le_linux_lib, there is code to store
the value of r2 onto the caller's stack. However, if this file
is compiled using a build mode that maintains the TOC address in
r2, then instructions will be inserted at the beginning of this
function to generate the r2 value for the callee, not the caller.
That means the r2 value for the callee is stored onto the caller's
stack. If caller and callee don't have the same r2 values, then
the caller will restore the wrong r2 value after it returns. This
situation can happen when using dlopen since the caller of this
function will be in ld64.so and will definitely have a different
TOC.
Updates #20756
Change-Id: I6e165e0d0716e73721bbbcc520e8302e4856e3ba
Reviewed-on: https://go-review.googlesource.com/53890
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Fails on iOS because CC_FOR_TARGET points to clangwrap.sh in the
original GOROOT. We could fix that but it doesn't seem worth it.
Fails on Android with "exec format error". I'm not sure why but I
doubt it is interesting.
Fails on Plan 9 because the original GOROOT is being preserved in some
unknown way. This is issue #21016.
Updates #21016
Change-Id: I4e7115d734fc7bf21e5a2ba18fb6ad0bfa31c735
Reviewed-on: https://go-review.googlesource.com/48650
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This is necessary to make a relocated GOROOT work correctly.
Fixes#20997
Change-Id: I18624bd2e109721066cd9e4a887a12583ab79f5d
Reviewed-on: https://go-review.googlesource.com/48550
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This reverts commit 168eb9cf33.
CL 47831 fixes the issue with plugins on ARMv5, so we can re-enable the test.
Updates #19674.
Change-Id: Idcb29f93ffb0460413f1fab5bb82fa2605795038
Reviewed-on: https://go-review.googlesource.com/47834
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
We weren't setting r0 to 0, as required by our generated code.
Before this patch, the misc/cgo/testcarchive tests failed on ppc64le.
After this patch, they work, so enable them.
Change-Id: I53b16746961da9f7c34f59030a1e40953c9c1e05
Reviewed-on: https://go-review.googlesource.com/44093
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This is one hurdle to building Go on Android; the runtime does
not build properly because *_linux.go files are excluded from
the "Building go_bootstrap" step when GOOS=android.
There are other hurdles; this is the first one.
Change-Id: I766e4bbf6ffc0d273888913f2516cf3e995a1786
Reviewed-on: https://go-review.googlesource.com/38308
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Now:
$ GOARCH=arm GOARM=5 go install -x cmd/go
... followed by:
$ GOARCH=arm GOARM= go install -x cmd/go
... actually does work. Previously the second "go install" would reuse
the cached binaries from the GOARM=5 command and not rebuild.
(Or vice versa from GOARM= to GOARM=5)
And do the same for GO386.
Fixes#9737
Change-Id: I9630aab34d06465d5033e6743dfe6592c8247aa0
Reviewed-on: https://go-review.googlesource.com/43855
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Implements detection of x86 cpu features that
are used in the go standard library.
Changes all standard library packages to use the new cpu package
instead of using runtime internal variables to check x86 cpu features.
Updates: #15403
Change-Id: I2999a10cb4d9ec4863ffbed72f4e021a1dbc4bb9
Reviewed-on: https://go-review.googlesource.com/41476
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
5 shards, each of which spins up NumCPU processes,
each of which is running at GOMAXPROCS=NumCPU,
is too much for one machine. It makes my laptop unusable.
It might also be in part responsible for test flakes
that require a moderately responsive system,
like #18589 (backedge scheduling) and #19276 (locklinear).
It's possible that Go should be a better neighbor in general;
that's #17969. In the meantime, fix this corner of the world.
Builders snapshot the world and run shards on different
machines, so keeping sharding high for them is good.
This is a partial reversion of CL 18199.
Fixes#20141.
Change-Id: I123cf9436f4f4da3550372896265c38117b78071
Reviewed-on: https://go-review.googlesource.com/42431
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
In an effort to at least understand the complete set of things not
working on Alpine Linux, I've been trying to get the build passing
again, even with tests disabled.
The race detector is broken on Alpine. That is #14481 (and #9918).
So disable those tests for now.
Also, internal linking with PIE doesn't work on Alpine yet.
That is #18243. So disable that test for now.
With this CL, all.bash almost passes. There's some cgo test failing
still, but there's no bug yet, so that can be a separate CL.
Change-Id: I3ffbb0e787ed54cb82f298b6bd5bf3ccfbc82622
Reviewed-on: https://go-review.googlesource.com/41678
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Now that the os package uses internal/poll on Unix and Windows systems,
it can rely on internal/poll reference counting to ensure that the
file descriptor is not closed until all I/O is complete.
That was already working. This CL completes the job by not trying to
modify the Sysfd field when it might still be used by the I/O routines.
Fixes#7970
Change-Id: I7a3daa1a6b07b7345bdce6f0cd7164bd4eaee952
Reviewed-on: https://go-review.googlesource.com/41674
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Now only cmd/asm and cmd/compile depend on cmd/internal/obj. Changing
the assembler backends no longer requires reinstalling cmd/link or
cmd/addr2line.
There's also now one canonical definition of the object file format in
cmd/internal/objabi/doc.go, with a warning to update all three
implementations.
objabi is still something of a grab bag of unrelated code (e.g., flag
and environment variable handling probably belong in a separate "tool"
package), but this is still progress.
Fixes#15165.
Fixes#20026.
Change-Id: Ic4b92fac7d0d35438e0d20c9579aad4085c5534c
Reviewed-on: https://go-review.googlesource.com/40972
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
all tests currently share the same platform string and fail to
vet expected platforms
Fixes#19958
Change-Id: I2801e1e84958e31975769581e27ea5ca6a0edf5b
Reviewed-on: https://go-review.googlesource.com/40511
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Currently, dist allows GOOS and GOARCH to appear as *any* substring in
a file name when selecting source files to go into go_bootstrap. This
was necessary prior to Go 1.4, where it needed to match names like
"windows.c", but now it's gratuitously different from go/build. This
led to a bug chase to figure out why "stubs_nonlinux.go" was not being
built on non-Linux OSes.
Change shouldbuild to require an "_" before the GOOS and GOARCH in a
file name. This is still less strict than go/build, but the behavior
is much closer.
Change-Id: I580e9344a3c40d57c0721d345e911e8b4f141f5d
Reviewed-on: https://go-review.googlesource.com/40435
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This allows the go tool to run "go vet" with both the build flags
that make sense, such as -x and -tags, and vet with all its flags.
To do this, create a new package cmd/go/internal/cmdflag to
hold functionality common to flag handling for test and vet.
Fixes#19350
RELNOTES=yes
Change-Id: Ia1ae213bd3f6cab1c5e492501c8d43ce61a7ee89
Reviewed-on: https://go-review.googlesource.com/40112
Reviewed-by: Russ Cox <rsc@golang.org>
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Plugin support is patchy at the moment, so disable the test for
now until the test can be fixed. This way, we can get builders
for ARMv5 running for the rest of the code.
Updates #19674
Change-Id: I08aa211c08a85688656afe2ad2e680a2a6e5dfac
Reviewed-on: https://go-review.googlesource.com/39716
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
"go env" prints Go environment information as a shell script format by
default but it's difficult for some tools (e.g. editor packages) to
interpret it.
The -json flag prints the environment in JSON format which
can be easily interpreted by a lot of tools.
$ go env -json
{
"CC": "gcc",
"CGO_CFLAGS": "-g -O2",
"CGO_CPPFLAGS": "",
"CGO_CXXFLAGS": "-g -O2",
"CGO_ENABLED": "1",
"CGO_FFLAGS": "-g -O2",
"CGO_LDFLAGS": "-g -O2",
"CXX": "g++",
"GCCGO": "gccgo",
"GOARCH": "amd64",
"GOBIN": "/home/haya14busa/go/bin",
"GOEXE": "",
"GOGCCFLAGS": "-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build498013955=/tmp/go-build -gno-record-gcc-switches",
"GOHOSTARCH": "amd64",
"GOHOSTOS": "linux",
"GOOS": "linux",
"GOPATH": "/home/haya14busa",
"GORACE": "",
"GOROOT": "/home/haya14busa/src/go.googlesource.com/go",
"GOTOOLDIR": "/home/haya14busa/src/go.googlesource.com/go/pkg/tool/linux_amd64",
"PKG_CONFIG": "pkg-config"
}
Also, it supports arguments with -json flag.
$ go env -json GOROOT GOPATH GOBIN
{
"GOBIN": "/home/haya14busa/go/bin",
"GOPATH": "/home/haya14busa",
"GOROOT": "/home/haya14busa/src/go.googlesource.com/go"
}
Fixes#12567
Change-Id: I75db3780f14a8ab8c7fa58cc3c9cc488ef7b66a1
Reviewed-on: https://go-review.googlesource.com/38757
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This is now handled by os/exec.
Updates #12868
Change-Id: Ic21a6ff76a9b9517437ff1acf3a9195f9604bb45
Reviewed-on: https://go-review.googlesource.com/37698
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>