0

Say I wanted to integrate a go project into another repo, or wanted to develop a temporary project on my desktop. My current understanding is that in order to develop anything, it must be within my gopath.

Is this unique to Go? Is there a way to, for example, go init a folder and use that as a self contained project folder?

David Alsh
  • 6,747
  • 6
  • 34
  • 60

1 Answers1

0

As I illustrated in Automatically defining GOPATH on a per project basis, it depends on your IDE.

Visual Studio Code will detect automatically a Go project structure (myProject/src) and set a GOPATH just for that project.

See "GOPATH in the VS Code Go extension"

You would find the same feature in GoLand, the IntelliJ editor (not free).
See this thread.

  • Global GOPATH: this allows you to configure a GOPATH (which can have multiple values, of course) for all the projects you are using the IDE with. You'll configure it once and reuse it across the projects
  • Project GOPATH: has the same properties as the Global GOPATH but this one applies only to the current project. This means you can configure different GOPATH values for different projects.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250