Whats a good best practice with Go workspaces?

后端 未结 10 1380
南方客
南方客 2021-01-30 10:46

I\'m just getting into learning Go, and reading through existing code to learn \"how others are doing it\". In doing so, the use of a go \"workspace\", especially as it relates

10条回答
  •  遥遥无期
    2021-01-30 11:10

    If you just set GOPATH to $HOME/go or similar and start working, everything works out of the box and is really easy.

    If you make lots of GOPATHs with lots of bin dirs for lots of projects with lots of common dependencies in various states of freshness you are, as should be quite obvious, making things harder on yourself. That's just more work.

    If you find that, on occasion, you need to isolate some things, then you can make a separate GOPATH to handle that situation.

    But in general, if you find yourself doing more work, it's often because you're choosing to make things harder.

    I've got what must be approaching 100 projects I've accumulated in the last four years of go. I almost always work in GOPATH, which is $HOME/go on my computers.

提交回复
热议问题