diff --git a/changelog.md b/changelog.md index ebe6166009..b39585c45a 100644 --- a/changelog.md +++ b/changelog.md @@ -24,6 +24,7 @@ - [#3976](https://github.com/ignite/cli/pull/3976) Remove error checks for Cobra command value get calls - [#4002](https://github.com/ignite/cli/pull/4002) Bump buf build - [#4008](https://github.com/ignite/cli/pull/4008) Rename `pkg/yaml` to `pkg/xyaml` +- [#4075](https://github.com/ignite/cli/pull/4075) Use `gopkg.in/yaml.v3` instead `gopkg.in/yaml.v2` ### Fixes diff --git a/go.mod b/go.mod index 5fad5e8f04..2f59580202 100644 --- a/go.mod +++ b/go.mod @@ -88,7 +88,6 @@ require ( golang.org/x/vuln v1.0.4 google.golang.org/grpc v1.62.1 google.golang.org/protobuf v1.33.0 - gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 mvdan.cc/gofumpt v0.6.0 sigs.k8s.io/yaml v1.4.0 @@ -481,6 +480,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gotest.tools/v3 v3.5.1 // indirect honnef.co/go/tools v0.4.7 // indirect mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 // indirect diff --git a/ignite/config/chain/config.go b/ignite/config/chain/config.go index 8c82569784..5810e25795 100644 --- a/ignite/config/chain/config.go +++ b/ignite/config/chain/config.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" v0 "github.com/ignite/cli/v29/ignite/config/chain/v0" v1 "github.com/ignite/cli/v29/ignite/config/chain/v1" diff --git a/ignite/config/chain/convert.go b/ignite/config/chain/convert.go index 62bb678e2f..5cd8a19ef6 100644 --- a/ignite/config/chain/convert.go +++ b/ignite/config/chain/convert.go @@ -3,7 +3,7 @@ package chain import ( "io" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/config/chain/version" ) @@ -36,5 +36,7 @@ func MigrateLatest(current io.Reader, latest io.Writer) error { return err } - return yaml.NewEncoder(latest).Encode(cfg) + encoder := yaml.NewEncoder(latest) + encoder.SetIndent(2) + return encoder.Encode(cfg) } diff --git a/ignite/config/chain/network/testdata/testdata.go b/ignite/config/chain/network/testdata/testdata.go index 3ee9bda40a..3a6a375dcc 100644 --- a/ignite/config/chain/network/testdata/testdata.go +++ b/ignite/config/chain/network/testdata/testdata.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" v1 "github.com/ignite/cli/v29/ignite/config/chain/v1" ) diff --git a/ignite/config/chain/parse.go b/ignite/config/chain/parse.go index 8683de8934..309d66eb2c 100644 --- a/ignite/config/chain/parse.go +++ b/ignite/config/chain/parse.go @@ -6,7 +6,7 @@ import ( "os" "github.com/cosmos/cosmos-sdk/types/bech32" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/config/chain/defaults" "github.com/ignite/cli/v29/ignite/config/chain/version" diff --git a/ignite/config/chain/v0/config.go b/ignite/config/chain/v0/config.go index 0a03467eaf..41ebc8a1c2 100644 --- a/ignite/config/chain/v0/config.go +++ b/ignite/config/chain/v0/config.go @@ -4,7 +4,7 @@ import ( "io" "github.com/imdario/mergo" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/config/chain/base" "github.com/ignite/cli/v29/ignite/config/chain/version" diff --git a/ignite/config/chain/v0/testdata/config.yaml b/ignite/config/chain/v0/testdata/config.yaml index 987fe43432..bfa08d44d5 100644 --- a/ignite/config/chain/v0/testdata/config.yaml +++ b/ignite/config/chain/v0/testdata/config.yaml @@ -1,16 +1,16 @@ accounts: - name: alice - coins: ["100000000uatom", "100000000000000000000aevmos"] + coins: [ "100000000uatom", "100000000000000000000aevmos" ] mnemonic: "ozone unfold device pave lemon potato omit insect column wise cover hint narrow large provide kidney episode clay notable milk mention dizzy muffin crazy" - name: bob - coins: ["5000000000000aevmos"] + coins: [ "5000000000000aevmos" ] address: "cosmos1adn9gxjmrc3hrsdx5zpc9sj2ra7kgqkmphf8yw" validator: name: alice staked: "100000000000000000000aevmos" faucet: name: bob - coins: ["10aevmos"] + coins: [ "10aevmos" ] host: 0.0.0.0:4600 port: 4600 build: diff --git a/ignite/config/chain/v0/testdata/testdata.go b/ignite/config/chain/v0/testdata/testdata.go index c96ef2c653..8403097d10 100644 --- a/ignite/config/chain/v0/testdata/testdata.go +++ b/ignite/config/chain/v0/testdata/testdata.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" v0 "github.com/ignite/cli/v29/ignite/config/chain/v0" ) diff --git a/ignite/config/chain/v1/config.go b/ignite/config/chain/v1/config.go index 4eba9daba3..cda54661b7 100644 --- a/ignite/config/chain/v1/config.go +++ b/ignite/config/chain/v1/config.go @@ -4,7 +4,7 @@ import ( "io" "github.com/imdario/mergo" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/config/chain/base" "github.com/ignite/cli/v29/ignite/config/chain/defaults" diff --git a/ignite/config/chain/v1/testdata/config.yaml b/ignite/config/chain/v1/testdata/config.yaml index 82ea30a3b8..6221affba7 100644 --- a/ignite/config/chain/v1/testdata/config.yaml +++ b/ignite/config/chain/v1/testdata/config.yaml @@ -4,23 +4,22 @@ build: proto: path: proto third_party_paths: - - third_party/proto - - proto_vendor + - third_party/proto + - proto_vendor accounts: -- name: alice - coins: - - 100000000uatom - - 100000000000000000000aevmos - mnemonic: ozone unfold device pave lemon potato omit insect column wise cover hint - narrow large provide kidney episode clay notable milk mention dizzy muffin crazy -- name: bob - coins: - - 5000000000000aevmos - address: cosmos1adn9gxjmrc3hrsdx5zpc9sj2ra7kgqkmphf8yw + - name: alice + coins: + - 100000000uatom + - 100000000000000000000aevmos + mnemonic: ozone unfold device pave lemon potato omit insect column wise cover hint narrow large provide kidney episode clay notable milk mention dizzy muffin crazy + - name: bob + coins: + - 5000000000000aevmos + address: cosmos1adn9gxjmrc3hrsdx5zpc9sj2ra7kgqkmphf8yw faucet: name: bob coins: - - 10aevmos + - 10aevmos host: 0.0.0.0:4600 port: 4600 genesis: @@ -34,8 +33,8 @@ genesis: gov: deposit_params: min_deposit: - - amount: "10000000" - denom: aevmos + - amount: "10000000" + denom: aevmos mint: params: mint_denom: aevmos @@ -44,12 +43,12 @@ genesis: bond_denom: aevmos chain_id: evmosd_9000-1 validators: -- name: alice - bonded: 100000000000000000000aevmos - app: - evm-rpc: - address: 0.0.0.0:8545 - ws-address: 0.0.0.0:8546 - client: - keyring-backend: os - home: $HOME/.evmosd + - name: alice + bonded: 100000000000000000000aevmos + app: + evm-rpc: + address: 0.0.0.0:8545 + ws-address: 0.0.0.0:8546 + client: + keyring-backend: os + home: $HOME/.evmosd diff --git a/ignite/config/chain/v1/testdata/config2.yaml b/ignite/config/chain/v1/testdata/config2.yaml index 38c2fe42c8..11afb27845 100644 --- a/ignite/config/chain/v1/testdata/config2.yaml +++ b/ignite/config/chain/v1/testdata/config2.yaml @@ -4,23 +4,22 @@ build: proto: path: proto third_party_paths: - - third_party/proto - - proto_vendor + - third_party/proto + - proto_vendor accounts: -- name: alice - coins: - - 100000000uatom - - 100000000000000000000aevmos - mnemonic: ozone unfold device pave lemon potato omit insect column wise cover hint - narrow large provide kidney episode clay notable milk mention dizzy muffin crazy -- name: bob - coins: - - 5000000000000aevmos - address: cosmos1adn9gxjmrc3hrsdx5zpc9sj2ra7kgqkmphf8yw + - name: alice + coins: + - 100000000uatom + - 100000000000000000000aevmos + mnemonic: ozone unfold device pave lemon potato omit insect column wise cover hint narrow large provide kidney episode clay notable milk mention dizzy muffin crazy + - name: bob + coins: + - 5000000000000aevmos + address: cosmos1adn9gxjmrc3hrsdx5zpc9sj2ra7kgqkmphf8yw faucet: name: bob coins: - - 10aevmos + - 10aevmos host: 0.0.0.0:4600 port: 4600 genesis: @@ -30,18 +29,18 @@ genesis: denom: aevmos chain_id: evmosd_9000-1 validators: -- name: alice - bonded: 100000000000000000000aevmos - app: - evm-rpc: - address: 0.0.0.0:8545 - ws-address: 0.0.0.0:8546 - home: $HOME/.evmosd + - name: alice + bonded: 100000000000000000000aevmos + app: + evm-rpc: + address: 0.0.0.0:8545 + ws-address: 0.0.0.0:8546 + home: $HOME/.evmosd apps: -- name: plugin1 - path: /path/to/plugin1 -- name: plugin2 - path: /path/to/plugin2 - with: - foo: bar - bar: baz + - name: plugin1 + path: /path/to/plugin1 + - name: plugin2 + path: /path/to/plugin2 + with: + foo: bar + bar: baz diff --git a/ignite/config/chain/v1/testdata/testdata.go b/ignite/config/chain/v1/testdata/testdata.go index 3ee9bda40a..3a6a375dcc 100644 --- a/ignite/config/chain/v1/testdata/testdata.go +++ b/ignite/config/chain/v1/testdata/testdata.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" v1 "github.com/ignite/cli/v29/ignite/config/chain/v1" ) diff --git a/ignite/config/plugins/config.go b/ignite/config/plugins/config.go index 296aa70d4c..860d075e7c 100644 --- a/ignite/config/plugins/config.go +++ b/ignite/config/plugins/config.go @@ -5,7 +5,7 @@ import ( "strings" "golang.org/x/exp/slices" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/pkg/errors" "github.com/ignite/cli/v29/ignite/pkg/gomodule" diff --git a/ignite/config/plugins/config_test.go b/ignite/config/plugins/config_test.go index ae9f8f0832..a2ad5809e8 100644 --- a/ignite/config/plugins/config_test.go +++ b/ignite/config/plugins/config_test.go @@ -292,15 +292,15 @@ func TestConfigSave(t *testing.T) { return cfg }, expectedContent: `apps: -- path: /path/to/plugin1 -- path: /path/to/plugin22 - with: - bar: baz - foo: bar - key: val -- path: /path/to/plugin3 - with: - key: val + - path: /path/to/plugin1 + - path: /path/to/plugin22 + with: + bar: baz + foo: bar + key: val + - path: /path/to/plugin3 + with: + key: val `, }, } diff --git a/ignite/config/plugins/parse.go b/ignite/config/plugins/parse.go index d8522a5a14..23afb624f4 100644 --- a/ignite/config/plugins/parse.go +++ b/ignite/config/plugins/parse.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/pkg/errors" ) diff --git a/ignite/pkg/cosmosgen/generate.go b/ignite/pkg/cosmosgen/generate.go index e9dc227a67..81e1ec0543 100644 --- a/ignite/pkg/cosmosgen/generate.go +++ b/ignite/pkg/cosmosgen/generate.go @@ -9,7 +9,7 @@ import ( "path/filepath" "slices" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/config/chain/defaults" "github.com/ignite/cli/v29/ignite/pkg/cache" diff --git a/ignite/pkg/xyaml/map_test.go b/ignite/pkg/xyaml/map_test.go index 8f02a68dc8..86ec3ec2a3 100644 --- a/ignite/pkg/xyaml/map_test.go +++ b/ignite/pkg/xyaml/map_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/pkg/xyaml" ) @@ -40,5 +40,5 @@ func TestUnmarshalWithNativeMapType(t *testing.T) { // Assert require.NoError(t, err) require.NotNil(t, output["foo"]) - require.IsType(t, (map[interface{}]interface{})(nil), output["foo"]) + require.IsType(t, (map[string]interface{})(nil), output["foo"]) } diff --git a/ignite/services/doctor/doctor_plugins.go b/ignite/services/doctor/doctor_plugins.go index 7a24888843..e48b70010b 100644 --- a/ignite/services/doctor/doctor_plugins.go +++ b/ignite/services/doctor/doctor_plugins.go @@ -7,7 +7,7 @@ import ( "os" "path/filepath" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/config" chainconfig "github.com/ignite/cli/v29/ignite/config/chain" diff --git a/ignite/services/plugin/scaffold_test.go b/ignite/services/plugin/scaffold_test.go index 3268fa51c6..e5dacaaae1 100644 --- a/ignite/services/plugin/scaffold_test.go +++ b/ignite/services/plugin/scaffold_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/pkg/gocmd" "github.com/ignite/cli/v29/ignite/services/plugin" diff --git a/integration/app.go b/integration/app.go index a172acd8c1..a6bcd90783 100644 --- a/integration/app.go +++ b/integration/app.go @@ -9,7 +9,7 @@ import ( "time" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" chainconfig "github.com/ignite/cli/v29/ignite/config/chain" v1 "github.com/ignite/cli/v29/ignite/config/chain/v1" diff --git a/integration/doctor/testdata/config-need-migrate.txt b/integration/doctor/testdata/config-need-migrate.txt index 8d3aae591d..e29d184340 100644 --- a/integration/doctor/testdata/config-need-migrate.txt +++ b/integration/doctor/testdata/config-need-migrate.txt @@ -36,23 +36,22 @@ build: proto: path: proto third_party_paths: - - third_party/proto - - proto_vendor + - third_party/proto + - proto_vendor accounts: -- name: alice - coins: - - 100000000uatom - - 100000000000000000000aevmos - mnemonic: ozone unfold device pave lemon potato omit insect column wise cover hint - narrow large provide kidney episode clay notable milk mention dizzy muffin crazy -- name: bob - coins: - - 5000000000000aevmos - address: cosmos1adn9gxjmrc3hrsdx5zpc9sj2ra7kgqkmphf8yw + - name: alice + coins: + - 100000000uatom + - 100000000000000000000aevmos + mnemonic: ozone unfold device pave lemon potato omit insect column wise cover hint narrow large provide kidney episode clay notable milk mention dizzy muffin crazy + - name: bob + coins: + - 5000000000000aevmos + address: cosmos1adn9gxjmrc3hrsdx5zpc9sj2ra7kgqkmphf8yw faucet: name: null coins: [] host: 0.0.0.0:4500 validators: -- name: alice - bonded: 100000000000000000000aevmos + - name: alice + bonded: 100000000000000000000aevmos diff --git a/integration/relayer/cmd_relayer_test.go b/integration/relayer/cmd_relayer_test.go index f51ee6ff45..9002c58df0 100644 --- a/integration/relayer/cmd_relayer_test.go +++ b/integration/relayer/cmd_relayer_test.go @@ -16,7 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/ignite/cli/v29/ignite/config/chain" "github.com/ignite/cli/v29/ignite/config/chain/base"