From 69f6ec28cbc7e07fd8127e522c65ff2257c6beb7 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Thu, 19 Nov 2020 00:40:27 +0000 Subject: [PATCH] version --long displays replaced build dependencies (#7943) From: #7941 Co-authored-by: Paul Kim --- CHANGELOG.md | 2 +- version/version.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 537c79028f87..83e0e9c323e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features * (types/coin.go) [\#6755](https://github.com/cosmos/cosmos-sdk/pull/6755) Add custom regex validation for `Coin` denom by overwriting `CoinDenomRegex` when using `/types/coin.go`. -* (version) [\#7835](https://github.com/cosmos/cosmos-sdk/issues/7835) The version --long command now shows the list of build dependencies and their versioning information. +* (version) [\#7835](https://github.com/cosmos/cosmos-sdk/issues/7835) [\#7940](https://github.com/cosmos/cosmos-sdk/issues/7940) The version --long command now shows the list of build dependencies and their versioning information. ### Improvements diff --git a/version/version.go b/version/version.go index 9ce86e94c5da..de3629a8f2f4 100644 --- a/version/version.go +++ b/version/version.go @@ -90,6 +90,13 @@ type buildDep struct { *debug.Module } -func (d buildDep) String() string { return fmt.Sprintf("%s@%s", d.Path, d.Version) } +func (d buildDep) String() string { + if d.Replace != nil { + return fmt.Sprintf("%s@%s => %s@%s", d.Path, d.Version, d.Replace.Path, d.Replace.Version) + } + + return fmt.Sprintf("%s@%s", d.Path, d.Version) +} + func (d buildDep) MarshalJSON() ([]byte, error) { return json.Marshal(d.String()) } func (d buildDep) MarshalYAML() (interface{}, error) { return d.String(), nil }