GOOS="windows" GOARCH="amd64" go build
However till now golang‘s debug functionality seems far from okay. During debug you cannot print map objects.
And also from debugging related aspects, tool dlv do not support arm arch.
Using an undefined variable can be assigned from function return, or by define.
// The following defines a,b,c a, b, _ := func() var c = 1+2
According to this and by go tool link --help, compile statically using:
CGO_ENABLED=0 GOOS=linux go build -a -ldflags ‘-extldflags "-static"‘ .
compiling without debug info using: -ldflags ‘-s -w‘
原文地址:https://www.cnblogs.com/sansna/p/9279114.html
时间: 2024-11-24 19:41:18