I have a project to do at my job and we're using Bitbucket. So we have all our repos like this :
bitbucket.org/company/project
Nothing new here.
I have created a repository called go-tools, his module name is bitbucket.org/company/go-tools
and his path his bitbucket.org/company/go-tools
Following this medium post I could achieve a go mod tidy
package whatever
import (
"bitbucket.org/company/go-tools"
"bitbucket.org/company/go-tools/env"
// and so on ...
)
The problem occurs when I try to replace "bitbucket.org/company" by "company.com" because we would like to have our company name instead bitbucket.
So my module name become company.com/go-tools
instead of bitbucket.org/company/go-tools
And my imports become :
package whatever
import (
"company.com/go-tools"
"company.com/go-tools/env"
// and so on ...
)
I have set my GOPRIVATE to use bitbucket and configured git to use bitbucket instead of company.com
git config --global url."https://{username}:{app password}@bitbucket.com/company".insteadOf "https://company.com"
go env -w GOPRIVATE=bitbucket.org/company
And from there I only get a 404 error telling me that my package can't be found.
Did anyone have an idea why ? Am I misunderstanding something ?
NOTE : I also read this
Thanks @adrian for your reply this answer my question for at least a part. I was more looking for a way of just go get 'company.com/whatever' but this is ok.
So if I understand correctly I need to go get bitbucket.org/company/whatever
first and then go mod edit -replace bitbucket.org/company/whatever=company.com/whatever
Thanks