How to compile Google Go bin with IntelliJ - intellij-idea

I have started to learn Go and I have installed Go plugin on IntelliJ I have compiled and run sucessful some really simple code pieces. However I don't find any bin file in the bin folder, and the compiler runs this command to execute the app
C:/Go/bin/go.exe run E:/IntelliJ/untitled/src/myApp.go
How to get the binary of my compiled code?

You need to use go build, go run simply creates a temporary file somewhere and executes it then deletes it.

You simply need to specify output dir in your run/debug configuration like
E:\IntelliJ\untitled\.idea\output

Related

Go Project Setup Using IntelliJ

Just installed version 2016.2.5 of the Community edition of IntelliJ and then installed the Go plugin from:
https://plugins.jetbrains.com/plugin/5047
I followed the wizard for creating a new project but when I come to run a simple hello.go file I get a "Main file is invalid" in the "Run Configurations" dialog.
Does anyone know of a step by step guide to setting up and running the simplest of Go projects?
I've tried GoClipse and now IntelliJ and for both the user documentation is absoluetly crap. It's always the same: they spend ages developing this stuff and proide zero useful documentation!
Thanks
Graham
I use the plugin with WebStorm, and it is quite an improvement over previous Go IDE attempts.
The issue you run into is quite simple. The auto-generated code does not have the package set to main. For that reason, the main file is invalid. You need to manually set the package to main, and add a function called main.
My steps to ensure a working Go development environment and set up a new project are:
Install Go
Set GOROOT environment variable to Go installation, e.g. /usr/local/go
Create a go directory in your home folder, and set GOPATH to it.
Install IntelliJ + plugin
Create a new Go project in a subfolder of $GOPATH/src
Set the Go SDK in IntelliJ
Create a main .go file and make sure package name is main, and a main function exists.
Now you can create a proper Run configuration.
For me, this works quite well, including debugging and running unit tests.

How do I run a EXE Go executable from within IntelliJ IDEA?

I have a Go program which I'm working on in IntelliJ IDEA on a Windows machine. The program's structure is a little unconventional (don't want to go into detail here as its besides the point) because of which I first have to compile the program using the following command:
go build -o cli.exe
And then I can run cli.exe directly in the command prompt.
But how do I configure the run configuration in IntelliJ IDEA so that it doesn't mind running a Windows executable ? Because if I try to tell it to run an EXE file as it's run configuration, it gives me error "Main file is invalid"
How do I solve this ?
Make sure you have a file name (not a folder name) in field File on Run/Debug Configuration window (In IntelliJ IDEA go to menu Run->Edit Configuration...->your_configuration). That was my case.
You may be able to install the Bash plugin on Windows, then create a run configuration using the Bash plugin, and just run your executable from a script.
Create a Go Application run configuration and that should work. You can choose to run either a file or a package. If you would share more details then the answer would be more complete. If you still have an issue with this, please open an issue to the bug tracker and I'll be able to help out (please follow the issue template there).

Is it possible to run the MSBUILD.SONARQUBE.RUNNER on a CSProj file as opposed to a solution?

I have a TFS xaml Build template that runs the msbuild.sonarqube.runner start (and end) before and (after the) msbuild task in the xaml.
It all works well enough with a .sln file. As the file under build.
However, when I attempt to use this on a build that runs msbuild on a .csproj file the end process reports that it cannot find the postprocess exe.
"Execution failed. The specified executable does not exist: .sonarqube\bin\MSBuild.SonarQube.Internal.PostProcess.exe"
there no error indication given by the Start command.
is there something special I need to do to get this to work, or is this a limitation of the MSBuild runner?
Please help.
My whole team is keen to use the tool, but as it is only a fraction of the existing builds are being analyzed
thanks
Jeff Gedney
The begin and end commands of the SonarQube Scanner for MSBuild, as well as all msbuild commands MUST be launched from the same current working directory. Indeed, they will all need access to the .sonarqube folder that is created by the begin command.
Other than that, you can launch MSBuild on a *.csproj file instead of a *.sln if you prefer - that is supported by the SonarQube Scanner for MSBuild.
I've created the following ticket to improve the error message in case end is launched from the wrong folder: https://jira.sonarsource.com/browse/SONARMSBRU-160
Make sure you put yourself in the root folder of the project you want to analyze, then run the following commands:
a.MSBuild.SonarQube.Runner.exe begin /k:"sonarqube_project_key" /n:"sonarqube_project_name" /v:"sonarqube_project_version"
b.Build the project, for example: msbuild /t:Rebuild
c.MSBuild.SonarQube.Runner.exe end
Check:http://docs.sonarqube.org/display/PLUG/C%23+Plugin

any way to run intellij community build from altered source?

I made changes to Intellij Community Edition (ce). I can compile and run those changes from within the IntelliJ editor. That launches a second instance of IntelliJ ce which is running from classes containing my changes. What I want to do is just run those changes without having to first load the source, compile and run from within IntelliJ.
Netbeans made this easy by just producing an executable as a result of the build. With Intellij, it's not at all clear what has to be done. I have tried the following-
using the Run configuration Intellij itself uses to run the altered classes- this includes setting the working directory , main class, vm options and classpath. Actually, this doesn't work for reasons unknown to me.
on someone's suggestion, running dist.gant in build. This blows up with very many errors which are not helpful (no class def found errors which indicate some confusion on Intellij's part on classpaths somewhere)
Running WinLauncher.exe under bin gives the error message that it can't find VM options file (although it's in bin, (and also for good measure under bin/win with the other files which are co-located with vmoptions in the intellij directory structure for Intellij proper. )
ALl this is just harder than it should be. The solution is to provide an executable as a result of the build and place it in a predictable location.
Has anyone ever actually DONE what I am trying to do- make changes to the community source then use the resultant editor not as a project you're working with in IntelliJ but as the Intellij editor you're working through?
FOLLOW UP
User60561 had the correct answer. Just to mop up the details, in artifacts, there is a compressed file (win.zip for Windows, mac.zip for Mac etc.). In order to run your snapshot, you have to unzip this archive (after which it will have the same name, minus the zip extension) then go into folder "bin". There you'll see two executables: idea.exe and idea64.exe, for 32 and 64 bit versions, respectively. Clicking on these runs your snapshot.
Adjusting contents of the files idea.exe.vmoptions and idea64.exe.vmoptions lets you set the VM parameters to suit yourself, typically people might want to give the VM more memory through the -Xmx value.
It seems straightforward:
To build the distribution archive of IntelliJ IDEA Community Edition, execute build.xml Ant build script in the root directory of the source code. The results of the build execution can be found at out/artifacts.
https://github.com/JetBrains/intellij-community#building
So download ant, and run ant in the directory that you have it stored in. Make sure to use the commandline to launch ant in order to make sure everything is working correctly.
Initially execute getPlugins.bat/sh, then:
Use update.bat/sh according to it's instructions
Or
Click on: Main Menu | Build | IntelliJ IDEA CE build
Copy content of intellij-community\out\deploy (lib, plugins folder) into existing IJ installation (sometimes it is better to delete existing folders if they contain older dependencies or when the installation was of Ultimate version)

Using cmake-gui with Qt Creator

I started trying to convert a project to use CMake so that I could import the project into QtCreator to make use of the QtCreator IDE for this straight C code. This worked pretty nicely as far as giving me auto completions, code diving, etc etc.
I have had a bit of a time getting CMake to build the code as I expected, mostly because it was the first time I have been using it. I recently discovered that there is a cmake-gui that you can point at your source and it will show you the CMake variables and such. What is the proper way to actually use cmake-gui within QtCreator? When I just manually made my CMakelists.txt files within my project, it was enough to get the project in there. Should I just run Cmake-gui using locator and point it to those files? Should I keep the same build directory in cmake-gui that was created from QtCreator? Any tutorial links or guidance apprecaited - didnt find a whole lot googling.
The way I use cmake-gui with QtCreator is this:
Create a build directory and configure it with cmake-gui, like:
cmake/project$ mkdir build
cmake/project$ cd build
cmake/project/build$ cmake-gui ..
Open the CMakeLists.txt file in QtCreator, and set the build path to where you did the configuration:
Let QtCreator run the configuration by clicking "Run CMake", it will use the values you configured with cmake-gui in step 1:
You are done :)
When you need to reconfigure the CMake build, just fire up the command line, navigate to the build directory and re-run cmake-gui.