亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

`go build -ldflags` 參數中的 `-X` 是什么意思?

`go build -ldflags` 參數中的 `-X` 是什么意思?

Go
米琪卡哇伊 2023-08-07 19:03:36
在golang的文檔中,我找不到任何關于 的參數的解釋-ldflags。go build -ldflags "-X main.version=${IDE_DATE}-${IDE_VERSION}-${IDE_OS}-${IDE_ARCH}-DEBUG" -o $2 cmd/backend.go我在哪里可以找到有關的文檔-ldflags?
查看完整描述

1 回答

?
慕標琳琳

TA貢獻1830條經驗 獲得超9個贊

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.

查看完整回答
反對 回復 2023-08-07
  • 1 回答
  • 0 關注
  • 223 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號