解决go编译报错../github.com/golang/freetype/truetype/face.go:13:2: cannot find package "golang.org/x/image/font" in any of:

问题点

构建中缺少golang.org/x/image/fontgolang.org/x/image/math/fixed源码文件

../github.com/golang/freetype/truetype/face.go:13:2: cannot find package "golang.org/x/image/font" in any of:
	/root/go/src/golang.org/x/image/font (from $GOROOT)
	/root/gopath/src/golang.org/x/image/font (from $GOPATH)
../github.com/golang/freetype/raster/geom.go:12:2: cannot find package "golang.org/x/image/math/fixed" in any of:
	/root/go/src/golang.org/x/image/math/fixed (from $GOROOT)
	/root/gopath/src/golang.org/x/image/math/fixed (from $GOPATH)

 解决办法:

在此网站下载,所需文件

https://github.com/golang?page=1

下载方式:

首先在电脑上安装git 

yum -y install git

创建指定目录:

mkdir -p  golang.org/x

需要哪个,下载哪个即可

格式:git clone https://github.com/golang/xxx.git

git clone https://github.com/golang/image.git

或者下载到本地电脑上,然后上传

下载完后,把所需要的文件,直接拷贝到指定目录中,如果目录不存在,需手动创建,例如:

下面这个无法连接,一顿折腾

https://github.com/MXi4oyu/golang.org

原文地址:https://www.cnblogs.com/yangzp/p/13741122.html