Importing Go Projects in IntelliJ Not Working - go

I recently started out with Go programming and I wanted to checkout some open source projects. I cloned one and I wanted to get that imported into IntelliJ Community Edition 2017.1.1 but when I imported the whole project, I get strange errors. Somehow IntelliJ is not able to find the Go binaries.
Here are my settings:
joe-MacBook-Pro:go-ethereum joe$ echo $GOPATH
/Users/joe/Projects/Private/go-projects
joe-MacBook-Pro:go-ethereum joe$
Here is where Go is installed:
joe-MacBook-Pro:go-ethereum joe$ which go
/usr/local/bin/go
joe-MacBook-Pro:go-ethereum joe$
What else should I do? I'm using the Go Lang Plugin for IntelliJ version 0.171.1931
Is there anything else I should do to get this working? Here is the screenshot of the errors that I get!

Maybe this will answer your question:
Please specify a path to Go SDK in Settings/Languages &
Frameworks/Go/Go SDK See
https://github.com/go-lang-plugin-org/go-lang-idea-plugin/wiki/Documentation#setting-up-the-go-sdk
https://intellij-support.jetbrains.com/hc/en-us/community/posts/207004125--No-Go-SDK-defined-for-this-project-getting-this-message-in-WebStorm

Related

How can make my GoLand to detect dependency packages under $GOPATH/pkg/mod?

I'm trying through kubebuilder tutorial, and just imported existing project to GoLand.
Workthrough with kubebuilder auto-generated scaffold codes, and auto-downloaded pkgs with go mod for me. I had no problem when I was working with commandline environment, but turns out, after opening the project with GoLand, IDE is failing to resolve imported package names, which means it is failing to detect - or link - packages installed by go mod.
I enabled go mod(with vendoring) and dep both from IDE preferences, set GOPATH and Go runtime properly, but the error keeps to appear.
I don't know why I'm getting this error, and how to solve it.
+) Working Directory is $GOPATH/src/example, all the logics and settings are placed in the directory. Installed dependencies are placed under $GOPATH/pkg/mod.
I enabled go mod(with vendoring) and dep both from IDE preferences, set GOPATH and GOROOT properly, but the error keeps to appear.
Let's assume that you have the following setup on your machine:
Go is installed under /usr/lib/go
GOPATH is set to /home/florin/go
the KubeBuilder project named demobuilder is created under /home/florin/projects/demobuilder. I recommend this as opposed to using GOPATH, as you do, for Go Modules projects because they behave in a different way while in GOPATH.
First, make sure that you have GoLand 2019.3.1 or newer.
Then, after creating the demobuilder project, start GoLand, then click on the Open Project button.
When the project is opened, if you have not configured yet, the IDE will ask you for the Go SDK configuration, aka GOROOT. It will be a yellow bar at the top of the editor. Click on the link on the right side to configure it. You can select the local installation and point it to /usr/local/go. If you don't have Go installed, you can also download it in a directory of your choice.
Then, the IDE should automatically notice that the project is a Go Modules based project and enable the support for them. If it's not, then go to Settings/Preferences | Go | Go Modules and enable that. DO NOT enable both Go Modules and dep support at the same time. If you did that, disable the dep integration and try again.
You can see all of these in the help page.
Is Go modules integration enabled via File | Settings | Languages & Frameworks | Go | Go Modules

decoding dwarf section info at offset 0x0: too short

I am using JetBrains GoLand and I am trying to debug my go file and I am getting the following error:
decoding dwarf section info at offset 0x0: too short
I tried to find an answer here at StackOverflow but unfortunately, I didn't get any solution.
GoLand ships with a bundled version of Delve. Update to 2018.2.2 and it should work. If you need to do remote debugging, then you need to update your Delve installation on/for the target machine as well (make sure you compile it with Go 1.11).
Edit:
There are two more possible cases where this issue can appear:
the application was compiled with all the debugging flags turned off and the additional debugging information stripped
the application uses the standard library "plugin" package, which is known to cause an issue in the Go compiler. This will be fixed in Go 1.12.
I would like to share my experience here too as it may be helpful for community, I made it works by doing the following:
Update Goland to 18.3
Also, in case if you have Mac, you should run xcode-select --install
In case if you had delv already installed inside GOPATH/bin, remove it and re-install it again by following instructions here
For my Mac the problem is related to the dlv package as installed by Golang plugin.
Install delv and,
check the path of dlv as executed by IntelliJ (in the console).
Go to this directory
($HOME//Library/Application Support/IntelliJIdea2017.3/intellij-go/lib/dlv/mac)
and rename dlv to any other name. Get the right dlv executable by using
which dlv (/usr/local/Cellar/go/1.11.1/libexec/bin/dlv for my computer)
and add a symbolic link
(ln -s /usr/local/Cellar/go/1.11.1/libexec/bin/dlv dlv).
After hours of effort, I was able to find the issue. It was due to Golang Plugin which is deprecated and was not compatible with IntelliJ IDEA 2018.2.2 (Ultimate Edition).
I uninstalled the plugin and reinstall the IntelliJ.
Hope this also helps to above solutions.

IntelliJ Golang plugin not able to import default packages

I just downloaded the latest plugin for Go support in IntelliJ. I'm not able to use intellisense for Go programming because IntelliJ is not able to import packages like fmt and float64.
However, if I run the program from within IntelliJ, it works just fine!
GOROOT is usr/local/go
Project GOPATH is /Users/myname/go where the go file is.
What am I missing?
Go to Settings | Languages & Frameworks | Go | GOROOT and make sure your GOROOT is selected there. Then to the same place, but in GOPATH, make sure that's also set correctly.
Also, make sure that you follow the Go Workspace requirements.
I solved this problem by upgrading my IntelliJ IDEA to the latest.

Go build "with no buildable Go source files in" error

I tried to go build a project, however, it always encounter the following error.
Godeps/_workspace/src/github.com/gocql/gocql/helpers.go:14:2: no buildable Go source files in /home/beego/src/mixpanel/releases/20160304055749/Godeps/_workspace/src/gopkg.in/inf.v0
both gocql and inf.v0 are packages that I installed.
I am confused and I cannot find a solution. Please share some hints on it.
Thanks
1st, make sure you sourced your setup. Next, to build something make sure they are package main. If that doesn't work, go get and try again

How fix building workspace error in Zend Studio?

How to fix building workspace problem in Zend Studio?
I'm trying to rename project and rename folder of project, however nothing:
Errors occurred during the build.
Errors running builder 'JavaScript
Validator' on project 'PROJECT'.
java.lang.NullPointerException
you must go to Project->Properties->Builders then disable ‘Javascript Validator’.
The bug has been fixed, you can either wait for the new release or apply the patch :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=318004
I had similar problem and mine is that the saving workspace process try to write in one of the file and it can't even it is available under .metadata directory.
This is how I did:
Open the .metadata directory and look for that particular file, yours can be different, so
change it to read and write for this file then restart eclipse.
It fixed the problem!.
My OS: Ubuntu 10.04 , Eclipse SDK 3.5.2
Hope this help...

Resources