英文:
Wy my GOPATH/src contains few directories just after installed?
问题
我刚刚在我的机器上安装了Golang,并设置了GOPATH。
但是当我导航到我的go/src目录时,我发现src文件夹包含./sourcegraph.com
、./golang.org
和./github.com
。此外,GOPATH/bin
和GOPATH/pkg
也不是空的。
所以我有几个问题:
1)我知道如何使用./github.com
文件夹将我的代码推送到github,但为什么它默认包含一些不属于我自己的项目,比如acroca、cweil...等等
?我可以清空这个文件夹吗?
2)我应该如何处理golang.org
文件夹,可以删除它吗?
3)我应该如何处理sourcegraph.com
文件夹,可以删除它吗?
4)我可以清空预安装的二进制文件和包的bin
和pkg
文件夹吗?
英文:
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:
-
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 asacroca, cweil ... and other
? Can I clear this folder? -
What I should do with
golang.org
folder, can I remove it ? -
What I should do with
sourcegraph.com
folder, can I remove it ? -
Can I clear
bin
andpkg
from preinstalled binaries and packages?
答案1
得分: 2
我认为你不仅安装了Golang
,还安装/配置了带有Go扩展的Visual Studio Code
IDE。当扩展安装所需的工具时,这些“外来”存储库会被创建。可以在这里找到工具的完整列表。或者可能是其他依赖于这些工具的类似IDE/扩展。
- 是的,你可以清除这些源代码,因为IDE仅依赖于编译后的二进制文件,源代码只在编译过程中需要。
- 与(1)相同。参考Golang子存储库。
- 与(1)相同。
- 目前,你可以清除
pkg
目录的内容,但不要删除该目录。将来,当你安装一些包/库时,编译版本可能会在这些目录下创建,所以不要删除它。对于bin
目录,不要删除其中的文件,因为IDE(Go扩展)依赖于它们。
但是,由于我不知道你还做了什么,我认为在完全删除它们之前,你可以尝试将它们移出你的GOPATH
或备份一下,看看你的“开发环境”是否按预期工作。
英文:
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.
- Yes you can clear the sources, since the IDE depends only on the compiled binary, and the sources are only needed during compilation.
- Same as (1). Refers to Golang SubRepositories
- Same as (1)
- 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. Forbin
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论