My team at work has a single directory where we put all our git repositories for all languages.
For example the directory name is “git”, and under git there are all the git repositories: “some-python-project”, “some-powershell-project”, “golang_project”, “golang_project2” etc etc…
But I see that for Go it is problematic. I understood that for Go it’s best practice to have a single directory for many projects (such that each different project is in the src file under this directory.
Am I correct? Should I put my Golang projects outside this “git” directory?
For all the Golang projects, if you’re using Go module and they are outside GOPATH, you will be fine. Project with module (go.mod file) is now the preferred method for development.
You only face case-by-case basis problem(s) if your GOPATH is pointing at the universal work directory (git). That confuses go since the “single directory” mechanism you mentioned is the old method of development. Yes, that pain you experienced is the very reason go module was released.