Skip to content

How to specify go test to build and run executable in exact folder but not random folder #49238

@szmcdull

Description

@szmcdull

What version of Go are you using (go version)?

$ go version
go version go1.17 windows/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\EDZ\AppData\Local\go-build
set GOENV=C:\Users\EDZ\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=d:\golibs\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=d:\golibs
set GOPRIVATE=
set GOPROXY=direct
set GOROOT=D:\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\code\digifinex\acts\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\EDZ\AppData\Local\Temp\go-build2790652590=/tmp/go-build -gno-record-gcc-switches

What did you do?

D:\Go\bin\go.exe test -timeout 1m -tags debug -run ^TestActs$ acts/util -o test -count=1

What did you expect to see?

build the test to the file test and then run it

What did you see instead?

built the test to the file test but then run it in a random temp folder.
Each time I go test a new file in a new random folder is created and run. And Windows Firewall warn me to add a rule to allow it to listen on a local port (because in the test I must listen on a local port)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions