We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
显示日志信息所在文件为绝对路径,如下所示:
[2019/05/12 22:22:21.459] [C:/xxx/service/src/storeserv/internal/service/service.go:51] storeserv start [2019/05/12 22:22:21.469] [C:/xxx/service/src/github.com/bilibili/kratos/pkg/net/http/blademaster/server.go:97] blademaster: start http listen addr: 0.0.0.0:6060
能否改为以GOPATH为准的相对路径?这样既能清晰显示日志信息,又能节省不必要的日志内容。
The text was updated successfully, but these errors were encountered:
Golang 无法再编译时获取 GOPATH 参数,来去除 GOPATH 前缀。不过可以通过传递编译参数 all=-trimpath= 来去除部分文件路径
all=-trimpath=
go build -o {target_path} -gcflags "all=-trimpath=${GOPATH}/src" {source_file}
这样就相当于显示已 ${GOPATH}/src 为准的相对路径
Sorry, something went wrong.
补充:
go build -o main -gcflags "all=-trimpath=${GOPATH}/pkg/mod;${PWD}" main.go
支持去除多个路径的前缀
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Replenish:
Supports removing prefixes from multiple paths
No branches or pull requests
显示日志信息所在文件为绝对路径,如下所示:
能否改为以GOPATH为准的相对路径?这样既能清晰显示日志信息,又能节省不必要的日志内容。
The text was updated successfully, but these errors were encountered: