IMPORTMENT:可以在windows子系统中设置GOPATH(指向windows gopath)实现linux下编译功能

1、windows子系统 go环境搭建

(1)下载地址:https://golang.org/dl/

(2)切换至下载路径并解压缩

cd /mnt/d/
sudo tar -C /usr/local -xzf go1.11.5.linux-amd64.tar.gz

(3)配置环境变量---可忽略

Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile(for a system-wide installation) or $HOME/.profile:

export PATH=$PATH:/usr/local/go/bin

2、设置GOPATH

(1)编辑/etc/profile

 sudo vim /etc/profile

(2)新增环境变量

export GOPATH=/mnt/d/go
export PATH=$PATH:$GOPATH/bin

windows子系统之go环境搭建及编译

至此大功告成....可以在windows上编程,然后在windows子系统上编译

相关文章:

  • 2021-04-01
  • 2021-10-16
  • 2021-07-14
  • 2021-05-21
  • 2022-01-27
  • 2021-10-17
  • 2021-12-06
  • 2021-07-07
猜你喜欢
  • 2022-02-01
  • 2021-08-02
  • 2021-05-20
  • 2021-04-26
  • 2021-11-13
  • 2021-10-11
  • 2021-11-26
相关资源
相似解决方案