MAC下GO 安装环境配置

下载并安装GO安装包

打开http://golang.org 下载对应的二进制安装包

配置工作环境

mkdir -p ~/Documents/go

#把以下内容加入/etc/profile 中

export GOROOT=/usr/local/go
export GOPATH=/Users/用户名/Documents/go
export GOBIN=$GOPATH/bin
export PATH="$PATH:$GOROOT/bin:$GOPATH/bin"

#保存内容并执行以下更新环境信息

srouce /etc/profile

安装常用工具

官方

go get -u golang.org/x/tools/cmd/...
go get -u golang.org/x/tools/cmd/godoc
go get -u github.com/golang/dep/cmd/dep

mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/net.git
git clone https://github.com/golang/text.git

第三方

go get -u github.com/Masterminds/glide
go install github.com/Masterminds/glide
go get -u github.com/BurntSushi/toml
go get -u gopkg.in/yaml.v2
go get -u github.com/valyala/fasthttp
go get -u github.com/valyala/tcplisten
go get -u github.com/buaazp/fasthttprouter
go get -u github.com/ccpaging/nxlog4go
go get -u github.com/go-xorm/xorm
go get -u github.com/go-sql-driver/mysql
go get -u github.com/golang-plus/uuid
go get -u github.com/json-iterator/go
go get -u github.com/olivere/elastic
go get -u github.com/oschwald/geoip2-golang
go get -u github.com/pkg/errors
go get -u github.com/robfig/cron
go get -u github.com/seefan/gossdb
go get -u github.com/go-redis/redis
go get -u github.com/tinylib/msgp
go get -u github.com/PuerkitoBio/goquery
go get -u github.com/robertkrimen/otto
go get -u github.com/henrylee2cn/surfer
go get github.com/yanyiwu/gojieba
go get -u github.com/huichen/sego
go get -u github.com/gorilla/mux
2018/7/15 9:15 上午 posted in  Go

VsCode 环境配置

GO

先安装GO插件 Ctrl+P输入ext install Go 然后安装所需插件

go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
go get -v -u github.com/peterh/liner
go get -v -u github.com/derekparker/delve/cmd/dlv
2018/6/28 14:47 下午 posted in  Mac Go

Centos 7 安装Docker

# 初使化安装环境
yum -y install yum-utils gcc g++ kernel-devel

# 添加yum 仓库并更新
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast


# 安装并以服务方式启动docker
sudo yum -y install docker-ce
sudo systemctl enable docker
sudo systemctl start docker
2018/5/16 21:9 下午 posted in  Docker CentOs

Docker Swarm常用命令集合

# 初使化Swarm 192.168.1.1为对外IP
docker swarm init --listen-addr 192.168.1.1:2377 --advertise-addr 192.168.1.1

# 查看Worker Token
docker swarm join-token worker

# Worker加入集群 替换对应token值
docker swarm join --token \
SWMTKN-1-5eukghd8e9wby5aw8t8y4rdz425euoo8m9qgmgitpxg63ax2ol-94dvz9vrx5oai22jc3vl2eh56 \
192.168.1.1:2377

# 查看Manager Token
docker swarm join-token manager

# Manager加入集群 替换对应token值
docker swarm join --token \
SWMTKN-1-5eukghd8e9wby5aw8t8y4rdz425euoo8m9qgmgitpxg63ax2ol-94dvz9vrx5oai22jc3vl2ehed2 \
192.168.1.1:2377

# 查看集群中的节点 在Manager机器人执行
docker node ls

# 创建虚拟网络
docker network create --driver overlay --subnet 10.0.10.0/24 \
  --opt encrypted test_network
  
# Centos 7 防火墙开放端口
firewall-cmd --add-port=2376/tcp --permanent
firewall-cmd --add-port=2377/tcp --permanent
firewall-cmd --add-port=7946/tcp --permanent
firewall-cmd --add-port=7946/udp --permanent
firewall-cmd --add-port=4789/udp --permanent
sudo firewall-cmd --reload
2018/5/16 21:1 下午 posted in  Docker CentOs

MAC 软件提示已损坏,需要移到废纸篓的解决方法

移除这个应用的安全隔离属性,操作如下:
打开终端Terminal,输入以下命令后回车,如需要,请输入密码

xattr -r -d com.apple.quarantine <path>

<path>是你下载的应用程序的路径,一般在/Applications/应用程序名字
新运行下载的应用程序。

2018/5/9 22:31 下午 posted in  Mac