我想用go語言來調試標準庫,所以我給標準庫文件添加了一些日誌,但是這並沒有什麼區別,我想我應該重建.a文件,我該怎麼做?如何在golang中構建stdlib文件?
$ go version
go version go1.8.1 darwin/amd64
$ go env
GOARCH="amd64"
GOBIN="/usr/local/go1.8.1/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/bitstore/Projects/go"
GORACE=""
GOROOT="/usr/local/go1.8.1"
GOTOOLDIR="/usr/local/go1.8.1/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4r/62myx2852db5cdvrtqx63gl40000gn/T/go-build009034286=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
$ go install -v text/scanner
output nothing
I install use environment variables
export GOROOT=/usr/local/go1.8.1
export GOBIN=$GOROOT/bin
export GOPATH=$HOME/Projects/go
export PATH=$PATH:$GOBIN:$GOPATH/bin
$ ls -la /usr/local/go1.8.1/src/text/scanner/scanner.go
-rw-r--r-- 1 bitstore staff 17545 4 24 22:19 /usr/local/go1.8.1/src/text/scanner/scanner.go
$ go install -v text/scanner
$ ls -la /usr/local/go1.8.1/pkg/darwin_amd64/text/scanner.a
[email protected] 1 bitstore staff 53838 4 8 00:54 /usr/local/go1.8.1/pkg/darwin_amd64/text/scanner.a
你運行了'go install packagename'嗎?你想要構建什麼包? – JimB
@JimB文本/掃描儀,它不是gopath,它是goroot中的標準庫 – bitstore
好吧,但是你有沒有試過'去安裝文本/掃描儀?這就是你如何安裝任何軟件包。 (或者你可以從源代碼安裝Go,並使用相同的程序) – JimB