4

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

rafahoro
  • 1,237
  • 13
  • 19
  • Maybe you can change the command when you click on the Run button, [more info here](https://www.jetbrains.com/help/go/1.0/getting-started-with-gogland.html#changing_libraries), 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 03:28
  • @rafahoro did you manage to solve this? – lennard Aug 25 '19 at 17:16
  • @lennard I moved away from Go shortly after asking the question (and was not able to solve this by then). But please try the answers from other SO members (and upvote the right answer) – rafahoro Aug 26 '19 at 23:19

3 Answers3

1

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.

Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
r1se
  • 67
  • 1
  • 1
  • 6
0

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.

dlsniper
  • 7,188
  • 1
  • 35
  • 44
  • 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 03:11
0

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")

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

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
danny
  • 1
  • Im not currently in a Go project, so cant check (and give you points). Thank you anyway. Hopefully other SO members will check and upvote this. – rafahoro Jul 31 '18 at 12:34