Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use gopkg.in/yaml.v3 instead gopkg.in/yaml.v2 #4075

Merged
merged 12 commits into from
Apr 22, 2024
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ignite/config/chain/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions ignite/config/chain/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion ignite/config/chain/network/testdata/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion ignite/config/chain/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ignite/config/chain/v0/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions ignite/config/chain/v0/testdata/config.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion ignite/config/chain/v0/testdata/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion ignite/config/chain/v1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
47 changes: 23 additions & 24 deletions ignite/config/chain/v1/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -34,8 +33,8 @@ genesis:
gov:
deposit_params:
min_deposit:
- amount: "10000000"
denom: aevmos
- amount: "10000000"
denom: aevmos
mint:
params:
mint_denom: aevmos
Expand All @@ -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
53 changes: 26 additions & 27 deletions ignite/config/chain/v1/testdata/config2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
2 changes: 1 addition & 1 deletion ignite/config/chain/v1/testdata/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion ignite/config/plugins/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 9 additions & 9 deletions ignite/config/plugins/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`,
},
}
Expand Down
2 changes: 1 addition & 1 deletion ignite/config/plugins/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"path/filepath"

"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"

"github.com/ignite/cli/v29/ignite/pkg/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion ignite/pkg/cosmosgen/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions ignite/pkg/xyaml/map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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"])
}
2 changes: 1 addition & 1 deletion ignite/services/doctor/doctor_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/plugin/scaffold_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion integration/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
27 changes: 13 additions & 14 deletions integration/doctor/testdata/config-need-migrate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading
Loading