Open bap2pecs opened 3 months ago
I have this in my .bashrc that might be useful:
# only works if the git remote URL is using `ssh`
get_go_mod_version() {
# Get the current commit hash
local current_hash=$(git rev-parse HEAD)
# Get the remote origin URLa
local remote_url=$(git remote get-url origin)
# Extract the repository path from the remote URL
if [[ $remote_url == https://* ]]; then
# For HTTPS URLs
repo_path=$(echo $remote_url | sed -E 's|https://github.com/(.+)\.git|\1|')
else
# For SSH URLs
repo_path=$(echo $remote_url | sed -E 's/.*:(.+)\.git/\1/')
fi
# Construct and execute the go list command
go list -m github.com/$repo_path@$current_hash
}
example usage
git clone git@github.com:babylonlabs-io/finality-provider.git
git checkout base/consumer-chain-support
godep_nocp
then you will see
github.com/babylonlabs-io/finality-provider v0.5.1-0.20241024124619-7d341b5d02e3
now you can copy it to the go.mod file where you need to use this specific FP version
@bap2pecs cloned issue babylonchain/babylon-finality-gadget#52 on 2024-07-09: