我是GO的新手。 我决定使用Thrift for Go的实现。 在阅读了手动安装说明步骤之后 从git下载最后一个Thrift 0.9.0并开始构建过程:
我的构建脚本如下:
#!/bin/bash
export THRIFT=$(pwd)/thrift
export THRIFT4GO=$(pwd)/thrift4go
export GOROOT=/usr
bash $THRIFT4GO/scripts/merge_and_build.sh -b
cd $THRIFT
#./cleanup.sh
./bootstrap.sh
./configure --with-go --without-python --without-csharp
make
if "$?" == "1"; then
ln -s $THRIFT/lib/go/src/thrift $GOPATH/src/thrift
go install thrift
fi
但是对于GO来说make不起作用,问题出在哪里? 我在bash中使用导出的GOPATH变量正确安装了GO,“go install”适用于其他项目。 我无法理解为什么GO找不到包。
Making all in go
make[3]: Entering directory `/home/user/projects/delkon/thrift/lib/go'
make check-local
make[4]: Entering directory `/home/user/projects/delkon/thrift/lib/go'
go build -v -x thrift
WORK=/tmp/go-build548238117
src/thrift/tiostream_transport.go:23:2: import "bufio": cannot find package
src/thrift/tframed_transport.go:23:2: import "bytes": cannot find package
src/thrift/tmap.go:24:2: import "container/list": cannot find package
src/thrift/tjson_protocol.go:23:2: import "encoding/base64": cannot find package
src/thrift/tbinary_protocol.go:23:2: import "encoding/binary": cannot find package
src/thrift/tsimple_json_protocol.go:26:2: import "encoding/json": cannot find package
src/thrift/tapplication_exception.go:23:2: import "errors": cannot find package
src/thrift/tcompact_protocol.go:24:2: import "fmt": cannot find package
src/thrift/tbinary_protocol.go:24:2: import "io": cannot find package
src/thrift/ttransport.go:23:2: import "log": cannot find package
src/thrift/tbinary_protocol.go:25:2: import "math": cannot find package
src/thrift/tnonblocking_server_socket.go:23:2: import "net": cannot find package
src/thrift/thttp_client.go:24:2: import "net/http": cannot find package
src/thrift/thttp_client.go:25:2: import "net/url": cannot find package
src/thrift/ttransport.go:24:2: import "os": cannot find package
src/thrift/tmap.go:25:2: import "reflect": cannot find package
package thrift
imports runtime: import "runtime": cannot find package
src/thrift/tfield.go:23:2: import "sort": cannot find package
src/thrift/thttp_client.go:26:2: import "strconv": cannot find package
src/thrift/tbinary_protocol.go:26:2: import "strings": cannot find package
src/thrift/tnonblocking_socket.go:24:2: import "time": cannot find package
make[4]: *** [check-local] Error 1
make[4]: Leaving directory `/home/user/projects/delkon/thrift/lib/go'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory `/home/user/projects/delkon/thrift/lib/go'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/user/projects/delkon/thrift/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/user/projects/delkon/thrift'
make: *** [all] Error 2
感谢您的任何意见 P.S Arch linux(X86,64)
UPD 问题是从GIT克隆的thrift,使用https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz版本而不是
答案 0 :(得分:2)
我尝试完全按照完成所有Manual Installation步骤而没有任何问题。
(12:49) jnml@fsc-r550:~$ go version
go version go1.0.3
(12:49) jnml@fsc-r550:~$ go env
GOARCH="amd64"
GOBIN="/home/jnml/bin"
GOCHAR="6"
GOEXE=""
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jnml"
GOROOT="/home/jnml/go"
GOTOOLDIR="/home/jnml/go/pkg/tool/linux_amd64"
CGO_ENABLED="1"
(12:49) jnml@fsc-r550:~$
注意:我已将thrift4go存储库克隆到$GOPATH/src/github.com/pomack/thrift4go
。这在README.md中没有提到。