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

go/build: require an underscore when looking for $GOOS #5400

Closed
robpike opened this issue May 3, 2013 · 4 comments
Closed

go/build: require an underscore when looking for $GOOS #5400

robpike opened this issue May 3, 2013 · 4 comments

Comments

@robpike
Copy link
Contributor

robpike commented May 3, 2013

What steps will reproduce the problem?
1. Add a file windows.go to your package that contains func init(){panic("3")}
2. On a Linux or Darwin machine, run go test.

What is the expected output?

panic: 3

What do you see instead?

Successful test

The function goodOSArchFile in src/pkg/go/build sees the "windows" and rejects
it. This is an error; it should require an underscore before the OS name.
@rsc
Copy link
Contributor

rsc commented May 3, 2013

Comment 1:

I think this is working as intended. We have files with names like 386.s.

@adg
Copy link
Contributor

adg commented May 3, 2013

Comment 2:

I see only C files in the tree:
$ find go/src | egrep '/(amd64|386|arm|windows|darwin|linux)\.'
go/src/cmd/dist/arm.c
go/src/cmd/dist/windows.c
go/src/lib9/windows.c
go/src/libmach/darwin.c
go/src/libmach/linux.c
go/src/libmach/windows.c

@minux
Copy link
Member

minux commented May 3, 2013

Comment 3:

In Russ's pubgo.zip (which he used to do the return analysis), i found several
real-world uses:
pubgo/src/bitbucket.org/rj/odbc3-go/windows.go
pubgo/src/github.com/0xe2-0x9a-0x9b/goam/examples/example4/arch/386.go
pubgo/src/github.com/0xe2-0x9a-0x9b/goam/examples/example4/arch/amd64.go
pubgo/src/github.com/0xe2-0x9a-0x9b/goam/examples/example4/arch/arm.go
pubgo/src/github.com/0xe2-0x9a-0x9b/goam/examples/example4/os/darwin.go
pubgo/src/github.com/0xe2-0x9a-0x9b/goam/examples/example4/os/linux.go
pubgo/src/github.com/0xe2-0x9a-0x9b/goam/examples/example4/os/windows.go
pubgo/src/github.com/dersebi/golang_exp/exp/locale/collate/tools/colcmp/darwin.go
pubgo/src/github.com/edsrzf/fineline/windows.go
pubgo/src/github.com/knieriem/g/sercom/linux.go
pubgo/src/github.com/knieriem/g/sercom/windows.go
pubgo/src/github.com/sbinet/fineline/windows.go
and we have this:
https://code.google.com/p/go/source/browse/locale/collate/tools/colcmp/darwin.go?repo=exp
so i'm afraid we can't fix this issue.

@robpike
Copy link
Contributor Author

robpike commented May 3, 2013

Comment 4:

Status changed to Unfortunate.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

5 participants