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

Comments

Projects
None yet
2 participants
@gertcuykens
Copy link

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

This comment has been minimized.

Copy link
Contributor

commented Aug 14, 2018

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

@gertcuykens

This comment has been minimized.

Copy link
Author

commented Aug 15, 2018

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.