Recent Posts
My First Post
Introduction This is bold text, and this is emphasized text.
Visit the Hugo website!
read more
github dnsmasq设置
github dns解析访问异常 现象 github访问时好时坏,github头像不能打开
原因 查询github解析地址是52.74.223.119时可用,13.250.177.223,13.229.188.59等地址是不可用
github头像是githubusercontent.com地址,一样解析后不能访问
解决 本机配置host 52.74.223.119 github.com www.github.com 52.74.223.119 gist.github.com 199.232.28.133 assets-cdn.github.com 199.232.28.133 raw.githubusercontent.com 199.232.28.133 gist.githubusercontent.com 199.232.28.133 cloud.githubusercontent.com 199.232.28.133 camo.githubusercontent.com 199.232.28.133 avatars0.githubusercontent.com 199.232.28.133 avatars1.githubusercontent.com 199.232.28.133 avatars2.githubusercontent.com 199.232.28.133 avatars3.githubusercontent.com 199.232.28.133 avatars4.githubusercontent.com 199.232.28.133 avatars5.githubusercontent.com 199.232.28.133 avatars6.githubusercontent.com 199.232.28.133 avatars7.githubusercontent.com 199.232.28.133 avatars8.githubusercontent.com # 13.229.188.59 github.com www.github.com # 不能访问 # 13.250.177.223 gist.github.com #不能访问 # 13.229.188.59 gist.github.com #不能访问 IP根据地区不同,访问情况也不一样,需要nslookup,dig,tracert,ping等工具测试不同的IP
使用ipconfig /flushdns刷新本地dns缓存
使用https://www.ipaddress.com查询github的IP
使用路由器dnsmasq配置解析 自定义dnsmasq
address=/.github.com/52.74.223.119 address=/www.github.com/52.74.223.119 address=/github.com/52.74.223.119 address=/.githubusercontent.com/199.232.28.133
read more
golang环境配置
golang 环境配置 下载安装 golang https://golang.google.cn/dl
GO ENV go env #查看环境变量 配置GOPROXY Go version >= 1.13 可以使用go env -w 命令设置
Goproxy.cn中国最可靠的 Go 模块代理。
https://github.com/goproxy/goproxy.cn/blob/master/README.zh-CN.md
go env -w GOPROXY=https://goproxy.cn,direct GO111MODULE环境变量 go module 依赖管理工具
golang提供了一个环境变量GO111MODULE,默认值为auto,如果当前目录里有go.mod文件,就使用go modules,否则使用旧的GOPATH和vendor机制,因为在modules机制下go get只会下载go modules,这一行为会在以后版本中成为默认值,这里我们保持auto即可,如果你想直接使用modules而不需要从GOPATH过度,那么把GO111MODULE设置为on。
在 go1.11 之前,GOPATH是GO项目必备的环境变量,用来存放Go的开发代码和第三方包代码,代码需要按照一定的目录安排。
$GOPATH目录约定有三个子目录
src存放源代码(比如:.go .c .h .s等) 按照golang默认约定,go run,go install等命令的当前工作路径(即在此路径下执行上述命令)。 pkg编译时生成的中间文件(比如:.a) golang编译包时 bin编译后生成的可执行文件(为了方便,可以把此目录加入到 $PATH 变量中,如果有多个gopath,那么使用${GOPATH//://bin:}/bin添加所有的bin目录) go1.11之后,使用go mod依赖管理,不再需要按照$GOPATH约定目录
go mod init dzq #初始化go.mod文件 go mod tidy #自动更新依赖关系 go 命令 go get go get会做两件事:
从远程下载需要用到的包 执行go install go install go install 会生成可执行文件直接放到bin目录下,当然这是有前提的 你编译的是可执行文件,如果是一个普通的包,会被编译生成到pkg目录下该文件是.
read more