我想用go语言调试标准库,所以我将一些日志添加到标准库文件中,但这没有任何区别,我想我应该重建.a文件,我该怎么做?
$ 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
-rw-r--r--@ 1 bitstore staff 53838 4 8 00:54 /usr/local/go1.8.1/pkg/darwin_amd64/text/scanner.a
答案 0 :(得分:1)
Go工具查看源时间戳,以查看是否需要安装。例如,
$ cd ~
$ touch /home/peter/go/src/text/scanner/scanner.go
$ go install -v text/scanner/
text/scanner
$ go install -v text/scanner/
$
go install
查看$GOROOT
然后$GOPATH
。
go version
和go env
命令的输出是什么?
$ go version
go version devel +1737aef Mon Apr 24 12:37:49 2017 +0000 linux/amd64
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/peter/gopath"
GORACE=""
GOROOT="/home/peter/go"
GOTOOLDIR="/home/peter/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build148116572=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
$
你是如何安装Go的?