GoLand EAP 20: Go Build Run Configuration and Other Improvements

Hurray! A fresh GoLand EAP is now out. One of the most notable changes in this update is a new type of run configuration: Go Build. This run configuration replaces the Go Application run configuration, and it basically runs the Go build command. You can configure this run configuration for a file, package or directory:

If the build command produces a binary, the IDE will run it. Otherwise, the IDE will simply show the build output. If you don’t want to run the binary, you can uncheck the corresponding option.

We hope with this addition your workflow and build process, in general, will now be even more straightforward.

Last but not least, the Status Bar now includes a widget (on the right-hand side) for quick access to the Go settings, UI theme, keymap, plugins, etc.

In addition to these improvements, the update has some bugfixes. Please give the update a thorough try and share your feedback with us in our issue tracker!

Happy developing!

This entry was posted in EAP, New Features. Bookmark the permalink.

8 Responses to GoLand EAP 20: Go Build Run Configuration and Other Improvements

  1. Well, I did use this… now I’m using your GoLand (licensed version). I’m trying to cross-compile an app for linux while using GoLand on Windows. I set the environment variables as such, etc.; however, it seems your IDE automatically casts the -o build tag to go build and automatically generates a filename w/ an .EXE extension (again, even though it’s a built linux file). There’s GOT to be a way to override this -o flag you’re setting, or have the IDE be smart enough to know by looking at the environment flags on build what to do.

    Any advice? I COULD’VE made a script to change the name automatically after the build; however, your external tools only run BEFORE build. Again, roadblocked.

  2. Jaxon Pickett says:

    GoLand license version user here. Is there a way to create a ‘go run’ run config, or have the binary output of the ‘go build’ command removed after the run completes? Don’t want the binary checked in to source control. Of course I can delete after but I would like that automated.

    Thanks!

    • Morris Winkler says:

      Add Bash build option with:

      Script: run
      Interpreter path: /usr/local/bin/go
      Program arguments: main.go
      Working directory: /home/user/go/src/somePKG/

      Sometimes I think JetBrains uses Kotlin developers to build goland.

  3. Thanks Andrey, the new build feature is great. My question: how do build so that my executable reads from stdin? For example, I’ve configured a ‘Run Configuration’ of type ‘File’, and it successfully builds a binary named ‘tennis’. If I do the following from the shell, it’s successful:

    ./tennis < game1.txt

    However, if I fill 'Program arguments' with '< game1.txt' the executable hangs waiting to read from stdin. I know the executable is running successfully because on the first line of my code I print to stdout.

    For the moment, as a workaround I'm manually reading the file in my code. But I live in hope of a better solution.

    fmt.Println("running ok!")
    foo, _ := os.Open(game1.txt")
    var n int
    fmt.Fscan(foo, &n)
    fmt.Println("n is:", n)

  4. Chris Rizzo says:

    Where does JetBrains Goland put the binary executable that is built? It seems I can only run the program from within JetBrains, there is not binary written out to the file system, or if there is, then it is putting it in some unknown temp directory? I do not have GOBIN env set in JetBrains, but even so, the binary does not show up in the base src directory where the code is at, and it does not show up in ~/go/bin either.

  5. Yakov says:

    How can I add -I flag to the build to compile faster?
    https://ttboj.wordpress.com/2017/02/26/faster-golang-builds/

    • Florin Pățan says:

      GoLand will automatically add the -i (lower case “i”, not to be confused with lower case “L”), as you can see in the screenshot.
      However, that parameter is not really needed post-Go 1.10 as the new caching system will compile packages incrementally as they change.
      You can see what GoLand executes by expanding the “4 go setup calls” line in the Run Window and observing the go build call.
      If you do have issues with the compilation speed, please let us know more details about this and how we can reproduce them.

Leave a Reply

Your email address will not be published. Required fields are marked *