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/link: linking .a file not in package main succeeds #13468

Closed
ianlancetaylor opened this issue Dec 3, 2015 · 0 comments
Closed

cmd/link: linking .a file not in package main succeeds #13468

ianlancetaylor opened this issue Dec 3, 2015 · 0 comments
Milestone

Comments

@ianlancetaylor
Copy link
Contributor

foo.go:

package p
import "fmt"
func main() {
    fmt.Println("Hello, world");
}

go tool compile foo.go
go tool link foo.go
/home/iant/go/pkg/tool/linux_amd64/link: foo.o: not package main (package p)

go tool compile -pack foo.go
go tool link foo.a
./a.out
Hello, world

The link should not succeed in the -pack case. It should get the same error as the non-pack case.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Dec 3, 2015
@rsc rsc closed this as completed in c7b1ef9 Dec 17, 2015
tkilbourn added a commit to tkilbourn/blueprint that referenced this issue Mar 24, 2016
Go 1.6 fixed a bug where compiling with the -pack flag allowed non-main
packages to link.
golang/go#13468

This change uses package main for choosestage and gotestmain.
@golang golang locked and limited conversation to collaborators Dec 29, 2016
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