I've recently started using go and planned to use following directory structure for my code: src/mycompany.com/project
(so package name would be mycompany.com/project/component
), however during code review my coworker (who worked with go before) pointed out that it's a convention to place code in src/github.com/mycompany/project
(so package name would be github.com/mycompany/project/component
).
I can understand that this is convenient for personal projects, but it looks weird to me to have it for company projects. Why does it matter which source control website company is using? What if company will decide to move to bitbucket later on - should all projects be refactored to have package names starting with bitbucket.org
?
It is definitely possible to not use github.com
: kubernetes have package name starting with k8s.io/kubernetes
, and go book has package names which start with gopl.io
(and both use github).
Question is: are there any caveats if package name doesn't start with github.com
? E.g. maybe dep
won't work properly (go get seems to work fine
) or something else?
Also: what is the right way to have package name mycompany.com/project
and have source code hosted on github?