其他分享
首页 > 其他分享> > golang

golang

作者:互联网

 

root@ubuntu:~/kata# go get -d -u github.com/kata-containers/runtime

Command 'go' not found, but can be installed with:

snap install go         # version 1.15.2, or
apt  install golang-go
apt  install gccgo-go 

See 'snap info go' for additional versions.

root@ubuntu:~/kata# apt  install golang-go
Reading package lists... Done
Building dependency tree       
Reading state information... Done

 

 

root@ubuntu:~/kata# go version
go version go1.10.4 linux/arm64
root@ubuntu:~/kata#

 

root@ubuntu:~/kata# ls /usr/bin/go -al
lrwxrwxrwx 1 root root 21 Feb 28  2018 /usr/bin/go -> ../lib/go-1.10/bin/go
root@ubuntu:~/kata# whereis go
go: /usr/bin/go /usr/lib/go /usr/share/go /usr/share/man/man1/go.1.gz
root@ubuntu:~/kata# 

 

 

 

pt-get install golang-go这样安装版本可能过低。
go version查看版本为 1.6.2
apt-get 卸载此版本重新安装

重新安装

export GOPATH=/opt/gopath
export GOROOT=/usr/lib/go
export GOARCH=386
export GOOS=linux
export GOTOOLS=$GOROOT/pkg/tool
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin


 

 

 

root@ubuntu:~/kata# go get -d -u github.com/kata-containers/runtime
package github.com/kata-containers/runtime: no Go files in /root/go/src/github.com/kata-containers/runtime
root@ubuntu:~/kata# 

 

root@ubuntu:~/kata# git clone https://github.com/kata-containers/runtime.git

 

 

consider the following goreleaser.yml

# goreleaser.yml
# Build customization
build:
  goos:
    - windows
    - darwin
    - linux
  goarch:
    - amd64
    - arm
    - arm64
    - 386

 

 

root@ubuntu:~/kata/runtime# go env
cmd/go: unsupported GOOS/GOARCH pair linux/arch64
arch64 改成arm64
export GOPATH=/opt/gopath
export GOROOT=/usr/lib/go
export GOARCH=arm64   
export GOOS=linux
export GOTOOLS=$GOROOT/pkg/tool
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

 

root@ubuntu:~/kata/runtime# source ../go_source 
root@ubuntu:~/kata/runtime# go env
GOARCH="arm64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/gopath"
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_arm64"
GCCGO="gccgo"
CC="aarch64-linux-gnu-gcc"
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"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build751817124=/tmp/go-build -gno-record-gcc-switches"
root@ubuntu:~/kata/runtime# 
root@ubuntu:~/kata/runtime# make && sudo -E PATH=$PATH make install
INFO: yq was not found, installing it
golang.mk:60: *** "ERROR: golang minor version too old: got 1.10.4, need atleast 1.11".  Stop.
root@ubuntu:~/kata/runtime# 

 

标签:linux,golang,export,ubuntu,go,kata,root
来源: https://www.cnblogs.com/dream397/p/13750556.html