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

cmd/go: can't go run a file that begins with an underscore #21530

Closed
natefinch opened this issue Aug 19, 2017 · 1 comment
Closed

cmd/go: can't go run a file that begins with an underscore #21530

natefinch opened this issue Aug 19, 2017 · 1 comment

Comments

@natefinch
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

What did you do?

go run _foo.go

What did you expect to see?

compile & run the file

I know that go run will ignore build constraints on the target files, so I was surprised that it ignored the file with the underscore. This was made doubly confusing because the error message is confusingly saying there's no go files in the directory, but with go run, I'm not building "everything in the directory" like I would with go build, I'm building a specific set of files, so the error message is misleading.

What did you see instead?

~/src/foo/bar (master)$ go run _make.go
package main: no Go files in /Users/nate/src/foo/bar

Does this issue reproduce with the latest release (go1.8.3)?

yes

System details

go version devel +eab99a8d54 Mon Jun 26 21:12:22 2017 +0000 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/finchnat"
GORACE=""
GOROOT="/Users/finchnat/src/github.com/golang/go"
GOTOOLDIR="/Users/finchnat/src/github.com/golang/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ch/4d1vgsv17jq0b3yfmnkl9thdk0jm7d/T/go-build471231850=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOROOT/bin/go version: go version devel +eab99a8d54 Mon Jun 26 21:12:22 2017 +0000 darwin/amd64
GOROOT/bin/go tool compile -V: compile version devel +eab99a8d54 Mon Jun 26 21:12:22 2017 +0000 X:framepointer
uname -v: Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.12.6
BuildVersion:	16G29
lldb --version: lldb-370.0.42
  Swift-3.1
@natefinch
Copy link
Contributor Author

natefinch commented Aug 19, 2017

duplicate of #21529

@golang golang locked and limited conversation to collaborators Aug 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants