Go起步

2018-12-14  本文已影响16人  诺之林

准备

brew install dep

安装dep同时也会安装依赖Go

vim ~/.zshrc
# go
export GOPATH=$HOME/Workspace/go
export GOBIN=$HOME/Workspace/go/bin
export PATH=$PATH:$GOBIN
. ~/.zshrc

示例

mkdir -p ~/Workspace/go/src/gin-basic && cd ~/Workspace/go/src/gin-basic

dep init

curl https://raw.githubusercontent.com/gin-gonic/gin/master/examples/basic/main.go > main.go

dep ensure -add -v github.com/gin-gonic/gin@v1.3

go run main.go

curl localhost:8080/ping
# pong

关于Gin更多介绍可以参考gin-gonic/gin

参考

上一篇下一篇

猜你喜欢

热点阅读