Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

goland 做网页接口的断点调试

学习go 项目,vscode对go mod的支持不稳定,语法提示时有时无,转换回了goland .习惯用断点的方式调试程序,但是不知道goland如何进行接口和网页的断点调试,网上也搜不到相应的文章.谁能指点一二,或者有相关的资料参考一下,谢谢

func main(){

http.HandleFunc("/",demo)
http.ListenAndServe(":8080",nil)

}

func demo(w http.ResponseWriter, r *http.Request) {
断点 var a=1
断点 var b=2
断点 var c=a+b

fmt.Fprintln(w,c)

}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

我不是很确定 vscode 是否是通过 dlv 来进行调试的,因为我一开始就都装过了,所以没碰到调试的问题,你可以试试看:

go get -v -u github.com/derekparker/delve/cmd/dlv

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...