I wanted to use my forked repository not to change original package name.
In my case is that I wanted to debug authentication process for Google Cloud from AWS environment by using Workload Identity Pool.
I forked https://github.com/googleapis/google-cloud-go into https://github.com/hatajoe/google-cloud-go, but I wasn't sure how I import hatajoe/google-cloud-go without changing original package name.
Here is the answer.
In my case is that I wanted to debug authentication process for Google Cloud from AWS environment by using Workload Identity Pool.
I forked https://github.com/googleapis/google-cloud-go into https://github.com/hatajoe/google-cloud-go, but I wasn't sure how I import hatajoe/google-cloud-go without changing original package name.
Here is the answer.
- fork repository
- make some changes
- create and push tag
- go mod edit
- go mod tidy
At the first, fork repository.
Make some changes you need. This time I put some logging code on some files.
Push the branch, and create and push tag.
% git push -u origin debug % git tag auth/v0.0.1 % git push --tag
This is the point. This time I wanted to make changes in cloud.google.com/go/auth package only.
So I needed to create tag in form of auth/v0.0.1 instead of v0.0.1.
Next, edit go.mod file.
% go mod edit -replace cloud.google.com/go/auth@v0.9.1=github.com/hatajoe/cloud.google.com/go/auth@v0.0.1
Or edit go.mod yourself like following:
+replace cloud.google.com/go/auth v0.9.1 => github.com/hatajoe/google-cloud-go/auth v0.0.1
And execute go mod tidy then finished.