我正在處理這個 PR(https://github.com/gin-contrib/i18n/pull/7),它使用 go 1.16 支持的嵌入包(https://tip.golang.org/doc/ go1.16#library-embed)。由于 gin-contrib/i18n 包支持 go 1.13 的版本,如果 go 版本 < 1.16,我想讓它跳過構建和測驗嵌入。我該怎么辦?我嘗試使用構建標簽
//go:build go1.16
但這種方法并沒有像我預期的那樣奏效。提前致謝。
uj5u.com熱心網友回復:
如檔案中所述。//go:build約束包含在 Go 1.16 中,也使用// build go1.16.
該包決議原始的“// build”語法和將在 Go 1.17 中添加的“//go:build”語法。決議器包含在 Go 1.16 中,以允許需要處理 Go 1.17 源代碼的工具仍然針對 Go 1.16 版本構建。有關“//go:build”語法的詳細資訊,請參閱https://golang.org/design/draft-gobuild。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/441633.html
上一篇:在PostMan上發送帖子請求
