I use build tags to disable one feature, such as:
source
// +build abc
package main
import (
"big-package"
"bigbig"
)
...
// +build !abc
// empty
build cmd
- enable:
go build --tags abc
- disable:
go build
this method works always.
problem
but I found build binary size keeps big when abc disabled.
- keep abc_enable.go,
--tags abc
. size up to 11M
- keep abc_enable.go, no tags. size up to 11M
- remove abc_enable.go by hand, size down to 5M
is there any link options or build options to fix this?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…