-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Description
What version of Go are you using (go version
)?
go1.11
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env
)?
darwin amd64
What did you do?
In a package main
's directory (specifically, github.com/twitchtv/twirp/protoc-gen-twirp), I had a go.mod
like this:
module github.com/twitchtv/twirp/protoc-gen-twirp/v5
I then ran GO111MODULE=on go build .
from within $GOPATH/src/github.com/twitchtv/twirp/protoc-gen-twirp.
I expected an executable named protoc-gen-twirp
, because that is the last element of the directory. This is the documented behavior in https://tip.golang.org/cmd/go/#hdr-Compile_packages_and_dependencies:
When compiling a single main package, build writes the resulting executable to an output file named after the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe') or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe').
Instead, an executable was produced named v5
.
However, if I invoke go build
with a full path, I get the expected name. GO111MODULE=on go build github.com/twitchtv/twirp/protoc-gen-twirp
produces an executable named protoc-gen-twirp
.
This is either a documentation error, or a bug.