Skip to content

Allow running projects composed of multiple files #1520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ltzmaxwell opened this issue Apr 2, 2015 · 23 comments
Closed

Allow running projects composed of multiple files #1520

ltzmaxwell opened this issue Apr 2, 2015 · 23 comments
Assignees
Labels

Comments

@ltzmaxwell
Copy link

for instance:
I can run in terminal like this : go run test0.go test1.go
How can I run this in Idea ?

@zafayar
Copy link

zafayar commented Apr 2, 2015

This bug makes this plugin completely useless.

@zafayar
Copy link

zafayar commented Apr 2, 2015

As an addition, when I try to run the project, the command executed is:

/usr/local/go/bin/go build -o /tmp/run6go /home/niral/go/src/xxx/main.go

and because this project has more files, I get bunch of 'undefined' errors. I get the same error if I do "go build main.go".

@zolotov
Copy link
Contributor

zolotov commented Apr 2, 2015

@ltzmaxwell it's not possible via UI yet. How do you think it should looks like? You can try to configure Go Application configuration that uses go build instead.

@zafayar This bug makes this plugin completely useless.

Seriously? Running application is the only reason why you use IDE? Anyway see #1414 and #1413 discussions, you have a chance to be the first who will invent the solution and make plugin usable.

@zolotov zolotov self-assigned this Apr 2, 2015
@dlsniper
Copy link
Member

dlsniper commented Apr 2, 2015

@zolotov for running a project composed of multiple files, would it be possible to have a "Go Multiple File" runner with an interface that lets you choose which files from the project to run?

Another option would be to provide an option to allow the IDE to create a list of all files that are in the same directory as the file that contains "func main()" and invoke go tool with that list (same should happen for running _test.go files)

What do you think?

@ltzmaxwell
Copy link
Author

@zolotov How can I set go build in configuration?, in 'before launch ,go command'? It seems not work.

@dlsniper
Copy link
Member

dlsniper commented Apr 2, 2015

@ltzmaxwell Run | Edit Configurations | + | Go Application

@ltzmaxwell
Copy link
Author

@dlsniper and then?

@dlsniper
Copy link
Member

dlsniper commented Apr 2, 2015

Then you can configure the runner and that will run a go build command instead of go run

@landaire
Copy link
Contributor

landaire commented Apr 2, 2015

I'm having this issue myself. If you really want to run an application from within the IDE you can set the path to the package import path (example), hit run, you'll get an error window, continue anyways, then hit run again and all will work as expected.

@dlsniper dlsniper changed the title How can I run the whole project which contains serverl files How can I run the whole project which contains serveral files Apr 6, 2015
@kiryaka
Copy link

kiryaka commented Apr 10, 2015

@dlsniper can you please be more specific about "configure the runner and that will run a go build command instead of go run". here is the new configuration -> Go Application. What next? I'm using go build && app_name from the terminal view right now and it is annoying.

@dlsniper
Copy link
Member

@kiryaka from your screenshot I can see an error, you need to specify the main file. Also, if your project has multiple files in the main package, things won't work. See Alexanders' comment for why this is not supported (yet). We gladly welcome contributions.

@kiryaka
Copy link

kiryaka commented Apr 10, 2015

I need to do go build on the directory and then run the binary. What main.go can do with it? I can put it there. It will run it and exit with error, because the application have way more files then just main.go How to include other files?

@dlsniper
Copy link
Member

I'm really not sure what's so unclear. You cannot do that yet. The original poster asked where he can run go build, I pointed him there, there was no mention that you can run / compile multiple files.

@kiryaka
Copy link

kiryaka commented Apr 10, 2015

It's actually still unclear for me from your replies where to run "go build" on the directory. But anyhow, if the feature allowing to build and run the whole project from run configuration is not ready yet, then just consider my posts as +1 to this feature request :) Thank you.

@M-Gray
Copy link

M-Gray commented Apr 10, 2015

I've been using a "make" file for building multiple files. Make sure the working directory includes your source code. https://github.com/M-Gray/IdeaJGO/blob/master/make.go

@dlsniper dlsniper changed the title How can I run the whole project which contains serveral files Allow running projects composed of multiple files May 1, 2015
@dlsniper dlsniper added this to the x.x.x pool milestone Jun 27, 2015
@lukamicoder
Copy link

Do I understand it correctly? Currently a project like this cannot be compiled and run with this extension: https://github.com/rapidloop/rtop
LiteIDE can build and run projects like this with no problem. Isn’t it a perfectly valid way to organize code? How should then the code be organized so that this extension can build it?

@dlsniper
Copy link
Member

That's correct. Currently there's no multiple file/directory runner support in the plugins so you would have to launch the application manually from the terminal.
As for how should the code be structured? It shouldn't contain multiple go files in the same folder as main().

@dlsniper
Copy link
Member

Also, IDEA provides a builtin terminal, which isn't exactly a one button command, it will still allow users to stay within the IDE while working.

@zolotov
Copy link
Contributor

zolotov commented Sep 17, 2015

Do I understand it correctly? Currently a project like this cannot be compiled and run with this extension: https://github.com/rapidloop/rtop

@lukamicoder no, it's not correct. Besides bulitin terminal you also can just open project and invoke run action from UI, it will work.
screenshot 2015-09-17 10 54 37
screenshot 2015-09-17 10 54 51

@lukamicoder
Copy link

Awesome, thank you guys for your help!

@dlsniper
Copy link
Member

@lukamicoder no, it's not correct. Besides bulitin terminal you also can just open project and invoke run action from UI, it will work.

@zolotov I think I need to learn how to use the plugin, sorry for bad intel :D

@dlsniper
Copy link
Member

dlsniper commented Nov 4, 2015

@zolotov I think this can be closed now as go build supports running a directory. Or am I missing something in this sea of comments (in which case I vote for closing this and waiting for someone else to open a new ticket?)

@zolotov
Copy link
Contributor

zolotov commented Nov 4, 2015

@dlsniper agreed

@zolotov zolotov closed this as completed Nov 4, 2015
@dlsniper dlsniper modified the milestones: x.x.x pool, 1.0.0 Nov 21, 2015
@zolotov zolotov modified the milestones: 1.0.0, next alpha Jan 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants