-gcflags="-m -m"
GODEBUG=gctrace=1 ./app
GOGC=150 GODEBUG=gctrace=1,schedtrace=1000 ./app
GODEBUG=schedtrace=1000 ./app
-gcflags"-N"
-dwarf = generate dwarf symbols
-l = disable inlining
-j = debug runtime-initialized variables
-buildmode=archive
statically linked .a
-buildmode=c-shared
.so, exports only symbols annotated with "//export" comment
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -x -v -a -ldflags="-w -s" \
-gcflags=-trimpath=/Users/alex/go/path-to-project \
-asmflags=-trimpath=/Users/alex/go/path-to-project \
-o ./myapp
/Users/alex/go/path-to-project
may be replaced with $(pwd)
.
more: go tool compile -help
, also https://pkg.go.dev/cmd/compile