github.com/phillihq/vip-go-demo

开发组内部golang部署演示代码


Install
go get github.com/phillihq/vip-go-demo

Documentation

内部分享演示demo

pprof 使用

$ cd pproftest

$ go build -o pproftest pproftest.go 

$ ./pproftest --cpuprofile=pproftest.prof 

$ go tool pprof pproftest pproftest.prof 

执行后出现终端提示:

Entering interactive mode (type "help" for commands)
(pprof)

输入 web

即可在浏览器中打开pprof图

提示:

1)如果没有安装homebrew,则安装:
    $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
2)  安装libtool
    $ brew install libtool --universal
    $ sudo brew link libtool
3)  安装graphviz
    $ brew install graphviz
    $ sudo brew link graphviz

部署到docker

编写 Dockerfile

FROM golang:onbuild

EXPOSE 8080

$ sudo docker build -t vdemo .

$ sudo docker run --publish 6060:8080 --name vdemo_container --rm vdemo