在golang的文檔中,我找不到任何關(guān)于 的參數(shù)的解釋-ldflags。go build -ldflags "-X main.version=${IDE_DATE}-${IDE_VERSION}-${IDE_OS}-${IDE_ARCH}-DEBUG" -o $2 cmd/backend.go我在哪里可以找到有關(guān)的文檔-ldflags?
1 回答

慕標(biāo)琳琳
TA貢獻1830條經(jīng)驗 獲得超9個贊
ldflags 代表鏈接器標(biāo)志,用于將標(biāo)志傳遞給底層鏈接器。根據(jù)文檔:
-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.
- 1 回答
- 0 關(guān)注
- 232 瀏覽
添加回答
舉報
0/150
提交
取消