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: go test -c skips init from main while go test doesn't #26989

Closed
gertcuykens opened this issue Aug 14, 2018 · 2 comments
Closed

cmd/go: go test -c skips init from main while go test doesn't #26989

gertcuykens opened this issue Aug 14, 2018 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@gertcuykens
Copy link
Contributor

gertcuykens commented Aug 14, 2018

go version go1.10.3 darwin/amd64

Hi, go test runs the main init and the main_test init but the binary created by

go test -c -a -tags 'netgo noplugin' -gcflags "all=-N -l"

doesn't run the main init. Is this a bug? Also it's seems you can't compile static test binaries only non test binaries can be compiled static?

(PS asked it on golang-nuts first before I asked here)

@ianlancetaylor ianlancetaylor changed the title go test -c skips init from main while go test doesn't cmd/go: go test -c skips init from main while go test doesn't Aug 14, 2018
@ianlancetaylor
Copy link
Contributor

That certainly sounds like a bug. Can you show us a complete test case?

@ianlancetaylor ianlancetaylor added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 14, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Aug 14, 2018
@gertcuykens
Copy link
Contributor Author

I made a wrong conclusion and run a executable not representing the build because it failt so it didn't replaced the old executable

go build -a -tags 'netgo noplugin' -ldflags '-d -extldflags "-static"' -gcflags "all=-N -l" -o main

/usr/local/go/pkg/tool/darwin_amd64/link: $WORK/b072/_pkg_.a(_go_.o): cannot use dynamic imports with -d flag
/usr/local/go/pkg/tool/darwin_amd64/link: $WORK/b085/_pkg_.a(_go_.o): cannot use dynamic imports with -d flag
/usr/local/go/pkg/tool/darwin_amd64/link: $WORK/b086/_pkg_.a(_go_.o): cannot use dynamic imports with -d flag
crypto/x509(__TEXT/__text): relocation target SecTrustCopyAnchorCertificates not defined
crypto/x509(__TEXT/__text): relocation target kCFAllocatorDefault not defined
crypto/x509(__TEXT/__text): relocation target CFDataCreateMutable not defined
crypto/x509(__TEXT/__text): relocation target CFArrayGetCount not defined
crypto/x509(__TEXT/__text): relocation target CFArrayGetValueAtIndex not defined
crypto/x509(__TEXT/__text): relocation target SecKeychainItemExport not defined
crypto/x509(__TEXT/__text): relocation target CFDataGetBytePtr not defined
crypto/x509(__TEXT/__text): relocation target CFDataGetLength not defined
crypto/x509(__TEXT/__text): relocation target CFDataAppendBytes not defined
crypto/x509(__TEXT/__text): relocation target CFRelease not defined
crypto/x509(__TEXT/__text): relocation target CFRelease not defined
crypto/x509(__TEXT/__text): relocation target __stack_chk_guard not defined
crypto/x509(__TEXT/__text): relocation target sysctlbyname not defined
crypto/x509(__TEXT/__text): relocation target __stack_chk_guard not defined
crypto/x509(__TEXT/__text): relocation target __stack_chk_fail not defined
crypto/x509(__TEXT/__text): relocation target __stack_chk_guard not defined
crypto/x509(__TEXT/__text): relocation target sysctlbyname not defined
crypto/x509(__TEXT/__text): relocation target CFStringCreateWithCString not defined
/usr/local/go/pkg/tool/darwin_amd64/link: too many errors

@golang golang locked and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants