]> Cypherpunks repositories - gostls13.git/commit
cmd/go: respect gcflags, ldflags in 'go test'
authorAlessandro Arzilli <alessandro.arzilli@gmail.com>
Wed, 19 Sep 2018 12:45:45 +0000 (14:45 +0200)
committerJay Conrod <jayconrod@google.com>
Thu, 3 Jan 2019 17:20:41 +0000 (17:20 +0000)
commit374546d800124e9ab4d51b75e335a71f866f3ef8
tree154cb4e11eaf6f3907402436fbde85efe9be5729
parentabd1dde1f717f86f94774ce9ab56053947f2d175
cmd/go: respect gcflags, ldflags in 'go test'

Fixes bug introduced by https://golang.org/cl/129059 where
gcflags='all=...' and ldflags='all=...' would not be applied to some
packages built by 'go test'.

LoadImport used to set gcflags/ldflags for the Package objects it
created, in https://golang.org/cl/129059 this code was factored out to
setToolFlags. The codepath of `go build` was updated to call
setToolFlags appropriatley, but the codepath of `go test -c` wasn't,
resulting in gcflags/ldflags being applied inconsistently when building
tests.

This commit changes TestPackagesFor to call setToolFlags on the package
objects it creates.

Fixes #27681

Change-Id: Idcbec0c989ee96ec066207184611f08818873e8d
Reviewed-on: https://go-review.googlesource.com/c/136275
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/load/test.go
src/cmd/go/testdata/script/gcflags_patterns.txt