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
文章介绍了如何创建一个基于Gin的GoWeb应用,通过示例代码展示了Gin的基本用法,如定义路由和处理HTTP请求。接着,它演示了如何安装和使用go-callvis工具来可视化Go程序的调用栈,帮助开发者更好地理解和调试代码。
1112

被折叠的 条评论
为什么被折叠?



