On Mon, Oct 3, 2016 at 4:08 PM, <[email protected]> wrote: > > Please see the code of main.go and main_test.go pasted at the end. Then > consider the output of these commands. I would have expected the `go test` > command's output to contain the value 'hello'. From `go help test` output, > the `go test` command is supposed to honor all build flags, but clearly it > isn't.
I don't think that's the problem. If you use the -x option with `go test`, you should see that the -ldflags option is indeed being passed to `go tool link`. I think the problem is that `go test` renames the package being tested, so it no longer has the name `main`. That means that your `-X` option is not using the right variable name. I'm not sure whether this should be considered a bug or not. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
