revel / revel.github.io

Revel manual and docs
https://revel.github.io
46 stars 155 forks source link

Dbugging in intellij #134

Open notzippy opened 7 years ago

notzippy commented 7 years ago

Add to docs from revel/revel#1072

Just for other people with the same question.

Create your project, for this example i will be using canonical "revel new github.com/myaccount/my-app" "revel run github.com/myaccount/my-app" to generate tmp/main.go - this file is needed by intellij Shutdown the running server Create project in intellij from existing sources Create run configuration and in "Program arguments" add "-importPath github.com\myaccount\my-app -srcPath \src -runMode dev" Point "File" to \src\github.com\myaccount\my-app\app\tmp\main.go In "before launch" add "Run external tool". There: Program: \bin\revel.exe Paramerets: build github.com/myaccount/my-app This works for me on Windows 8

almarto commented 6 years ago

HI @notzippy,

I'm using MAC, I have this configuration but it doesn't work. It seems like it's unable to found the 'dev' mode.

Here is the error: INFO 14:51:09 app revel.go:170: app.conf: No mode found: dev section=system

In my app.conf both modes are defined and configured (dev and prod), is it possible that I need to specify somehow within the IntelliJ run configuration the path to the config file?

lasseschmitt commented 6 years ago

@almarto did u solve the problem? I also can't get it working.

I basically followed the instruction:

  1. I have create a project called platform -> revel new platform
  2. revel run platform
  3. Created an IntelliJ project from existing source (using GoLand)
  4. Created a run Configuration

screen shot 2018-02-27 at 09 33 44

  1. Added before launch external tool screen shot 2018-02-27 at 09 43 06

Output:

Users/eikebartels/go/bin/revel build platform
~
DEBUG~ revel! http://revel.github.io
 09:46:46  revel  server.go:27: RegisterServerEngine: Registered engine   ~
section=server name=go 
DEBUG 09:46:46  revel template_engine.go:45: Registered template engine loaded         section=template go=nil LOG15_ERROR="Normalized odd number of arguments by adding nil" 
build [import path] [target path] [run mode]

Build the Revel web application named by the given import path.
This allows it to be deployed and run on a machine that lacks a Go installation.

The run mode is used to select which set of app.conf configuration should
apply and may be used to determine logic in the application itself.

Run mode defaults to "dev".

WARNING: The target path will be completely deleted, if it already exists!

For example:

    revel build github.com/revel/examples/chat /tmp/chat

Process finished with exit code 0

Debug output

/private/var/folders/r6/wfjk122d2hv88767fbydx92h0000gn/T/___Debug -importPath platform -srcPath \src -runMode dev #gosetup
DEBUG 09:46:48  revel  server.go:27: RegisterServerEngine: Registered engine   section=server name=go 
DEBUG 09:46:48  revel template_engine.go:45: Registered template engine loaded         section=template go=nil LOG15_ERROR="Normalized odd number of arguments by adding nil" 
INFO  09:46:48    app  revel.go:170: app.conf: No mode found: dev              section=system 

Process finished with exit code 1

Any idea? I think if we gonna solve the problem it will also help other :)

almarto commented 6 years ago

Hi @DrivEddy,

I'm sorry but not. I'm newly with go and I'm just using it because I wanted to learn how it works so I don't have too much time to expend looking for a solution to this problem. I don't even know if the problem is within the IntelliJ plugin or revel itself that's why I created the issue. If I have a clue about how to solve I'd create a PR but it's not the case.

If someone has a deeper knowledge of this and is able to fix it I am quite sure it will be useful to many others.

kwame998 commented 6 years ago

usage: revel build [import path] [target path] [run mode]?
Where targe path Settings?

jasacloud commented 6 years ago

up

skyzhp commented 6 years ago

Have you resolve this problem , i have the same problem when debug revel app with GoLand IDE

minicoder1024 commented 6 years ago

same question while using Mac,waiting for solve.If anyone solve it ,please answer here,thanks.

cstlex commented 5 years ago

for anyone who is still struggling with run setting on mac, you just need to change one of the setting and its all done.

in the argument of the external tool setting, its not just build actually build --run-mode=dev src//app/tmp