Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal, go/cmd: go build -o existing_dir_name should show an error #39145

Closed
GrigoriyMikhalkin opened this issue May 19, 2020 · 2 comments
Closed

Comments

@GrigoriyMikhalkin
Copy link
Contributor

@GrigoriyMikhalkin GrigoriyMikhalkin commented May 19, 2020

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

$ go version
go version go1.14.3 linux/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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/gmikhalkin/.cache/go-build"
GOENV="/home/gmikhalkin/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/gmikhalkin/.gvm/pkgsets/go1.14.3/global"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/gmikhalkin/.gvm/gos/go1.14.3"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/gmikhalkin/.gvm/gos/go1.14.3/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/gmikhalkin/Projects/feature_toggle_management/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build894912669=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Project structure:

/project_name
    /app
    main.go

If run go build -o app ., it will create executable project_name in app directory

What did you expect to see?

Some kind of error message, that would say that there's already directory with such name.

@mvdan
Copy link
Member

@mvdan mvdan commented May 19, 2020

Did you see go help build?

The -o flag forces build to write the resulting executable or object to the named output file or directory

Changing this would mean changing the documented behavior, and likely breaking many users.

@GrigoriyMikhalkin
Copy link
Contributor Author

@GrigoriyMikhalkin GrigoriyMikhalkin commented May 19, 2020

I see, missed that. Closing the issue then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.