refactor: migrate from go-git to go-getter #2512
Open
+487
−108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 Migration from
go-gittogo-getterThis PR migrates our codebase from go-git to go-getter for several reasons:
go-gitdoes not supportinsteadOfby default (Apply.gitconfiginsteadOf rules toRepository.clone()go-git/go-git#844)go-gitdoes not pick up SSH keys by default (ssh private key not being picked up go-git/go-git#218)As go-getter uses underlying Git, it loads all configuration by default. This is massively used by Terraform and works well.
Using
go-getterwill open the doors to supporting other remotes likeS3orGCPin the future.📌 Comparison examples:
go-gitvsgo-getter🔑 SSH usage
Detail
📌 Referencing a specific commit
Detail
🏷️ Referencing a tag
Detail
I've also added local caching to avoid cloning the same repository multiple times. For example, in a setup where a local Taskfile includes a Git-based Taskfile, which itself includes another Taskfile from the same repository, the repo used to be cloned twice. With the new caching mechanism, it's now cloned only once.