49

Go语言开发环境配置(VSCode)

 6 years ago
source link: https://studygolang.com/articles/13828?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

安装go

安装git

VS Code配置

  • 1.安装go扩展

    在vscode扩展中搜“go”,选择microsoft官方的ms-vscode.go

  • 2.安装相关工具包

    • 通过VSCode安装
      操作很简单,但需要科学上网(见下面第4条)
      • 1)Ctrl + Shift + P
      • 2)输入 Go: install/update tools
      • 3)All Select,确定
      • 4)部分工具需要科学上网。注意为VSCode设置[用户设置]http代理:
        此处以SSR为例,请先安装并完成SSR客户端配置
        • 4.1) windows下先启动SSR客户端,再对VSCode设置:
        "http.proxy": "127.0.0.1:1080",
        • 4.2) linux下需要 使用privoxy 一类的工具,安装配置好privoxy之后,再设置VSCode
        "http.proxy": "http://localhost:8118/",
        注:因为要跑本地服务,因此需要去掉Privoxy/config中 # forward localhost/ . 注释
        forward           localhost/     .
    • 手动安装
      • 使用go get,例如:
        go get -u github.com/gin-gonic/gin
        部分包需要科学上网,可参考前面科学上网说明
      • 不想翻墙的安装方法
        # 注意,github下golang/镜像中的包需要放到golang.org/x目录下  
        git clone https://github.com/golang/net.git $GOPATH/src/golang.org/x/net  
        git clone https://github.com/golang/sys.git $GOPATH/src/golang.org/x/sys  
        git clone https://github.com/golang/tools.git $GOPATH/src/golang.org/x/tools
  • 3.配置


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK