Questions tagged [goland]

GoLand is an IDE by JetBrains for the Go programming language

Links:

  1. Official Site
  2. Documentation Pages
  3. Download Page
  4. The GoLand Blog
538 questions
6
votes
2 answers

Import local Go module in Goland IDE

What is proper way to import (use) go module internally? For example: creating a new module by: go mod init example.com/my-project (example.com or another domain, which doesn't exist) and using it in the same project: import ( …
Ali Mamedov
  • 5,116
  • 3
  • 33
  • 47
6
votes
5 answers

No buildable go source files after update Goland to EAP 19

After I updated GoLand from EAP 18 to EAP 19 my imports are red and these errors occur in each file: My $GOROOT and $GOPATH are the same as before. $GOROOT points to /usr/local/go. Files are buildable through shell but GoLand keep showing errors. I…
Ivan Aracki
  • 4,861
  • 11
  • 59
  • 73
5
votes
0 answers

`git log -G my-search-term` in JetBrains IDEs

How to run git log -G my-search-term in JetBrains IDEs? Of course I know how to run this command in the terminal of the IDE, but it would be great if I could use the git-integration, and the nice native GUI to browser the results (commits) of above…
guettli
  • 25,042
  • 81
  • 346
  • 663
5
votes
1 answer

Failed in error “plugin was built with a different version of package” while debugging

I built my .so file: go build -buildmode=plugin -o test.so and run debug with Goland, then I get the error: Error running agent: could not initialize input inputs.plugin_input: plugin.Open("./plugins_lib/test1"): plugin was built with a different…
hxysayhi
  • 1,888
  • 18
  • 25
5
votes
2 answers

How to run and pass a command-line-parameter to main.go in GoLand?

I am trying to run Go application with IDE GoLand by JetBrains. I just want to run the following command like this: $ go run main.go service.go Could you tell me how to configure at "Edit Configuration" panel? I tried to set "Program arguments" but…
yagu
  • 177
  • 1
  • 9
5
votes
0 answers

How to index entire GOPATH for existing project in Goland?

When I create a project, I forgot to check [index entire GOPATH]. So currently, the project can't find third party modules. Even though I checked [index entire GOPATH] option for this project in Preferences | Go | GOPATH | Project GOPATH, the…
rosshjb
  • 581
  • 1
  • 8
  • 26
5
votes
1 answer

List of functions in a file in Goland

I am using VSCODE and it has a shortcut where it displays in a popup the interfaces, functions in the file. It is fairly common to have functions in a file in Goland without any encapsulation in interface. When I press Ctrl+F12 in Goland, it does…
curiousengineer
  • 2,196
  • 5
  • 40
  • 59
5
votes
1 answer

Debug Golang code and attach it to local process

Im having a Golang code which I create from it binary for mac via go build like: build darwin amd64 myapp Currently Im able to run the binary and see the logs. Now I want to debug it , is there a way to debug the binary with Goland or Intellij or…
07_05_GuyT
  • 2,787
  • 14
  • 43
  • 88
5
votes
4 answers

GoLand IDE not correctly compiling. How to setup correct paths?

I am trying to setup GoLand correctly to be able to use it with Go. I'm trying to run the follow simple HelloWorld go project. package HelloWorldProject import "fmt" func main(){ fmt.Printf("Hello") fmt.Printf("1+1 = ", 1+1) } This is…
JeanP
  • 406
  • 9
  • 27
5
votes
1 answer

How to use profiling in Goland IDE

I press Run button to start my program work then I press button Start CPU Usage Profiling. At the end I get a file like GO-version_username_time.zip. What should I do next? How can I get a list of most expensive functions?
Kenenbek Arzymatov
  • 8,439
  • 19
  • 58
  • 109
4
votes
2 answers

Mock awsEventStream

I have a function as below, I have tried mocking the aws s3 selectobjectcontentoutput but all in vain. I have even tried s3fice which says: Package s3iface provides an interface to enable mocking the Amazon Simple Storage Service service client for…
LoganPaul
  • 59
  • 11
4
votes
2 answers

How to check if a public go function/struct is not used outside of the package?

Is there a way to check if a public function/struct is used outside of the package in which it's declared? I'm not writing a public go module that's consumed anywhere else, and simply want to scan whether func Foo() it's used anywhere in my codebase…
asaf92
  • 1,557
  • 1
  • 19
  • 30
4
votes
1 answer

Goland shows os.Remove() can't be resolved?

In Goland (2022.1.3), using go (1.19.1), it can't resolve os.Remove(), but if I change to os.RemoveAll(), it's ok. I've checked go doc and source code, the function does exists. So, what's wrong ? Is that a goland bug ? (BTW, I'm using linux os, if…
Eric
  • 22,183
  • 20
  • 145
  • 196
4
votes
0 answers

GoLand fails to update Go Modules. Go list -m -json all (pkgserver.com) fails

I am getting an error whereby any imports defined in the Go.Mod file are not being resolved. An error message stating "go list -m json all (pkgserver.com) Failed to Run" is displayed. This includes imports from our own server, and github. In the…
John
  • 81
  • 2
4
votes
1 answer

Golang Check for existing items in slice of structs

Let's say I've got the following structs: type A struct { Field1 string Field2 string } type B struct { Field3 string Field4 int } and one more struct which uses the previous two: type C struct { A MyList []B } Now, I've…
MrCujo
  • 1,218
  • 3
  • 31
  • 56