douchongbang6011 2016-03-24 13:00
浏览 55
已采纳

转到-我是否为所有项目都有一个工作区,或者每个项目有一个工作区?

When using Go how are projects organized? I'm a bit confused on the workspaces part. I've had a read of the following: https://golang.org/doc/code.html#Workspaces ... and this part has thrown me off a little:

A typical workspace contains many source repositories containing many packages and commands. Most Go programmers keep all their Go source code and dependencies in a single workspace.

Does this mean that for each project I create it is a seperate workspace? For example if two projects use the same package, I would have two copies of that package on my computer.

Or, does it mean you have a main workspace and your projects share those packages?

Bit confused.

  • 写回答

3条回答 默认 最新

  • dongzouhe9734 2018-02-08 15:40
    关注

    I personally like to have a different GOPATH per project. If you are fine using a tool to automate the process you can use vg which will take care of managing different GOPATHs for your projects.

    The neat bit is that it integrates with most shells and auto-detect projects as you cd them.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?