Skip to content
New issue

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

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

Already on GitHub? # to your account

button to only build a "Run/Debug Configuration", without actually running/debugging afterwards #2408

Open
Ashalah opened this issue Mar 22, 2016 · 15 comments
Assignees
Labels

Comments

@Ashalah
Copy link

Ashalah commented Mar 22, 2016

  • Plugin version (or commit hash): 0.11.1197
  • IDE name and version: IntelliJ IDEA 2016.1
  • Java version: 1.8.0_60-b27 x86
  • OS name and version: Windows 10 64bit
  • What are you trying to do?
    Compile a "run configuration" without starting the compiled program.
  • What would you expect to happen?
    The IDE would run the exact same build commands as when hitting the "Run" button, except it won't run the .exe after the build.
  • What happens?
    Can't do that. No such button exists in the plugin.

This should exist. Can you add a button next to the Run and Debug buttons in the toolbar? Or provide the functionality, and let users manually add the button to their toolbar?

Why this should exist: a user could open a command prompt and manually call go build, but:

  1. it's slower than clicking a button
  2. have to repeat information that's already provided to the IDE (otherwise it couldn't build during Run)
  3. if there are build errors, the user cannot click in the build output to go to the source location where the error came from

I'm not describing a "build everything" feature, I'm talking literally copy the Run button, but don't actually run, just do the build step.

@dlsniper
Copy link
Member

You can setup a ln external tool for the project and have it run commands
like go build only or go install. Does this help?

On 16:01, Tue, Mar 22, 2016 Andy Robbins notifications@github.com wrote:

  • Plugin version (or commit hash): 0.11.1197

  • IDE name and version: IntelliJ IDEA 2016.1

  • Java version: 1.8.0_60-b27 x86

    OS name and version: Windows 10 64bit

    What are you trying to do?

    Compile a "run configuration" without starting the compiled program.

    What would you expect to happen?
    The IDE would run the exact same build commands as when hitting the

    "Run" button, except it won't run the .exe after the build.

    What happens?
    Can't do that. No such button exists in the plugin.

This should exist. Can you add a button next to the Run and Debug buttons
in the toolbar? Or provide the functionality, and let users manually add
the button to their toolbar?

Why this should exist: a user could open a command prompt and manually
call go build, but:

  1. it's slower than clicking a button
  2. have to repeat information that's already provided to the IDE
    (otherwise it couldn't build during Run)
  3. if there are build errors, the user cannot click in the build output to
    go to the source location where the error came from

I'm not describing a "build everything" feature, I'm talking literally
copy the Run button, but don't actually run, just do the build step.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#2408

@Ashalah
Copy link
Author

Ashalah commented Mar 22, 2016

This would duplicate configuration. I don't have a GOPATH, I just set up the "Project libraries" in the settings, and the plugin automatically sets things up for me. No messy environment variables to deal with, so the project is self-contained. This is why I think a dedicated build button makes sense.

It's not some great burden or anything, but it is very jarring coming from something like Visual Studio, where this functionality exists. I'm sure it confuses other users too.

Would it be complicated to implement? A button isn't necessary, it could just be a menu item somewhere.

@Ashalah
Copy link
Author

Ashalah commented Mar 22, 2016

I do know that IntelliJ will point out errors in my code as I type, but just like in Visual Studio, it doesn't catch everything, and it doesn't show errors in other files.

@zolotov
Copy link
Contributor

zolotov commented Mar 22, 2016

If the result of build button should be just report about found errors then you just should use Code | Inspect Code action.

@zolotov
Copy link
Contributor

zolotov commented Mar 22, 2016

just like in Visual Studio, it doesn't catch everything

The plugin should catch everything, if it doesn't – file an issue please

@Ashalah
Copy link
Author

Ashalah commented Mar 22, 2016

The result of the build button is to invoke the compiler with the same settings and flags as when clicking Run.

Go is a compiled language. There should be a way to invoke the compiler as easy as clicking Run -- just don't force me to run the app.

I'll open a new issue.

@zolotov
Copy link
Contributor

zolotov commented Mar 22, 2016

The result of the build button is to invoke the compiler with the same settings and flags as when clicking Run.

Run is configurable, you can pass there different parameters, build tags, import paths, files, etc. What should build button do? What it should do if your project have several main files?

@Ashalah
Copy link
Author

Ashalah commented Mar 22, 2016

I'm not talking about a global "build everything" button.

When you click Run, it only affects the current selected Configuration, right? It builds what is described in the configuration (in my case, my "main" package), then starts the executable. All I want is to not be forced to start the executable just because I want to invoke the compiler for my selected configuration.

If calling it "Build" is confusing, you could call it "Prepare to Run".

You can't have two main() functions in the same package.

@zolotov
Copy link
Contributor

zolotov commented Mar 22, 2016

@Ashalah thanks, I understand what do you mean now. I think it's possible to implement Prepare to Run action.

@zolotov zolotov self-assigned this Mar 22, 2016
@Ashalah
Copy link
Author

Ashalah commented Mar 22, 2016

@zolotov awesome, glad it's clear now. I hope you can implement it, this feature makes using Go more natural for developers coming from C++/VS.

@dlsniper
Copy link
Member

@zolotov I wonder if this could be used to make the other often popular question / issue to make the Build menu to work with Go projects.

The logic would be like this

  • if the current run configuration is a Go Application run configuration and:
    • Make project and Compile should work only if the current project SDK is a Go SDK
    • Make module <name> should work only if the current module SDK is a Go SDK
  • then make enable those options
  • else don't

The logic should work for most of the projects I guess and it wouldn't interfere with the other ways those build options could run.

What do you think?

@zolotov
Copy link
Contributor

zolotov commented Mar 23, 2016

@dlsniper no, make project and compile and other action can be used in this way, it breaks other languages support

@dlsniper
Copy link
Member

Sorry, it's a bit unclear, please bare with me.
Is compile still used when the project SDK is Go? For me it's disabled right now. And if the run configuration matches a Go one that should be a good indicator that I want to compile that project (basically what the OP requested in the issue).

@zolotov
Copy link
Contributor

zolotov commented Mar 23, 2016

Existing of Go Project SDK type is the matter of time, we'll get rid of it in future.

Is compile still used when the project SDK is Go?

Sure, SDK type doesn't define compile action behaviors, there can be a plugin which compile something despite SDK type of module or project.

@juliandroid
Copy link

juliandroid commented Aug 9, 2017

I have a similar issue. I want to "build and run" and sometimes "build and deploy".
That means "build and run" on my amd64 system and "build and deploy" on other system (probably different GOOS/GOARCH).

If I do "build and deploy" on my machine while I'm building for ARM/MIPS target, then the IDE reports error (trying to start binary built for different platform).

My workaround currently is creating two build configurations:

  1. "build and run" which basically compiles and runs my application for amd64;
  2. "build and deploy" which builds again for amd64, but then call external build command (shell script) which builds again with "go build" but for my GOOS/GOARCH. The deficiency of this approach is that my "build and deploy" runs the "amd64" binary, while I actually want to build GOOS/GOARCH binary and deploy it somewhere (via the shell script).

Ideally I should be able to use current build configuration UI, but tell the IDE to not run the generated binary!
Edit: Context - Gogland IDE

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants