compiling golang using intellij is looking for wrong path of 3rd party packages - intellij-idea

I'm using IntelliJ with the go plugin to write my application.
version of Go: go version go1.7beta2 darwin/amd64
Operation system: OSX El Capitan 10.11.5
Intellij Version: 2016.1.3
Go Installation Location: /usr/local/go
Go Pkg Location ($GOPATH): /Users/ufk/projects/go
when I open terminal, browse to my application's main source file, and type go it compiles it properly without any errors.
but when I try to Run the program using Intellij, which also compiles it, i get the following error:
/usr/local/go/pkg/tool/darwin_amd64/link: cannot open file /usr/local/go/pkg/darwin_amd64/github.com/codegangsta/negroni.a: open /usr/local/go/pkg/darwin_amd64/github.com/codegangsta/negroni.a: no such file or directory
lookgs like it's looking for the negroni package in the location when I have go installed, and not where I the 3rd party packages are installed according to $GOPATH. My project is configured to use $GOPATH, and the real time error of the intellj editor doesn't complain about packages that are not installed which means that Intellij does check the $GOPATH variable.
so what am i missing ?
thanks
update
Hi :)
I noticed something new... I have 2 go projects, one of them is the JSON Api Server, and the other is for the web server.
The project that is causing issues is the Api Server.
now, the web server also uses and imports negroni, but the problem occurs only on the Api Server Project.
so I decided to go wild and delete the .idea and iml file from the Api Server, reopen it with intellij, and see what happens... welp, what happens is that now it complains about a different module.
/usr/local/go/pkg/tool/darwin_amd64/link: cannot open file /usr/local/go/pkg/darwin_amd64/github.com/jingweno/negroni-gorelic.a: open /usr/local/go/pkg/darwin_amd64/github.com/jingweno/negroni-gorelic.a: no such file or directory
the thing is.. that my web server project also uses negroni-gorelic and things are fine!
I tried downgrading go from 1.7beta2 to 1.6.2, deleting the content of the modules ($GOPATH/pkg and in src directory github.com and golang.org)
then I got all the modules again.. tried to compile with intellij and the results are the same.
so... hope this helps to further investigate the issue.

Related

impossible to install a intellij idea

I downloaded the ultimate version of IntelliJ from the official website and when I do ./idea.sh in the .. /bin directory of the file I get this error message in the terminal:
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.Error opening zip file or JAR manifest missing : /root/.jetbrains/jetbrains-agent-v3.2.0.de72.619 Error occurred during initialization of VM agent library failed to init: instrument
I don't know if I am supposed to have a .jetbrains file in my repersonel if so why I don't have it and if not how to get it?
Cordially...
What's the environment of your machine and I do not think you need to care about how to get .jetbrains manually by yourself. I've installed a IntelliJ idea on Ubuntu18.04, it works well. You can try run it as an administrative, also you can go to ./bin folder and then run ./idea.sh rather than ../bin folder
btw, as I said install, it does not indicate we need to compile it and get some executable binary file to run it. It's a green software that contains anything you need, you can run it directly
The Error opening zip file or JAR manifest missing : /root/.jetbrains/jetbrains-agent-v3.2.0.de72.619 error indicate that there is a problem with the distribution you have downloaded. It was corrupted or modified improperly.
Re-download it from https://www.jetbrains.com/idea/download and install into a new empty directory.
You can also try deleting the IDE's config and system directories.

IntelliJ 2017.1.4 - Refusing to open terminal window

I recently downloaded the latest version of IntelliJ Ultimate (at this time, it is 2017.1.4) for work.
For some reason, I cannot get it to open a new terminal window. When clicking the plus button here:
...nothing happens. Additionally, nothing shows up in the event log. I restarted IntelliJ, my computer, and did the "invalidate caches and restart" option.
Any ideas? Is there a log file I can look at?
It could be a known issue that is already fixed in 2017.2.
Another possible case is that the native terminal library fails to initialize on your system (check idea.log for exceptions). This can be caused by an antivirus or a corrupted IDE installation.
Thanks to #CrazyCoder for reminding me to check idea.log - the native terminal library, as well as other plugins, failed to initialize.
The root cause of the issue is that at my workplace, there is a security restriction to not run any executable that exists outside of C:\Program Files. As a result, IntelliJ cannot run certain plugins, jars, etc. that exist outside of that location, because it will attempt to execute them from your user directory.
To fix this, in IntelliJ, go to Help > Edit Custom Properties and point the config and system path to a known path where you can run executables, like so:
# custom IntelliJ IDEA properties
idea.config.path=C:\\Program Files\\JetBrains\\.IntelliJIdea2017.2\\config
idea.system.path=C:\\Program Files\\JetBrains\\.IntelliJIdea2017.2\\system
You will need to make sure to copy the contents of both directories to the new location. Hopefully this helps anyone else who runs into this issue.

VS Code + CMake : cmake.build not found

I have CMake working perfectly fine with Visual Studio 2015. I wanted to try VS Code with C++ and CMake extensions, but when I try to call the build command (configured to F7 by default with the CMake extension for VSCode), I only get the message:
command 'cmake.build' not found
Is it trying to tell me it can't find CMake ? Because Cmake is installed and working so... I also tried changing in the settings to the full path to cmake with no success. I installed both CMake and CMake Tools from Extensions. Also the toolbar for CMake doesn't appear on the blue VSCode toolbar as shown in CMake Tools extension doc.
Edit:
The author of that extension believes they've resolved this issue in the latest version 0.9.7.
https://github.com/vector-of-bool/vscode-cmake-tools/issues/157#issuecomment-307005140
So, I've just pushed 0.9.7:
No more dependency on twxs.cmake, so that shouldn't be causing any
issues anymore
#ytimenkov fixed some version parsing code that was
lying about what version of CMake was installed. Should fix issues
people are seeing with pre-3.7 versions.
#ytimenkov added better
errors when initialization failed. This should help create future
tickets!
As such, I'm going to close this issue and ask that anyone
with any further issues open a new ticket using the new error messages
that appear during a failed initialization.
I too had this issue and was given a solution here in my ticket.
For some people, one of their dependencies isn't getting installed correctly on our system. So you need to install another additional extension to get it to work.
It's called "CMake" or "twxs.cmake" (actual package name) and can be found here: https://marketplace.visualstudio.com/items?itemName=twxs.cmake
If it still isn't working, some have reported that they needed to uninstall both extensions then reinstall them both to get it to work--making sure to restart VSCode.
try this:
create a new copy of "mingw32-make.exe".
rename the copy to "make.exe".
restart your vscode.

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.

intellij - java: Cannot find JDK '1.7' for module

I've just installed IntelliJ on Windows 8 (and 7). I then use the 'Java Hello World' Sample as my project.
I then selected the JDK that was installed (C:\Program Files\Java\jdk1.7.0_10). Project creates successfully and I can see all the classes associated with the project etc. When I "make the project" I get the following error:
Compilation completed with 1 error and 0 warnings in 2 sec
1 error
0 warnings
java: Cannot find JDK '1.7' for module 'TEST'
No matter what I do I cannot compile any Java code under Windows8/IntelliJ
I have tried the following:
Invalidating cache.
Switching to 32bit JDK instead of 64bit
Idea64.exe instead of idea.exe
Installing 1.6 incase it was a 1.7 issue??
Changed the JAVA_HOME to point to different versions (ie currently C:\Program Files\Java\jdk1.7.0_10)
I'm lost as to why this is happening.
project structure > project > choose correct jdk
or ctrl+alt+shift+s > project> choose correct jdk
also platform settings > SDK's >and make sure 1.7 is there.
Found the root of the problem. Turns out Windows 8 under parallels shares the same Desktop as OSX. This confused IntelliJ somehow and as a result it couldn't compile properly.
In parallels by removing the "Desktop" shared under Configure this then resolves the issue.
In case you want to still share the documents & desktop, the solution is to modify the idea.properties file (for instance, under C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1\bin\idea.properties ), and change the following properties to point to different a location that is specific to the OS in which you are working:
idea.config.path=
idea.system.path=
idea.plugins.path=
idea.log.path=
I also copied the previous folder (on my computer it was under
\\psf\Home\.IntelliJIdea12
) to the new location to preserve all settings.
Update: I had the same problem after I installed IntelliJ Idea 13. I moved the .IntelliJIdea13 folder to c:\Users\costa from \\psf\Home, then I modified the C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.0\bin\idea.properties file:
idea.config.path=C:/Users/costa/.IntelliJIdea13/config
idea.system.path=C:/Users/costa/.IntelliJIdea13/system
idea.plugins.path=C:/Users/costa/.IntelliJIdea13/config/plugins
idea.log.path=C:/Users/costa/.IntelliJIdea13/system/log
I made the error while editing idea.properties to leave a whitespace at the end of my personally added idea.config.path=../.IdeaIC/config line.
This resulted exactly in the Cannot find JDK '...' for module error message.
I needed to "trim" the line manually, just deleted the whitespace, restarted IntelliJ and everything worked fine again.
I found this while scanning the idea.log file where I found java.io.FileNotFoundException: C:\Software\IntelliJ IDEA Community Edition 14.1.3\.IdeaIC\config \tasks\root.contexts.zip
In my case, Idea said "Failed to save settings" (probably due to a lot of projects being open. After that, it could not run tests with "Cannot find JDK '1.8' for module XXX" message. Idea restart solved the issue for me.
I believe this is an IntelliJ bug.
This isn't a fix, but you can work around this by going to Settings > Compiler, and disabling 'Use External Build'.
It seems that sometimes Intellij (or the user:-)) is getting confused when importing settings, especially if you change the paths where the jdk resides (for me it happened during a migration to a new Linux environment).
The only way I could correct this was to delete the user's settings folder.
In Linux :
I removed the folder (and subfolders): ~/.IntelliJIdea12/
Of course this would remove the saved settings, licenses e.t.c.