How to run/debug a beego app using Gogland (go language)

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How to run/debug a beego app using Gogland (go language)



Im using Gogland (IDE from JetBrains. Version 1.0 Preview/EAP Feb, 10 2017) to create a Beego web app.
I can run it from command line with:



bee run



and everything works.



However if I run it from the IDE with the following configuration
enter image description here



when I go to localhost:8080 it says it can not find the template file in path:



enter image description here



I thought it was related to GOPATH, but then I realized that Gogland IDE is probably running



go run main.go



instead of



bee go



and when I checked runing



go run main.go



from the shell, I got the same issue: cant find the template.



I even tried to run the 'bee' command from the IDE. I partially succeed. With this configuration:
enter image description here
I can run it from the IDE, but the debugger doesn't stop in any breakpoint. IE: I can only run (but not debug) it, from Gogland.



So my question is how to make gogland IDE debug a beego project





Maybe you can change the command when you click on the Run button, more info here, under the Running application title.
– PumpkinSeed
Feb 17 '17 at 17:57







@PumpkinSeed: yes, I tried that. Just edited my question to show my findings
– rafahoro
Feb 18 '17 at 3:28




3 Answers
3



You cannot change the IDE to run the bee command. However, you can change the run configuration to a Go Application by going to Run | Edit Configurations | + | Go Application select the package type then type the full package name (github.com/dlsniper/demo for example if your package main is under GOPATH/src/github.com/dlsniper/demo) and make sure the working directory is where you need it to be. Hope it helps.


github.com/dlsniper/demo





thanks for your answer. I'm doing what you mention: running it as Package, not as a file. The error my question is showing, happens when running as a Package. BTW: I'm editing my question to show other findings.
– rafahoro
Feb 18 '17 at 3:11





Use Delve and Remote Debugging Configuration(start from gogland eap9).



Run your bee app like:


bee dlv -package="app_name" -port=2345



On gogland make configuration Go Remote with port which you set previous.



I resolve this by setting:


beego.BConfig.WebConfig.ViewsPath="/Users/xxxxx/go/src/xxxxxxx/views" // your views directory



by the way: if you have staticpath , you should also use absolute path.
eg: beego.SetStaticPath("/static", "/Users/xxx/go/src/xxxx/static")


beego.SetStaticPath("/static", "/Users/xxx/go/src/xxxx/static")



it's only used when debug, if you publish your program, you should remove this hard code config.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

x1SjDE nnRwHfm8OvQyT,t7O,74SYpYw7MhjfkxiSGg6e35tKCnmT63Pisss,S3C9n74UH,xN
T,mugxy

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham