Ksoze
Ksoze

Reputation: 47

Wy my GOPATH/src contains few directories just after installed?

I've just installed Golang on my machine, and I set up GOPATH. But when I navigate to my go/src I see that src folder contains ./sourcegraph.com, ./golang.org and ./github.com. Also GOPATH/bin and GOPATH/pkg also no empty. So I have several questions:

1) I know how to use ./github.com folder for pushing my code to github, but why it contains , from box, some other not mine projects inside such as acroca, cweil ... and other ? Can I clear this folder?

2) What I should do with golang.org folder, can I remove it ?

3) What I should do with sourcegraph.com folder, can I remove it ?

4) Can I clear bin and pkg from preinstalled binaries and packages?

Upvotes: 0

Views: 673

Answers (1)

putu
putu

Reputation: 6444

I think you not only installed the Golang but also install/configure Visual Studio Code IDE with Go Extension. Those alien repositories were created when the extension installs needed tools. The full list of tools can be found here. Or probably other similar IDE/extension which depends on those tools.

  1. Yes you can clear the sources, since the IDE depends only on the compiled binary, and the sources are only needed during compilation.
  2. Same as (1). Refers to Golang SubRepositories
  3. Same as (1)
  4. For now, you can clear the content of pkg directory but don't remove the directory. In the future, when you install some packages/libraries, the compiled version may be created under the directories, so don't remove it. For bin directory, don't remove the files inside it, because the IDE (Go Extension) depends on them.

But, since I don't know exactly what else you've done, I think before you completely remove them, try just to move them outside your GOPATH or take a backup and see whether your dev environment works as expected.

Upvotes: 2

Related Questions