On Thu, Aug 11, 2022 at 3:19 AM ma...@eliasnaur.com
wrote:
> exec.LookPath is even better in Go 1.19, which implements
>
> "go test and go generate now place GOROOT/bin at the beginning of the PATH
> used for the subprocess, so tests and generators that execute the go
> command will resolve it to
On Thursday, 11 August 2022 at 10:09:35 UTC+2 Jan Mercl wrote:
> On Thu, Aug 11, 2022 at 9:59 AM Patrick Smith wrote:
>
> > To date, I've been using a recipe I found some time ago through an
> Internet search (I've forgotten the source, so can't credit it):
> >
> > gocmd := runtime.GOROOT()
On Thu, Aug 11, 2022 at 9:59 AM Patrick Smith wrote:
> To date, I've been using a recipe I found some time ago through an Internet
> search (I've forgotten the source, so can't credit it):
>
> gocmd := runtime.GOROOT() + "/bin/go"
> if runtime.GOOS == "windows" {
>
I sometimes find that I want to run the go command from inside a test case,
for example to build generated code, or to verify that code that should
raise an error at compile time does in fact cause that error.
That raises the question, is there a reliable way to find the go command
from inside a t