第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

在 go 中刪除跟蹤中的模塊路徑

在 go 中刪除跟蹤中的模塊路徑

Go
RISEBY 2022-06-27 16:36:10
我需要?jiǎng)h除跟蹤中的絕對(duì)路徑,它對(duì)應(yīng)于導(dǎo)入的模塊。即使我這樣編譯我的程序:go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH我仍然得到模塊文件的完整路徑,出現(xiàn)恐慌的地方,盡管程序的非模塊文件沒(méi)有顯示完整路徑:goroutine 1 [running]:monitors/fibre_monitor/logging.FileHandler(0x5e6755, 0x1a, 0x441, 0x0, 0x6fc23ac00, 0x1, 0x500000, 0xc000000002, 0xb)        /home/gtristan/go/src/monitors/fibre_monitor/logging/file_handler.go:182 +0x11fmain.python_logger(0x5e1383, 0x5, 0x5e6755, 0x1a, 0x101)        src/monitors/fibre_monitor/fibre_monitor.go:73 +0x1b5main.main_check(0x0, 0xc00008e058)        src/monitors/fibre_monitor/fibre_monitor.go:343 +0x65main.main()        src/monitors/fibre_monitor/fibre_monitor.go:428 +0x56有什么解決方案可以在跟蹤中到處擺脫 GOPATH?
查看完整描述

1 回答

?
紫衣仙女

TA貢獻(xiàn)1839條經(jīng)驗(yàn) 獲得超15個(gè)贊

使用-trimpath參數(shù) to go build(not to gcflagsor asmflags):


沒(méi)有-trimpath:


$ go build .

$ ./panic 

panic: bleh


goroutine 1 [running]:

main.example(0xc000046738, 0x2, 0x4, 0x473f2b, 0x5, 0xa)

    /home/me/stuff/src/github.com/me/testing/panic/main.go:9 +0x39

main.main()

    /home/me/stuff/src/github.com/me/testing/panic/main.go:4 +0x72

與-trimpath:


$ go build -trimpath  .

$ ./panic 

panic: bleh


goroutine 1 [running]:

main.example(0xc000046738, 0x2, 0x4, 0x473f2b, 0x5, 0xa)

    github.com/me/testing/panic/main.go:9 +0x39

main.main()

    github.com/me/testing/panic/main.go:4 +0x72


每go help build:


    -trimpath

        remove all file system paths from the resulting executable.

        Instead of absolute file system paths, the recorded file names

        will begin with either "go" (for the standard library),

        or a module path@version (when using modules),

        or a plain import path (when using GOPATH).


查看完整回答
反對(duì) 回復(fù) 2022-06-27
  • 1 回答
  • 0 關(guān)注
  • 141 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)