go get 代理设置

第一步. 配置go get
第二步. 配置git clone
让go get用上http代理:临时使用

windows:在cmd中使用
//设置临时代理,关闭cmd取消设置
set http_proxy=http://localhost:1080
set https_proxy=http://localhost:1080
//取消代理设置
set http_proxy=
//查看代理设置
set http_proxy
linux:
export http_proxy=http://localhost:1080
export https_proxy=http://localhost:1080

然后go get就会走代理了
使用git设置代理为

git config --global https.proxy "127.0.0.1:1080"
//查看为
git config --global https.proxy

go创建静态文件访问

package main
import (
        "net/http"
)

func main() {
        http.Handle("/", http.FileServer(http.Dir("/tmp/static/")))
        http.ListenAndServe(":8080", nil)
}

你可能感兴趣的:(go)