标签: go
是否有Go标准库函数来扩展包导入路径?
例如,我想要一个具有以下行为的函数Expand:
Expand
Expand("path/filepath") => "/usr/local/go/src/path/filepath" Expand("go/types") => "/usr/local/go/src/go/types" Expand("my/package/path") => "/Users/kvu/go/src/my/package/path"
答案 0 :(得分:0)
也许是这样的:
path.Join(os.Getenv(“GOPATH”),“/ my / package / path”)