https://tigerb.cn/2019/07/06/go-gin/
创建一个gin-code-read的项目
cd $GOPATH/src/github.com/gin-code-read
go mod init
go get github.com/gin-gonic/gin
创建main.go
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("ping", func(ctx *gin.Context) {
ctx.JSON(200, gin.H{"message": "pong"})
})
r.Run()
}
利用go-callvis查看调用栈
安装go-callvis
go install github.com/ofabry/go-callvis
查看调用栈
go-callvis main.go
访问localhost:7878
点击gin,会跳到对应的调用栈 http://localhost:7878/?f=github.com/gin-gonic/gin