在golang的文档中,我找不到关于HERE!!!!
参数的任何解释。
-ldflags
在哪里可以找到有关go build -ldflags "-X main.version=${IDE_DATE}-${IDE_VERSION}-${IDE_OS}-${IDE_ARCH}-DEBUG" -o $2 cmd/backend.go
的文档?
答案 0 :(得分:5)
ldflags代表链接器标志,用于将标志传递给基础链接器。根据文档:
-X importpath.name=value
Set the value of the string variable in importpath named name to value.
This is only effective if the variable is declared in the source code either uninitialized
or initialized to a constant string expression. -X will not work if the initializer makes
a function call or refers to other variables.
Note that before Go 1.5 this option took two separate arguments.