From 2096ad6e81fbc7c5f5575b802ffceab246a9904f Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 22 Feb 2022 19:27:32 +0300 Subject: [PATCH 1/9] *: remove io/ioutil uses Close #1764. --- cli/contract_test.go | 48 +++++++++---------- cli/dump_test.go | 15 +++--- cli/executor_test.go | 3 +- cli/flags/address_test.go | 4 +- cli/flags/fixed8_test.go | 4 +- cli/nep11_test.go | 10 ++-- cli/paramcontext/context.go | 6 +-- cli/server/dump.go | 3 +- cli/server/server_test.go | 21 ++++---- cli/server_test.go | 5 +- cli/smartcontract/generate.go | 3 +- cli/smartcontract/generate_test.go | 17 ++++--- cli/smartcontract/manifest.go | 7 ++- cli/smartcontract/smart_contract.go | 17 ++++--- cli/smartcontract/smart_contract_test.go | 7 ++- pkg/compiler/compiler.go | 16 +++---- pkg/compiler/compiler_test.go | 5 +- pkg/config/config.go | 3 +- pkg/core/block/helper_test.go | 4 +- pkg/core/interop_system_test.go | 17 ++++--- .../native/native_test/management_test.go | 10 ++-- pkg/core/native/native_test/oracle_test.go | 6 +-- pkg/core/oracle_test.go | 11 ++--- pkg/rpc/server/server_test.go | 4 +- pkg/smartcontract/parameter.go | 4 +- pkg/vm/cli/cli.go | 3 +- pkg/vm/cli/cli_test.go | 19 ++++---- pkg/vm/json_test.go | 6 +-- pkg/vm/vm.go | 3 +- pkg/wallet/regenerate_test.go | 6 +-- pkg/wallet/wallet.go | 3 +- scripts/compare-dumps/compare-dumps.go | 3 +- 32 files changed, 134 insertions(+), 159 deletions(-) diff --git a/cli/contract_test.go b/cli/contract_test.go index 6ba7be18b..82cd9d8c3 100644 --- a/cli/contract_test.go +++ b/cli/contract_test.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/hex" "encoding/json" - "io/ioutil" "os" "path/filepath" "strconv" @@ -35,12 +34,12 @@ func TestCalcHash(t *testing.T) { e := newExecutor(t, false) nefPath := "./testdata/verify.nef" - src, err := ioutil.ReadFile(nefPath) + src, err := os.ReadFile(nefPath) require.NoError(t, err) nefF, err := nef.FileFromBytes(src) require.NoError(t, err) manifestPath := "./testdata/verify.manifest.json" - manifestBytes, err := ioutil.ReadFile(manifestPath) + manifestBytes, err := os.ReadFile(manifestPath) require.NoError(t, err) manif := &manifest.Manifest{} err = json.Unmarshal(manifestBytes, manif) @@ -67,12 +66,12 @@ func TestCalcHash(t *testing.T) { }) t.Run("invalid nef file", func(t *testing.T) { p := filepath.Join(tmpDir, "neogo.calchash.verify.nef") - require.NoError(t, ioutil.WriteFile(p, src[:4], os.ModePerm)) + require.NoError(t, os.WriteFile(p, src[:4], os.ModePerm)) e.RunWithError(t, append(cmd, "--sender", sender.StringLE(), "--in", p, "--manifest", manifestPath)...) }) t.Run("invalid manifest file", func(t *testing.T) { p := filepath.Join(tmpDir, "neogo.calchash.verify.manifest.json") - require.NoError(t, ioutil.WriteFile(p, manifestBytes[:4], os.ModePerm)) + require.NoError(t, os.WriteFile(p, manifestBytes[:4], os.ModePerm)) e.RunWithError(t, append(cmd, "--sender", sender.StringLE(), "--in", nefPath, "--manifest", p)...) }) @@ -106,7 +105,7 @@ func TestContractBindings(t *testing.T) { e.Run(t, "neo-go", "contract", "init", "--name", ctrPath) srcPath := filepath.Join(ctrPath, "main.go") - require.NoError(t, ioutil.WriteFile(srcPath, []byte(`package testcontract + require.NoError(t, os.WriteFile(srcPath, []byte(`package testcontract import( alias "github.com/nspcc-dev/neo-go/pkg/interop/native/ledger" ) @@ -140,7 +139,7 @@ func Blocks() []*alias.Block { // Replace `pkg/interop` in go.mod to avoid getting an actual module version. goMod := filepath.Join(ctrPath, "go.mod") - data, err := ioutil.ReadFile(goMod) + data, err := os.ReadFile(goMod) require.NoError(t, err) i := bytes.IndexByte(data, '\n') @@ -150,7 +149,7 @@ func Blocks() []*alias.Block { require.NoError(t, err) data = append(data, "\nreplace github.com/nspcc-dev/neo-go/pkg/interop => "...) data = append(data, filepath.Join(wd, "../pkg/interop")...) - require.NoError(t, ioutil.WriteFile(goMod, data, os.ModePerm)) + require.NoError(t, os.WriteFile(goMod, data, os.ModePerm)) cmd = append(cmd, "--config", cfgPath, "--out", filepath.Join(tmpDir, "out.nef"), @@ -165,7 +164,7 @@ func Blocks() []*alias.Block { "--config", bindingsPath, "--manifest", manifestPath, "--out", outPath, "--hash", "0x0123456789987654321001234567899876543210") - bs, err := ioutil.ReadFile(outPath) + bs, err := os.ReadFile(outPath) require.NoError(t, err) require.Equal(t, `// Package testcontract contains wrappers for testcontract contract. package testcontract @@ -244,23 +243,23 @@ func TestContractInitAndCompile(t *testing.T) { e.RunWithError(t, append(cmd, "--config", cfgName)...) }) t.Run("provided corrupted config", func(t *testing.T) { - data, err := ioutil.ReadFile(cfgPath) + data, err := os.ReadFile(cfgPath) require.NoError(t, err) badCfg := filepath.Join(tmpDir, "bad.yml") - require.NoError(t, ioutil.WriteFile(badCfg, data[:len(data)-5], os.ModePerm)) + require.NoError(t, os.WriteFile(badCfg, data[:len(data)-5], os.ModePerm)) e.RunWithError(t, append(cmd, "--config", badCfg)...) }) // Replace `pkg/interop` in go.mod to avoid getting an actual module version. goMod := filepath.Join(ctrPath, "go.mod") - data, err := ioutil.ReadFile(goMod) + data, err := os.ReadFile(goMod) require.NoError(t, err) wd, err := os.Getwd() require.NoError(t, err) data = append(data, "\nreplace github.com/nspcc-dev/neo-go/pkg/interop => "...) data = append(data, filepath.Join(wd, "../pkg/interop")...) - require.NoError(t, ioutil.WriteFile(goMod, data, os.ModePerm)) + require.NoError(t, os.WriteFile(goMod, data, os.ModePerm)) cmd = append(cmd, "--config", cfgPath) e.Run(t, cmd...) @@ -481,7 +480,7 @@ func TestContractManifestGroups(t *testing.T) { }) t.Run("corrupted NEF file", func(t *testing.T) { f := filepath.Join(tmpDir, "invalid.nef") - require.NoError(t, ioutil.WriteFile(f, []byte{1, 2, 3}, os.ModePerm)) + require.NoError(t, os.WriteFile(f, []byte{1, 2, 3}, os.ModePerm)) e.RunWithError(t, "neo-go", "contract", "manifest", "add-group", "--wallet", testWalletPath, "--account", testWalletAccount, "--sender", testWalletAccount, "--nef", f) @@ -494,7 +493,7 @@ func TestContractManifestGroups(t *testing.T) { }) t.Run("corrupted manifest file", func(t *testing.T) { f := filepath.Join(tmpDir, "invalid.manifest.json") - require.NoError(t, ioutil.WriteFile(f, []byte{1, 2, 3}, os.ModePerm)) + require.NoError(t, os.WriteFile(f, []byte{1, 2, 3}, os.ModePerm)) e.RunWithError(t, "neo-go", "contract", "manifest", "add-group", "--wallet", testWalletPath, "--account", testWalletAccount, "--sender", testWalletAccount, "--nef", nefName, @@ -573,7 +572,7 @@ func TestContract_TestInvokeScript(t *testing.T) { "--in", badNef) }) t.Run("invalid nef", func(t *testing.T) { - require.NoError(t, ioutil.WriteFile(badNef, []byte("qwer"), os.ModePerm)) + require.NoError(t, os.WriteFile(badNef, []byte("qwer"), os.ModePerm)) e.RunWithError(t, "neo-go", "contract", "testinvokescript", "--rpc-endpoint", "http://"+e.RPC.Addr, "--in", badNef) @@ -689,10 +688,9 @@ func TestComlileAndInvokeFunction(t *testing.T) { e.RunWithError(t, cmd...) }) t.Run("corrupted wallet", func(t *testing.T) { - tmp, err := ioutil.TempDir("", "tmp") - require.NoError(t, err) + tmp := t.TempDir() tmpPath := filepath.Join(tmp, "wallet.json") - require.NoError(t, ioutil.WriteFile(tmpPath, []byte("{"), os.ModePerm)) + require.NoError(t, os.WriteFile(tmpPath, []byte("{"), os.ModePerm)) cmd := append(cmd, "--wallet", tmpPath, h.StringLE(), "getValue") @@ -854,9 +852,9 @@ func TestComlileAndInvokeFunction(t *testing.T) { os.Remove(manifestName) }) - rawNef, err := ioutil.ReadFile(nefName) + rawNef, err := os.ReadFile(nefName) require.NoError(t, err) - rawManifest, err := ioutil.ReadFile(manifestName) + rawManifest, err := os.ReadFile(manifestName) require.NoError(t, err) e.In.WriteString("one\r") @@ -918,7 +916,7 @@ func TestContractInspect(t *testing.T) { func TestCompileExamples(t *testing.T) { tmpDir := t.TempDir() const examplePath = "../examples" - infos, err := ioutil.ReadDir(examplePath) + infos, err := os.ReadDir(examplePath) require.NoError(t, err) // For proper nef generation. @@ -933,7 +931,7 @@ func TestCompileExamples(t *testing.T) { continue } t.Run(info.Name(), func(t *testing.T) { - infos, err := ioutil.ReadDir(filepath.Join(examplePath, info.Name())) + infos, err := os.ReadDir(filepath.Join(examplePath, info.Name())) require.NoError(t, err) require.False(t, len(infos) == 0, "detected smart contract folder with no contract in it") @@ -951,7 +949,7 @@ func TestCompileExamples(t *testing.T) { e.Run(t, opts...) if info.Name() == "storage" { - rawM, err := ioutil.ReadFile(manifestF) + rawM, err := os.ReadFile(manifestF) require.NoError(t, err) m := new(manifest.Manifest) @@ -983,7 +981,7 @@ func TestCompileExamples(t *testing.T) { }) } -func filterFilename(infos []os.FileInfo, ext string) string { +func filterFilename(infos []os.DirEntry, ext string) string { for _, info := range infos { if !info.IsDir() { name := info.Name() diff --git a/cli/dump_test.go b/cli/dump_test.go index 1d42283eb..5dd9dde74 100644 --- a/cli/dump_test.go +++ b/cli/dump_test.go @@ -1,7 +1,6 @@ package main import ( - "io/ioutil" "os" "path/filepath" "strconv" @@ -29,7 +28,7 @@ func TestDBRestoreDump(t *testing.T) { require.NoError(t, err) cfgPath := filepath.Join(tmpDir, "protocol.unit_testnet.yml") - require.NoError(t, ioutil.WriteFile(cfgPath, out, os.ModePerm)) + require.NoError(t, os.WriteFile(cfgPath, out, os.ModePerm)) // generated via `go run ./scripts/gendump/main.go --out ./cli/testdata/chain50x2.acc --blocks 50 --txs 2` const inDump = "./testdata/chain50x2.acc" @@ -61,14 +60,14 @@ func TestDBRestoreDump(t *testing.T) { t.Run("bad logger config", func(t *testing.T) { badConfigDir := t.TempDir() logfile := filepath.Join(badConfigDir, "logdir") - require.NoError(t, ioutil.WriteFile(logfile, []byte{1, 2, 3}, os.ModePerm)) + require.NoError(t, os.WriteFile(logfile, []byte{1, 2, 3}, os.ModePerm)) cfg = loadConfig(t) cfg.ApplicationConfiguration.LogPath = filepath.Join(logfile, "file.log") out, err = yaml.Marshal(cfg) require.NoError(t, err) cfgPath = filepath.Join(badConfigDir, "protocol.unit_testnet.yml") - require.NoError(t, ioutil.WriteFile(cfgPath, out, os.ModePerm)) + require.NoError(t, os.WriteFile(cfgPath, out, os.ModePerm)) e.RunWithError(t, "neo-go", "db", "dump", "--unittest", "--config-path", badConfigDir, "--out", dumpPath) @@ -76,14 +75,14 @@ func TestDBRestoreDump(t *testing.T) { t.Run("bad storage config", func(t *testing.T) { badConfigDir := t.TempDir() logfile := filepath.Join(badConfigDir, "logdir") - require.NoError(t, ioutil.WriteFile(logfile, []byte{1, 2, 3}, os.ModePerm)) + require.NoError(t, os.WriteFile(logfile, []byte{1, 2, 3}, os.ModePerm)) cfg = loadConfig(t) cfg.ApplicationConfiguration.DBConfiguration.Type = "" out, err = yaml.Marshal(cfg) require.NoError(t, err) cfgPath = filepath.Join(badConfigDir, "protocol.unit_testnet.yml") - require.NoError(t, ioutil.WriteFile(cfgPath, out, os.ModePerm)) + require.NoError(t, os.WriteFile(cfgPath, out, os.ModePerm)) e.RunWithError(t, "neo-go", "db", "dump", "--unittest", "--config-path", badConfigDir, "--out", dumpPath) @@ -98,9 +97,9 @@ func TestDBRestoreDump(t *testing.T) { e.Run(t, baseCmd...) - d1, err := ioutil.ReadFile(inDump) + d1, err := os.ReadFile(inDump) require.NoError(t, err) - d2, err := ioutil.ReadFile(dumpPath) + d2, err := os.ReadFile(dumpPath) require.NoError(t, err) require.Equal(t, d1, d2, "dumps differ") } diff --git a/cli/executor_test.go b/cli/executor_test.go index 587aba713..f4014844a 100644 --- a/cli/executor_test.go +++ b/cli/executor_test.go @@ -4,7 +4,6 @@ import ( "bytes" "errors" "io" - "io/ioutil" "math" "strings" "sync" @@ -269,7 +268,7 @@ func (e *executor) run(args ...string) error { e.Err.Reset() input.Terminal = term.NewTerminal(input.ReadWriter{ Reader: e.In, - Writer: ioutil.Discard, + Writer: io.Discard, }, "") err := e.CLI.Run(args) input.Terminal = nil diff --git a/cli/flags/address_test.go b/cli/flags/address_test.go index c990f7729..1409720b9 100644 --- a/cli/flags/address_test.go +++ b/cli/flags/address_test.go @@ -2,7 +2,7 @@ package flags import ( "flag" - "io/ioutil" + "io" "testing" "github.com/nspcc-dev/neo-go/internal/random" @@ -119,7 +119,7 @@ func TestAddressFlag_GetName(t *testing.T) { func TestAddress(t *testing.T) { f := flag.NewFlagSet("", flag.ContinueOnError) - f.SetOutput(ioutil.Discard) // don't pollute test output + f.SetOutput(io.Discard) // don't pollute test output addr := AddressFlag{Name: "addr, a"} addr.Apply(f) require.NoError(t, f.Parse([]string{"--addr", "NRHkiY2hLy5ypD32CKZtL6pNwhbFMqDEhR"})) diff --git a/cli/flags/fixed8_test.go b/cli/flags/fixed8_test.go index 3eb344504..1630696ef 100644 --- a/cli/flags/fixed8_test.go +++ b/cli/flags/fixed8_test.go @@ -2,7 +2,7 @@ package flags import ( "flag" - "io/ioutil" + "io" "testing" "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" @@ -55,7 +55,7 @@ func TestFixed8Flag_GetName(t *testing.T) { func TestFixed8(t *testing.T) { f := flag.NewFlagSet("", flag.ContinueOnError) - f.SetOutput(ioutil.Discard) // don't pollute test output + f.SetOutput(io.Discard) // don't pollute test output gas := Fixed8Flag{Name: "gas, g"} gas.Apply(f) require.NoError(t, f.Parse([]string{"--gas", "0.123"})) diff --git a/cli/nep11_test.go b/cli/nep11_test.go index a3a3125ed..17383af23 100644 --- a/cli/nep11_test.go +++ b/cli/nep11_test.go @@ -7,8 +7,8 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "math/big" + "os" "path/filepath" "strconv" "testing" @@ -104,10 +104,10 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) { tmpDir := t.TempDir() // copy wallet to temp dir in order not to overwrite the original file - bytesRead, err := ioutil.ReadFile(nftOwnerWallet) + bytesRead, err := os.ReadFile(nftOwnerWallet) require.NoError(t, err) wall := filepath.Join(tmpDir, "my_wallet.json") - err = ioutil.WriteFile(wall, bytesRead, 0755) + err = os.WriteFile(wall, bytesRead, 0755) require.NoError(t, err) // transfer funds to contract owner @@ -336,10 +336,10 @@ func TestNEP11_D_OwnerOf_BalanceOf_Transfer(t *testing.T) { tmpDir := t.TempDir() // copy wallet to temp dir in order not to overwrite the original file - bytesRead, err := ioutil.ReadFile(validatorWallet) + bytesRead, err := os.ReadFile(validatorWallet) require.NoError(t, err) wall := filepath.Join(tmpDir, "my_wallet.json") - err = ioutil.WriteFile(wall, bytesRead, 0755) + err = os.WriteFile(wall, bytesRead, 0755) require.NoError(t, err) // deploy NeoFS Object contract diff --git a/cli/paramcontext/context.go b/cli/paramcontext/context.go index 0f354427c..1b28951a4 100644 --- a/cli/paramcontext/context.go +++ b/cli/paramcontext/context.go @@ -3,7 +3,7 @@ package paramcontext import ( "encoding/json" "fmt" - "io/ioutil" + "os" "github.com/nspcc-dev/neo-go/pkg/config/netmode" "github.com/nspcc-dev/neo-go/pkg/core/transaction" @@ -36,7 +36,7 @@ func InitAndSave(net netmode.Magic, tx *transaction.Transaction, acc *wallet.Acc // Read reads parameter context from file. func Read(filename string) (*context.ParameterContext, error) { - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { return nil, fmt.Errorf("can't read input file: %w", err) } @@ -52,7 +52,7 @@ func Read(filename string) (*context.ParameterContext, error) { func Save(c *context.ParameterContext, filename string) error { if data, err := json.Marshal(c); err != nil { return fmt.Errorf("can't marshal transaction: %w", err) - } else if err := ioutil.WriteFile(filename, data, 0644); err != nil { + } else if err := os.WriteFile(filename, data, 0644); err != nil { return fmt.Errorf("can't write transaction to file: %w", err) } return nil diff --git a/cli/server/dump.go b/cli/server/dump.go index bee34cec8..762b2e636 100644 --- a/cli/server/dump.go +++ b/cli/server/dump.go @@ -3,7 +3,6 @@ package server import ( "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" @@ -63,7 +62,7 @@ func (d *dump) tryPersist(prefix string, index uint32) error { } func readFile(path string) (*dump, error) { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { return nil, err } diff --git a/cli/server/server_test.go b/cli/server/server_test.go index 88909d864..4c62ac37c 100644 --- a/cli/server/server_test.go +++ b/cli/server/server_test.go @@ -3,7 +3,6 @@ package server import ( "encoding/binary" "flag" - "io/ioutil" "os" "path/filepath" "testing" @@ -46,7 +45,7 @@ func TestHandleLoggingParams(t *testing.T) { t.Run("logdir is a file", func(t *testing.T) { logfile := filepath.Join(d, "logdir") - require.NoError(t, ioutil.WriteFile(logfile, []byte{1, 2, 3}, os.ModePerm)) + require.NoError(t, os.WriteFile(logfile, []byte{1, 2, 3}, os.ModePerm)) set := flag.NewFlagSet("flagSet", flag.ExitOnError) ctx := cli.NewContext(cli.NewApp(), set, nil) cfg := config.ApplicationConfiguration{ @@ -196,7 +195,7 @@ func TestRestoreDB(t *testing.T) { t.Run("invalid logger path", func(t *testing.T) { badCfgDir := t.TempDir() logfile := filepath.Join(badCfgDir, "logdir") - require.NoError(t, ioutil.WriteFile(logfile, []byte{1, 2, 3}, os.ModePerm)) + require.NoError(t, os.WriteFile(logfile, []byte{1, 2, 3}, os.ModePerm)) cfg, err := config.LoadFile(filepath.Join(goodCfg, "protocol.privnet.yml")) require.NoError(t, err, "could not load config") cfg.ApplicationConfiguration.LogPath = filepath.Join(logfile, "file.log") @@ -204,7 +203,7 @@ func TestRestoreDB(t *testing.T) { require.NoError(t, err) badCfgPath := filepath.Join(badCfgDir, "protocol.privnet.yml") - require.NoError(t, ioutil.WriteFile(badCfgPath, out, os.ModePerm)) + require.NoError(t, os.WriteFile(badCfgPath, out, os.ModePerm)) *cfgPath = badCfgDir require.Error(t, restoreDB(ctx)) @@ -220,7 +219,7 @@ func TestRestoreDB(t *testing.T) { require.NoError(t, err) badCfgPath := filepath.Join(badCfgDir, "protocol.privnet.yml") - require.NoError(t, ioutil.WriteFile(badCfgPath, out, os.ModePerm)) + require.NoError(t, os.WriteFile(badCfgPath, out, os.ModePerm)) *cfgPath = badCfgDir require.Error(t, restoreDB(ctx)) @@ -238,7 +237,7 @@ func TestRestoreDB(t *testing.T) { }) t.Run("corrupted in: invalid block count", func(t *testing.T) { inPath := filepath.Join(t.TempDir(), "file3.acc") - require.NoError(t, ioutil.WriteFile(inPath, []byte{1, 2, 3}, // file is expected to start from uint32 + require.NoError(t, os.WriteFile(inPath, []byte{1, 2, 3}, // file is expected to start from uint32 os.ModePerm)) *in = inPath require.Error(t, restoreDB(ctx)) @@ -247,10 +246,10 @@ func TestRestoreDB(t *testing.T) { }) t.Run("corrupted in: corrupted block", func(t *testing.T) { inPath := filepath.Join(t.TempDir(), "file3.acc") - b, err := ioutil.ReadFile(testDump) + b, err := os.ReadFile(testDump) require.NoError(t, err) b[5] = 0xff // file is expected to start from uint32 (4 bytes) followed by the first block, so corrupt the first block bytes - require.NoError(t, ioutil.WriteFile(inPath, b, os.ModePerm)) + require.NoError(t, os.WriteFile(inPath, b, os.ModePerm)) *in = inPath require.Error(t, restoreDB(ctx)) @@ -258,12 +257,12 @@ func TestRestoreDB(t *testing.T) { }) t.Run("incremental dump", func(t *testing.T) { inPath := filepath.Join(t.TempDir(), "file1_incremental.acc") - b, err := ioutil.ReadFile(testDump) + b, err := os.ReadFile(testDump) require.NoError(t, err) start := make([]byte, 4) t.Run("good", func(t *testing.T) { binary.LittleEndian.PutUint32(start, 1) // start from the first block - require.NoError(t, ioutil.WriteFile(inPath, append(start, b...), + require.NoError(t, os.WriteFile(inPath, append(start, b...), os.ModePerm)) *in = inPath *incremental = true @@ -272,7 +271,7 @@ func TestRestoreDB(t *testing.T) { }) t.Run("dump is too high", func(t *testing.T) { binary.LittleEndian.PutUint32(start, 2) // start from the second block - require.NoError(t, ioutil.WriteFile(inPath, append(start, b...), + require.NoError(t, os.WriteFile(inPath, append(start, b...), os.ModePerm)) *in = inPath *incremental = true diff --git a/cli/server_test.go b/cli/server_test.go index 6b6415e01..5aa28d59a 100644 --- a/cli/server_test.go +++ b/cli/server_test.go @@ -2,7 +2,6 @@ package main import ( "io" - "io/ioutil" "os" "path/filepath" "runtime" @@ -31,7 +30,7 @@ func TestServerStart(t *testing.T) { require.NoError(t, err) cfgPath := filepath.Join(tmpDir, "protocol.unit_testnet.yml") - require.NoError(t, ioutil.WriteFile(cfgPath, out, os.ModePerm)) + require.NoError(t, os.WriteFile(cfgPath, out, os.ModePerm)) t.Cleanup(func() { require.NoError(t, os.Remove(cfgPath)) }) @@ -47,7 +46,7 @@ func TestServerStart(t *testing.T) { t.Run("bad logger config", func(t *testing.T) { badConfigDir := t.TempDir() logfile := filepath.Join(badConfigDir, "logdir") - require.NoError(t, ioutil.WriteFile(logfile, []byte{1, 2, 3}, os.ModePerm)) + require.NoError(t, os.WriteFile(logfile, []byte{1, 2, 3}, os.ModePerm)) saveCfg(t, func(cfg *config.Config) { cfg.ApplicationConfiguration.LogPath = filepath.Join(logfile, "file.log") }) diff --git a/cli/smartcontract/generate.go b/cli/smartcontract/generate.go index 7c9d3e493..2f166b6f1 100644 --- a/cli/smartcontract/generate.go +++ b/cli/smartcontract/generate.go @@ -2,7 +2,6 @@ package smartcontract import ( "fmt" - "io/ioutil" "os" "strings" @@ -47,7 +46,7 @@ func contractGenerateWrapper(ctx *cli.Context) error { cfg := binding.NewConfig() if cfgPath := ctx.String("config"); cfgPath != "" { - bs, err := ioutil.ReadFile(cfgPath) + bs, err := os.ReadFile(cfgPath) if err != nil { return cli.NewExitError(fmt.Errorf("can't read config file: %w", err), 1) } diff --git a/cli/smartcontract/generate_test.go b/cli/smartcontract/generate_test.go index 28e04c624..64629c695 100644 --- a/cli/smartcontract/generate_test.go +++ b/cli/smartcontract/generate_test.go @@ -2,7 +2,6 @@ package smartcontract import ( "encoding/json" - "io/ioutil" "os" "path/filepath" "strings" @@ -115,7 +114,7 @@ func TestGenerate(t *testing.T) { rawManifest, err := json.Marshal(m) require.NoError(t, err) - require.NoError(t, ioutil.WriteFile(manifestFile, rawManifest, os.ModePerm)) + require.NoError(t, os.WriteFile(manifestFile, rawManifest, os.ModePerm)) h := util.Uint160{ 0x04, 0x08, 0x15, 0x16, 0x23, 0x42, 0x43, 0x44, 0x00, 0x01, @@ -139,7 +138,7 @@ callflags: doSomething: ReadStates ` cfgPath := filepath.Join(t.TempDir(), "binding.yml") - require.NoError(t, ioutil.WriteFile(cfgPath, []byte(rawCfg), os.ModePerm)) + require.NoError(t, os.WriteFile(cfgPath, []byte(rawCfg), os.ModePerm)) require.NoError(t, app.Run([]string{"", "generate-wrapper", "--manifest", manifestFile, @@ -225,7 +224,7 @@ func MyFunc(in map[int]mycontract.Input) []mycontract.Output { } ` - data, err := ioutil.ReadFile(outFile) + data, err := os.ReadFile(outFile) require.NoError(t, err) require.Equal(t, expected, string(data)) } @@ -245,7 +244,7 @@ func TestGenerateValidPackageName(t *testing.T) { rawManifest, err := json.Marshal(m) require.NoError(t, err) - require.NoError(t, ioutil.WriteFile(manifestFile, rawManifest, os.ModePerm)) + require.NoError(t, os.WriteFile(manifestFile, rawManifest, os.ModePerm)) h := util.Uint160{ 0x04, 0x08, 0x15, 0x16, 0x23, 0x42, 0x43, 0x44, 0x00, 0x01, @@ -259,7 +258,7 @@ func TestGenerateValidPackageName(t *testing.T) { "--hash", "0x" + h.StringLE(), })) - data, err := ioutil.ReadFile(outFile) + data, err := os.ReadFile(outFile) require.NoError(t, err) require.Equal(t, `// Package myspacecontract contains wrappers for My space contract contract. package myspacecontract @@ -297,7 +296,7 @@ func TestGenerate_Errors(t *testing.T) { }) t.Run("invalid manifest", func(t *testing.T) { manifestFile := filepath.Join(t.TempDir(), "invalid.json") - require.NoError(t, ioutil.WriteFile(manifestFile, []byte("[]"), os.ModePerm)) + require.NoError(t, os.WriteFile(manifestFile, []byte("[]"), os.ModePerm)) checkError(t, "", "--manifest", manifestFile) }) @@ -305,7 +304,7 @@ func TestGenerate_Errors(t *testing.T) { m := manifest.NewManifest("MyContract") rawManifest, err := json.Marshal(m) require.NoError(t, err) - require.NoError(t, ioutil.WriteFile(manifestFile, rawManifest, os.ModePerm)) + require.NoError(t, os.WriteFile(manifestFile, rawManifest, os.ModePerm)) t.Run("invalid hash", func(t *testing.T) { checkError(t, "invalid contract hash", "--manifest", manifestFile, "--hash", "xxx") @@ -321,7 +320,7 @@ callflags: someFunc: ReadSometimes ` cfgPath := filepath.Join(t.TempDir(), "binding.yml") - require.NoError(t, ioutil.WriteFile(cfgPath, []byte(rawCfg), os.ModePerm)) + require.NoError(t, os.WriteFile(cfgPath, []byte(rawCfg), os.ModePerm)) checkError(t, "can't parse config file", "--manifest", manifestFile, "--hash", util.Uint160{}.StringLE(), diff --git a/cli/smartcontract/manifest.go b/cli/smartcontract/manifest.go index db315285a..20fa640b3 100644 --- a/cli/smartcontract/manifest.go +++ b/cli/smartcontract/manifest.go @@ -4,7 +4,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "os" "github.com/nspcc-dev/neo-go/cli/flags" @@ -78,7 +77,7 @@ func manifestAddGroup(ctx *cli.Context) error { return cli.NewExitError(fmt.Errorf("can't marshal manifest: %w", err), 1) } - err = ioutil.WriteFile(mPath, rawM, os.ModePerm) + err = os.WriteFile(mPath, rawM, os.ModePerm) if err != nil { return cli.NewExitError(fmt.Errorf("can't write manifest file: %w", err), 1) } @@ -90,7 +89,7 @@ func readNEFFile(filename string) (*nef.File, []byte, error) { return nil, nil, errors.New("no nef file was provided") } - f, err := ioutil.ReadFile(filename) + f, err := os.ReadFile(filename) if err != nil { return nil, nil, err } @@ -108,7 +107,7 @@ func readManifest(filename string) (*manifest.Manifest, []byte, error) { return nil, nil, errNoManifestFile } - manifestBytes, err := ioutil.ReadFile(filename) + manifestBytes, err := os.ReadFile(filename) if err != nil { return nil, nil, err } diff --git a/cli/smartcontract/smart_contract.go b/cli/smartcontract/smart_contract.go index 6bd34b6df..558fa4ceb 100644 --- a/cli/smartcontract/smart_contract.go +++ b/cli/smartcontract/smart_contract.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -455,7 +454,7 @@ func initSmartContract(ctx *cli.Context) error { if err != nil { return cli.NewExitError(err, 1) } - if err := ioutil.WriteFile(filepath.Join(basePath, "neo-go.yml"), b, 0644); err != nil { + if err := os.WriteFile(filepath.Join(basePath, "neo-go.yml"), b, 0644); err != nil { return cli.NewExitError(err, 1) } @@ -468,12 +467,12 @@ func initSmartContract(ctx *cli.Context) error { require ( github.com/nspcc-dev/neo-go/pkg/interop ` + ver + ` )`) - if err := ioutil.WriteFile(filepath.Join(basePath, "go.mod"), gm, 0644); err != nil { + if err := os.WriteFile(filepath.Join(basePath, "go.mod"), gm, 0644); err != nil { return cli.NewExitError(err, 1) } data := []byte(fmt.Sprintf(smartContractTmpl, contractName)) - if err := ioutil.WriteFile(filepath.Join(basePath, fileName), data, 0644); err != nil { + if err := os.WriteFile(filepath.Join(basePath, fileName), data, 0644); err != nil { return cli.NewExitError(err, 1) } @@ -548,7 +547,7 @@ func calcHash(ctx *cli.Context) error { if mpath == "" { return cli.NewExitError(errors.New("no manifest file provided"), 1) } - f, err := ioutil.ReadFile(p) + f, err := os.ReadFile(p) if err != nil { return cli.NewExitError(fmt.Errorf("can't read .nef file: %w", err), 1) } @@ -556,7 +555,7 @@ func calcHash(ctx *cli.Context) error { if err != nil { return cli.NewExitError(fmt.Errorf("can't unmarshal .nef file: %w", err), 1) } - manifestBytes, err := ioutil.ReadFile(mpath) + manifestBytes, err := os.ReadFile(mpath) if err != nil { return cli.NewExitError(fmt.Errorf("failed to read manifest file: %w", err), 1) } @@ -734,7 +733,7 @@ func testInvokeScript(ctx *cli.Context) error { return cli.NewExitError(errNoInput, 1) } - b, err := ioutil.ReadFile(src) + b, err := os.ReadFile(src) if err != nil { return cli.NewExitError(err, 1) } @@ -798,7 +797,7 @@ func inspect(ctx *cli.Context) error { return cli.NewExitError(fmt.Errorf("failed to compile: %w", err), 1) } } else { - f, err := ioutil.ReadFile(in) + f, err := os.ReadFile(in) if err != nil { return cli.NewExitError(fmt.Errorf("failed to read .nef file: %w", err), 1) } @@ -935,7 +934,7 @@ func contractDeploy(ctx *cli.Context) error { // ParseContractConfig reads contract configuration file (.yaml) and returns unmarshalled ProjectConfig. func ParseContractConfig(confFile string) (ProjectConfig, error) { conf := ProjectConfig{} - confBytes, err := ioutil.ReadFile(confFile) + confBytes, err := os.ReadFile(confFile) if err != nil { return conf, cli.NewExitError(err, 1) } diff --git a/cli/smartcontract/smart_contract_test.go b/cli/smartcontract/smart_contract_test.go index 0bd923d92..0c4011174 100644 --- a/cli/smartcontract/smart_contract_test.go +++ b/cli/smartcontract/smart_contract_test.go @@ -3,7 +3,6 @@ package smartcontract import ( "encoding/hex" "flag" - "io/ioutil" "os" "testing" @@ -31,13 +30,13 @@ func TestInitSmartContract(t *testing.T) { dirInfo, err := os.Stat(contractName) require.NoError(t, err) require.True(t, dirInfo.IsDir()) - files, err := ioutil.ReadDir(contractName) + files, err := os.ReadDir(contractName) require.NoError(t, err) require.Equal(t, 3, len(files)) require.Equal(t, "go.mod", files[0].Name()) require.Equal(t, "main.go", files[1].Name()) require.Equal(t, "neo-go.yml", files[2].Name()) - main, err := ioutil.ReadFile(contractName + "/" + files[1].Name()) + main, err := os.ReadFile(contractName + "/" + files[1].Name()) require.NoError(t, err) require.Equal(t, `package `+contractName+` @@ -56,7 +55,7 @@ func RuntimeNotify(args []interface{}) { runtime.Notify(notificationName, args) }`, string(main)) - manifest, err := ioutil.ReadFile(contractName + "/" + files[2].Name()) + manifest, err := os.ReadFile(contractName + "/" + files[2].Name()) require.NoError(t, err) require.Equal(t, `name: testContract diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index ff8e664c9..8bdfac375 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -9,7 +9,6 @@ import ( "go/token" "go/types" "io" - "io/ioutil" "os" "path/filepath" "runtime" @@ -156,7 +155,7 @@ func getBuildInfo(name string, src interface{}) (*buildInfo, error) { case string: buf = []byte(s) case io.Reader: - buf, err = ioutil.ReadAll(s) + buf, err = io.ReadAll(s) if err != nil { return nil, err } @@ -164,10 +163,7 @@ func getBuildInfo(name string, src interface{}) (*buildInfo, error) { panic(fmt.Sprintf("unsupported src type: %T", s)) } if strings.HasPrefix(runtime.Version(), "go1.15") { - dir, err = ioutil.TempDir("", "*") - if err != nil { - return nil, err - } + dir = os.TempDir() name = filepath.Join(dir, filepath.Base(name)) absName = name names = append(names, "file="+name) @@ -259,7 +255,7 @@ func CompileAndSave(src string, o *Options) ([]byte, error) { return nil, fmt.Errorf("error while serializing .nef file: %w", err) } out := fmt.Sprintf("%s.%s", o.Outfile, o.Ext) - err = ioutil.WriteFile(out, bytes, os.ModePerm) + err = os.WriteFile(out, bytes, os.ModePerm) if err != nil { return f.Script, err } @@ -289,7 +285,7 @@ func CompileAndSave(src string, o *Options) ([]byte, error) { if err != nil { return f.Script, err } - if err := ioutil.WriteFile(o.DebugInfo, data, os.ModePerm); err != nil { + if err := os.WriteFile(o.DebugInfo, data, os.ModePerm); err != nil { return f.Script, err } } @@ -311,7 +307,7 @@ func CompileAndSave(src string, o *Options) ([]byte, error) { if err != nil { return nil, fmt.Errorf("can't marshal bindings configuration: %w", err) } - err = ioutil.WriteFile(o.BindingsFile, data, os.ModePerm) + err = os.WriteFile(o.BindingsFile, data, os.ModePerm) if err != nil { return nil, fmt.Errorf("can't write bindings configuration: %w", err) } @@ -326,7 +322,7 @@ func CompileAndSave(src string, o *Options) ([]byte, error) { if err != nil { return f.Script, fmt.Errorf("failed to marshal manifest to JSON: %w", err) } - return f.Script, ioutil.WriteFile(o.ManifestFile, mData, os.ModePerm) + return f.Script, os.WriteFile(o.ManifestFile, mData, os.ModePerm) } return f.Script, nil diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go index 32b242adc..2390652b0 100644 --- a/pkg/compiler/compiler_test.go +++ b/pkg/compiler/compiler_test.go @@ -2,7 +2,6 @@ package compiler_test import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -49,7 +48,7 @@ func TestCompiler(t *testing.T) { { name: "TestCompile", function: func(t *testing.T) { - infos, err := ioutil.ReadDir(examplePath) + infos, err := os.ReadDir(examplePath) require.NoError(t, err) for _, info := range infos { if !info.IsDir() { @@ -66,7 +65,7 @@ func TestCompiler(t *testing.T) { { name: "TestCompileAndSave", function: func(t *testing.T) { - infos, err := ioutil.ReadDir(exampleCompilePath) + infos, err := os.ReadDir(exampleCompilePath) require.NoError(t, err) err = os.MkdirAll(exampleSavePath, os.ModePerm) require.NoError(t, err) diff --git a/pkg/config/config.go b/pkg/config/config.go index 0186b4dc4..73d7f9ff8 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -2,7 +2,6 @@ package config import ( "fmt" - "io/ioutil" "os" "github.com/nspcc-dev/neo-go/pkg/config/netmode" @@ -40,7 +39,7 @@ func LoadFile(configPath string) (Config, error) { return Config{}, fmt.Errorf("config '%s' doesn't exist", configPath) } - configData, err := ioutil.ReadFile(configPath) + configData, err := os.ReadFile(configPath) if err != nil { return Config{}, fmt.Errorf("unable to read config: %w", err) } diff --git a/pkg/core/block/helper_test.go b/pkg/core/block/helper_test.go index b73b50de2..85be4903b 100644 --- a/pkg/core/block/helper_test.go +++ b/pkg/core/block/helper_test.go @@ -4,7 +4,7 @@ import ( "encoding/hex" "encoding/json" "fmt" - "io/ioutil" + "os" "testing" "github.com/nspcc-dev/neo-go/internal/testserdes" @@ -25,7 +25,7 @@ func getDecodedBlock(t *testing.T, i int) *Block { } func getBlockData(i int) (map[string]interface{}, error) { - b, err := ioutil.ReadFile(fmt.Sprintf("../test_data/block_%d.json", i)) + b, err := os.ReadFile(fmt.Sprintf("../test_data/block_%d.json", i)) if err != nil { return nil, err } diff --git a/pkg/core/interop_system_test.go b/pkg/core/interop_system_test.go index c2b2089be..07771e534 100644 --- a/pkg/core/interop_system_test.go +++ b/pkg/core/interop_system_test.go @@ -4,7 +4,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "math" "math/big" "os" @@ -988,7 +987,7 @@ func TestGenerateManagementHelperContracts(t *testing.T) { bytes, err := ne.Bytes() require.NoError(t, err) if saveState { - err = ioutil.WriteFile(helper1ContractNEFPath, bytes, os.ModePerm) + err = os.WriteFile(helper1ContractNEFPath, bytes, os.ModePerm) require.NoError(t, err) } @@ -996,7 +995,7 @@ func TestGenerateManagementHelperContracts(t *testing.T) { mData, err := json.Marshal(m) require.NoError(t, err) if saveState { - err = ioutil.WriteFile(helper1ContractManifestPath, mData, os.ModePerm) + err = os.WriteFile(helper1ContractManifestPath, mData, os.ModePerm) require.NoError(t, err) } @@ -1022,7 +1021,7 @@ func TestGenerateManagementHelperContracts(t *testing.T) { bytes, err = ne.Bytes() require.NoError(t, err) if saveState { - err = ioutil.WriteFile(helper2ContractNEFPath, bytes, os.ModePerm) + err = os.WriteFile(helper2ContractNEFPath, bytes, os.ModePerm) require.NoError(t, err) } @@ -1030,7 +1029,7 @@ func TestGenerateManagementHelperContracts(t *testing.T) { mData, err = json.Marshal(m) require.NoError(t, err) if saveState { - err = ioutil.WriteFile(helper2ContractManifestPath, mData, os.ModePerm) + err = os.WriteFile(helper2ContractManifestPath, mData, os.ModePerm) require.NoError(t, err) } @@ -1041,12 +1040,12 @@ func TestGenerateManagementHelperContracts(t *testing.T) { func getTestContractState(t *testing.T, id1, id2 int32, sender2 util.Uint160) (*state.Contract, *state.Contract) { errNotFound := errors.New("auto-generated oracle contract is not found, use TestGenerateOracleContract to regenerate") - neBytes, err := ioutil.ReadFile(helper1ContractNEFPath) + neBytes, err := os.ReadFile(helper1ContractNEFPath) require.NoError(t, err, fmt.Errorf("nef1: %w", errNotFound)) ne, err := nef.FileFromBytes(neBytes) require.NoError(t, err) - mBytes, err := ioutil.ReadFile(helper1ContractManifestPath) + mBytes, err := os.ReadFile(helper1ContractManifestPath) require.NoError(t, err, fmt.Errorf("manifest1: %w", errNotFound)) m := &manifest.Manifest{} err = json.Unmarshal(mBytes, m) @@ -1060,12 +1059,12 @@ func getTestContractState(t *testing.T, id1, id2 int32, sender2 util.Uint160) (* }, } - neBytes, err = ioutil.ReadFile(helper2ContractNEFPath) + neBytes, err = os.ReadFile(helper2ContractNEFPath) require.NoError(t, err, fmt.Errorf("nef2: %w", errNotFound)) ne, err = nef.FileFromBytes(neBytes) require.NoError(t, err) - mBytes, err = ioutil.ReadFile(helper2ContractManifestPath) + mBytes, err = os.ReadFile(helper2ContractManifestPath) require.NoError(t, err, fmt.Errorf("manifest2: %w", errNotFound)) m = &manifest.Manifest{} err = json.Unmarshal(mBytes, m) diff --git a/pkg/core/native/native_test/management_test.go b/pkg/core/native/native_test/management_test.go index 17d0a86fd..eb4fa8872 100644 --- a/pkg/core/native/native_test/management_test.go +++ b/pkg/core/native/native_test/management_test.go @@ -5,7 +5,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "os" "path/filepath" "testing" @@ -49,12 +49,12 @@ func TestManagement_MinimumDeploymentFee(t *testing.T) { func getTestContractState(t *testing.T, id1, id2 int32, sender2 util.Uint160) (*state.Contract, *state.Contract) { errNotFound := errors.New("auto-generated oracle contract is not found, use TestGenerateOracleContract to regenerate") - neBytes, err := ioutil.ReadFile(helper1ContractNEFPath) + neBytes, err := os.ReadFile(helper1ContractNEFPath) require.NoError(t, err, fmt.Errorf("nef1: %w", errNotFound)) ne, err := nef.FileFromBytes(neBytes) require.NoError(t, err) - mBytes, err := ioutil.ReadFile(helper1ContractManifestPath) + mBytes, err := os.ReadFile(helper1ContractManifestPath) require.NoError(t, err, fmt.Errorf("manifest1: %w", errNotFound)) m := &manifest.Manifest{} err = json.Unmarshal(mBytes, m) @@ -68,12 +68,12 @@ func getTestContractState(t *testing.T, id1, id2 int32, sender2 util.Uint160) (* }, } - neBytes, err = ioutil.ReadFile(helper2ContractNEFPath) + neBytes, err = os.ReadFile(helper2ContractNEFPath) require.NoError(t, err, fmt.Errorf("nef2: %w", errNotFound)) ne, err = nef.FileFromBytes(neBytes) require.NoError(t, err) - mBytes, err = ioutil.ReadFile(helper2ContractManifestPath) + mBytes, err = os.ReadFile(helper2ContractManifestPath) require.NoError(t, err, fmt.Errorf("manifest2: %w", errNotFound)) m = &manifest.Manifest{} err = json.Unmarshal(mBytes, m) diff --git a/pkg/core/native/native_test/oracle_test.go b/pkg/core/native/native_test/oracle_test.go index 17cc8df75..8b7ae6a4a 100644 --- a/pkg/core/native/native_test/oracle_test.go +++ b/pkg/core/native/native_test/oracle_test.go @@ -4,9 +4,9 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "math" "math/big" + "os" "path/filepath" "strings" "testing" @@ -45,12 +45,12 @@ func getOracleContractState(t *testing.T, sender util.Uint160, id int32) *state. ) errNotFound := errors.New("auto-generated oracle contract is not found, use TestGenerateOracleContract to regenerate") - neBytes, err := ioutil.ReadFile(oracleContractNEFPath) + neBytes, err := os.ReadFile(oracleContractNEFPath) require.NoError(t, err, fmt.Errorf("nef: %w", errNotFound)) ne, err := nef.FileFromBytes(neBytes) require.NoError(t, err) - mBytes, err := ioutil.ReadFile(oracleContractManifestPath) + mBytes, err := os.ReadFile(oracleContractManifestPath) require.NoError(t, err, fmt.Errorf("manifest: %w", errNotFound)) m := &manifest.Manifest{} err = json.Unmarshal(mBytes, m) diff --git a/pkg/core/oracle_test.go b/pkg/core/oracle_test.go index 68e63d85c..b33bf78dd 100644 --- a/pkg/core/oracle_test.go +++ b/pkg/core/oracle_test.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" gio "io" - "io/ioutil" "net/http" "os" "path" @@ -124,7 +123,7 @@ func TestGenerateOracleContract(t *testing.T) { bytes, err := ne.Bytes() require.NoError(t, err) if saveState { - err = ioutil.WriteFile(oracleContractNEFPath, bytes, os.ModePerm) + err = os.WriteFile(oracleContractNEFPath, bytes, os.ModePerm) require.NoError(t, err) } @@ -132,7 +131,7 @@ func TestGenerateOracleContract(t *testing.T) { mData, err := json.Marshal(m) require.NoError(t, err) if saveState { - err = ioutil.WriteFile(oracleContractManifestPath, mData, os.ModePerm) + err = os.WriteFile(oracleContractManifestPath, mData, os.ModePerm) require.NoError(t, err) } @@ -144,12 +143,12 @@ func TestGenerateOracleContract(t *testing.T) { func getOracleContractState(t *testing.T, sender util.Uint160, id int32) *state.Contract { errNotFound := errors.New("auto-generated oracle contract is not found, use TestGenerateOracleContract to regenerate") - neBytes, err := ioutil.ReadFile(oracleContractNEFPath) + neBytes, err := os.ReadFile(oracleContractNEFPath) require.NoError(t, err, fmt.Errorf("nef: %w", errNotFound)) ne, err := nef.FileFromBytes(neBytes) require.NoError(t, err) - mBytes, err := ioutil.ReadFile(oracleContractManifestPath) + mBytes, err := os.ReadFile(oracleContractManifestPath) require.NoError(t, err, fmt.Errorf("manifest: %w", errNotFound)) m := &manifest.Manifest{} err = json.Unmarshal(mBytes, m) @@ -639,5 +638,5 @@ func newDefaultHTTPClient(returnOracleRedirectionErrOn func(address string) bool } func newResponseBody(resp []byte) gio.ReadCloser { - return ioutil.NopCloser(bytes.NewReader(resp)) + return gio.NopCloser(bytes.NewReader(resp)) } diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index 6bc84ee8b..f9a6b02b9 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -5,7 +5,7 @@ import ( "encoding/base64" "encoding/json" "fmt" - "io/ioutil" + gio "io" "math/big" "net/http" "net/http/httptest" @@ -2029,7 +2029,7 @@ func doRPCCallOverHTTP(rpcCall string, url string, t *testing.T) []byte { cl := http.Client{Timeout: time.Second} resp, err := cl.Post(url, "application/json", strings.NewReader(rpcCall)) require.NoErrorf(t, err, "could not make a POST request") - body, err := ioutil.ReadAll(resp.Body) + body, err := gio.ReadAll(resp.Body) assert.NoErrorf(t, err, "could not read response from the request: %s", rpcCall) return bytes.TrimSpace(body) } diff --git a/pkg/smartcontract/parameter.go b/pkg/smartcontract/parameter.go index ebf2e237e..91f773fed 100644 --- a/pkg/smartcontract/parameter.go +++ b/pkg/smartcontract/parameter.go @@ -8,9 +8,9 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "math" "math/bits" + "os" "strconv" "strings" "unicode/utf8" @@ -436,7 +436,7 @@ func NewParameterFromString(in string) (*Parameter, error) { res.Type = inferParamType(val) } if res.Type == ByteArrayType && typStr == fileBytesParamType { - res.Value, err = ioutil.ReadFile(val) + res.Value, err = os.ReadFile(val) if err != nil { return nil, fmt.Errorf("failed to read '%s' parameter from file '%s': %w", fileBytesParamType, val, err) } diff --git a/pkg/vm/cli/cli.go b/pkg/vm/cli/cli.go index d37da180a..c538d8937 100644 --- a/pkg/vm/cli/cli.go +++ b/pkg/vm/cli/cli.go @@ -9,7 +9,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math/big" "os" "strconv" @@ -503,7 +502,7 @@ func handleReset(c *cli.Context) error { } func getManifestFromFile(name string) (*manifest.Manifest, error) { - bs, err := ioutil.ReadFile(name) + bs, err := os.ReadFile(name) if err != nil { return nil, fmt.Errorf("%w: can't read manifest", ErrInvalidParameter) } diff --git a/pkg/vm/cli/cli_test.go b/pkg/vm/cli/cli_test.go index 584e46859..708ae06f3 100644 --- a/pkg/vm/cli/cli_test.go +++ b/pkg/vm/cli/cli_test.go @@ -7,7 +7,6 @@ import ( "encoding/json" "fmt" gio "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -209,14 +208,14 @@ func TestLoad(t *testing.T) { checkLoadgo := func(t *testing.T, tName, cName, cErrName string) { t.Run("loadgo "+tName, func(t *testing.T) { filename := filepath.Join(tmpDir, cName) - require.NoError(t, ioutil.WriteFile(filename, []byte(src), os.ModePerm)) + require.NoError(t, os.WriteFile(filename, []byte(src), os.ModePerm)) filename = "'" + filename + "'" filenameErr := filepath.Join(tmpDir, cErrName) - require.NoError(t, ioutil.WriteFile(filenameErr, []byte(src+"invalid_token"), os.ModePerm)) + require.NoError(t, os.WriteFile(filenameErr, []byte(src+"invalid_token"), os.ModePerm)) filenameErr = "'" + filenameErr + "'" goMod := []byte(`module test.example/vmcli go 1.16`) - require.NoError(t, ioutil.WriteFile(filepath.Join(tmpDir, "go.mod"), goMod, os.ModePerm)) + require.NoError(t, os.WriteFile(filepath.Join(tmpDir, "go.mod"), goMod, os.ModePerm)) e := newTestVMCLI(t) e.runProgWithTimeout(t, 10*time.Second, @@ -244,7 +243,7 @@ go 1.16`) } ` filename := filepath.Join(tmpDir, "vmtestcontract.go") - require.NoError(t, ioutil.WriteFile(filename, []byte(srcAllowNotify), os.ModePerm)) + require.NoError(t, os.WriteFile(filename, []byte(srcAllowNotify), os.ModePerm)) filename = "'" + filename + "'" wd, err := os.Getwd() require.NoError(t, err) @@ -254,7 +253,7 @@ require ( ) replace github.com/nspcc-dev/neo-go/pkg/interop => ` + filepath.Join(wd, "../../interop") + ` go 1.16`) - require.NoError(t, ioutil.WriteFile(filepath.Join(tmpDir, "go.mod"), goMod, os.ModePerm)) + require.NoError(t, os.WriteFile(filepath.Join(tmpDir, "go.mod"), goMod, os.ModePerm)) e := newTestVMCLI(t) e.runProg(t, @@ -271,15 +270,15 @@ go 1.16`) filename := filepath.Join(tmpDir, "vmtestcontract.nef") rawNef, err := nefFile.Bytes() require.NoError(t, err) - require.NoError(t, ioutil.WriteFile(filename, rawNef, os.ModePerm)) + require.NoError(t, os.WriteFile(filename, rawNef, os.ModePerm)) m, err := di.ConvertToManifest(&compiler.Options{}) require.NoError(t, err) manifestFile := filepath.Join(tmpDir, "vmtestcontract.manifest.json") rawManifest, err := json.Marshal(m) require.NoError(t, err) - require.NoError(t, ioutil.WriteFile(manifestFile, rawManifest, os.ModePerm)) + require.NoError(t, os.WriteFile(manifestFile, rawManifest, os.ModePerm)) filenameErr := filepath.Join(tmpDir, "vmtestcontract_err.nef") - require.NoError(t, ioutil.WriteFile(filenameErr, append([]byte{1, 2, 3, 4}, rawNef...), os.ModePerm)) + require.NoError(t, os.WriteFile(filenameErr, append([]byte{1, 2, 3, 4}, rawNef...), os.ModePerm)) notExists := filepath.Join(tmpDir, "notexists.json") manifestFile = "'" + manifestFile + "'" @@ -325,7 +324,7 @@ func TestRunWithDifferentArguments(t *testing.T) { tmpDir := t.TempDir() filename := filepath.Join(tmpDir, "run_vmtestcontract.go") - require.NoError(t, ioutil.WriteFile(filename, []byte(src), os.ModePerm)) + require.NoError(t, os.WriteFile(filename, []byte(src), os.ModePerm)) filename = "'" + filename + "'" e := newTestVMCLI(t) diff --git a/pkg/vm/json_test.go b/pkg/vm/json_test.go index bd15eba66..5d7050dbb 100644 --- a/pkg/vm/json_test.go +++ b/pkg/vm/json_test.go @@ -7,7 +7,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "math/big" "os" "path/filepath" @@ -129,7 +129,7 @@ func testSyscallHandler(v *VM, id uint32) error { } func testFile(t *testing.T, filename string) { - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) require.NoError(t, err) // get rid of possible BOM @@ -472,7 +472,7 @@ func decodeBytes(data []byte) ([]byte, error) { } r := base64.NewDecoder(base64.StdEncoding, bytes.NewReader(data)) - return ioutil.ReadAll(r) + return io.ReadAll(r) } func decodeHex(s string) ([]byte, error) { diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index 666e2f30b..a7e29fffc 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math" "math/big" "os" @@ -234,7 +233,7 @@ func (v *VM) AddBreakPointRel(n int) { // LoadFileWithFlags loads a program in NEF format from the given path, ready to execute it. func (v *VM) LoadFileWithFlags(path string, f callflag.CallFlag) error { - b, err := ioutil.ReadFile(path) + b, err := os.ReadFile(path) if err != nil { return err } diff --git a/pkg/wallet/regenerate_test.go b/pkg/wallet/regenerate_test.go index 168fcff34..dfed86462 100644 --- a/pkg/wallet/regenerate_test.go +++ b/pkg/wallet/regenerate_test.go @@ -3,7 +3,7 @@ package wallet import ( "encoding/json" "fmt" - "io/ioutil" + "os" "path/filepath" "testing" @@ -227,11 +227,11 @@ func TestRegenerateCLIWallet1_solo(t *testing.T) { require.NoError(t, acc3.ConvertMultisig(1, keys.PublicKeys{getKeys(t)[0]})) acc4 := getAccountWithScrypt(t, verifyWIF, "pass", scrypt) // deployed verify.go contract - f, err := ioutil.ReadFile(verifyNEFPath) + f, err := os.ReadFile(verifyNEFPath) require.NoError(t, err) nefFile, err := nef.FileFromBytes(f) require.NoError(t, err) - manifestBytes, err := ioutil.ReadFile(verifyManifestPath) + manifestBytes, err := os.ReadFile(verifyManifestPath) require.NoError(t, err) m := &manifest.Manifest{} require.NoError(t, json.Unmarshal(manifestBytes, m)) diff --git a/pkg/wallet/wallet.go b/pkg/wallet/wallet.go index 63d74fcca..bf89300e9 100644 --- a/pkg/wallet/wallet.go +++ b/pkg/wallet/wallet.go @@ -4,7 +4,6 @@ import ( "encoding/json" "errors" "io" - "io/ioutil" "os" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -161,7 +160,7 @@ func (w *Wallet) savePretty() error { } func (w *Wallet) writeRaw(data []byte) error { - return ioutil.WriteFile(w.path, data, 0644) + return os.WriteFile(w.path, data, 0644) } // JSON outputs a pretty JSON representation of the wallet. diff --git a/scripts/compare-dumps/compare-dumps.go b/scripts/compare-dumps/compare-dumps.go index 73458c3c0..627a5b145 100644 --- a/scripts/compare-dumps/compare-dumps.go +++ b/scripts/compare-dumps/compare-dumps.go @@ -7,7 +7,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "os" "path/filepath" "sort" @@ -32,7 +31,7 @@ type storageOp struct { } func readFile(path string) (dump, error) { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { return nil, err } From 753d6047843c23d51382922fbf4ed4f0e3ecfa27 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 22 Feb 2022 19:48:59 +0300 Subject: [PATCH 2/9] network: use net.ErrClosed to check network connection was closed Close #1765. --- pkg/network/tcp_transport.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/pkg/network/tcp_transport.go b/pkg/network/tcp_transport.go index e9c4efea7..dbce2ef53 100644 --- a/pkg/network/tcp_transport.go +++ b/pkg/network/tcp_transport.go @@ -1,8 +1,8 @@ package network import ( + "errors" "net" - "regexp" "sync" "time" @@ -19,8 +19,6 @@ type TCPTransport struct { quit bool } -var reClosedNetwork = regexp.MustCompile(".* use of closed network connection") - // NewTCPTransport returns a new TCPTransport that will listen for // new incoming peer connections. func NewTCPTransport(s *Server, bindAddr string, log *zap.Logger) *TCPTransport { @@ -65,7 +63,7 @@ func (t *TCPTransport) Accept() { t.lock.Lock() quit := t.quit t.lock.Unlock() - if t.isCloseError(err) && quit { + if errors.Is(err, net.ErrClosed) && quit { break } t.log.Warn("TCP accept error", zap.Error(err)) @@ -76,16 +74,6 @@ func (t *TCPTransport) Accept() { } } -func (t *TCPTransport) isCloseError(err error) bool { - if opErr, ok := err.(*net.OpError); ok { - if reClosedNetwork.Match([]byte(opErr.Error())) { - return true - } - } - - return false -} - // Close implements the Transporter interface. func (t *TCPTransport) Close() { t.lock.Lock() From a4d402da8640a862f84dbe7b8c4df55326743e7c Mon Sep 17 00:00:00 2001 From: AnnaShaleva Date: Thu, 24 Feb 2022 13:39:39 +0300 Subject: [PATCH 3/9] compiler: revert a part of ad65d1fa1f43177e507636fe4bbe4038629481b8 Close #2335. --- pkg/compiler/compiler.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index 8bdfac375..e3f0cf45c 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -11,7 +11,6 @@ import ( "io" "os" "path/filepath" - "runtime" "strings" "github.com/nspcc-dev/neo-go/pkg/smartcontract/binding" @@ -162,14 +161,7 @@ func getBuildInfo(name string, src interface{}) (*buildInfo, error) { default: panic(fmt.Sprintf("unsupported src type: %T", s)) } - if strings.HasPrefix(runtime.Version(), "go1.15") { - dir = os.TempDir() - name = filepath.Join(dir, filepath.Base(name)) - absName = name - names = append(names, "file="+name) - } else { - names = append(names, name) - } + names = append(names, name) conf.Overlay[absName] = buf } else { if strings.HasSuffix(name, ".go") { From a137552b1633ca96180afaadf96043b89cf166a9 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 22 Feb 2022 19:28:44 +0300 Subject: [PATCH 4/9] gomod: upgrade minimum required go version up to 1.16 --- README.md | 2 +- examples/nft-d/go.mod | 2 +- go.mod | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c64aa0f6d..291f6b70f 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ NeoGo, `:latest` points to the latest release) or build yourself. ### Building -To build NeoGo you need Go 1.15+ and `make`: +To build NeoGo you need Go 1.16+ and `make`: ``` make build diff --git a/examples/nft-d/go.mod b/examples/nft-d/go.mod index a98743524..89b76c8b2 100644 --- a/examples/nft-d/go.mod +++ b/examples/nft-d/go.mod @@ -1,5 +1,5 @@ module github.com/nspcc-dev/neo-go/examples/nft -go 1.15 +go 1.16 require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 diff --git a/go.mod b/go.mod index 781b12405..a5282c958 100644 --- a/go.mod +++ b/go.mod @@ -31,4 +31,4 @@ require ( gopkg.in/yaml.v2 v2.4.0 ) -go 1.15 +go 1.16 From f50815d9b90cc3a428d6c6320d678d303d7a652c Mon Sep 17 00:00:00 2001 From: AnnaShaleva Date: Thu, 17 Mar 2022 16:44:49 +0300 Subject: [PATCH 5/9] circleci: migrate from unsupported base images to the recommended ones See also https://github.com/CircleCI-Public/cimg-go/issues/158#issuecomment-1060586504 solution. --- .circleci/config.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7240ab665..4f3d4a4bd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,17 +3,17 @@ version: 2.1 executors: go1_15: docker: - - image: circleci/golang:1.15 + - image: cimg/go:1.15 environment: GO111MODULE: "on" go1_16: docker: - - image: circleci/golang:1.16 + - image: cimg/go:1.16 environment: GO111MODULE: "on" go1_17: docker: - - image: circleci/golang:1.17 + - image: cimg/go:1.17 commands: gomod: @@ -25,11 +25,11 @@ commands: command: go mod download - save_cache: key: deps-{{ checksum "go.sum" }}-{{ checksum "go.sum" }} - paths: [/go/pkg/mod] + paths: [/home/circleci/go/pkg/mod] jobs: lint: - working_directory: /go/src/github.com/nspcc-dev/neo-go + working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go executor: go1_17 steps: - checkout @@ -41,7 +41,7 @@ jobs: make lint test_1_15: - working_directory: /go/src/github.com/nspcc-dev/neo-go + working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go executor: go1_15 steps: - checkout @@ -51,7 +51,7 @@ jobs: - run: go test -v -race ./... test_1_16: - working_directory: /go/src/github.com/nspcc-dev/neo-go + working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go executor: go1_16 steps: - checkout @@ -61,7 +61,7 @@ jobs: - run: go test -v -race ./... build_cli: - working_directory: /go/src/github.com/nspcc-dev/neo-go + working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go executor: go1_17 steps: - checkout @@ -72,7 +72,7 @@ jobs: destination: / build_image: - working_directory: /go/src/github.com/nspcc-dev/neo-go + working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go executor: go1_17 docker: - image: golang:1-alpine From e8d15b1b7ea092433db77e6fdc7283f46f7c02f6 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 22 Feb 2022 19:37:27 +0300 Subject: [PATCH 6/9] workflows: upgrade supported go version --- .circleci/config.yml | 52 +++++++++++-------- .github/workflows/build.yml | 16 +++++- .github/workflows/publish_to_dockerhub.yml | 4 +- .github/workflows/run_tests.yml | 12 +++-- Dockerfile | 6 ++- Dockerfile.wsc | 58 ++++++++++++++++++++-- 6 files changed, 114 insertions(+), 34 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f3d4a4bd..be6323488 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,11 +1,6 @@ version: 2.1 executors: - go1_15: - docker: - - image: cimg/go:1.15 - environment: - GO111MODULE: "on" go1_16: docker: - image: cimg/go:1.16 @@ -14,6 +9,9 @@ executors: go1_17: docker: - image: cimg/go:1.17 + go1_18: + docker: + - image: cimg/go:1.18 commands: gomod: @@ -30,7 +28,7 @@ commands: jobs: lint: working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go - executor: go1_17 + executor: go1_18 steps: - checkout - gomod @@ -40,16 +38,6 @@ jobs: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.1 make lint - test_1_15: - working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go - executor: go1_15 - steps: - - checkout - - run: git submodule sync - - run: git submodule update --init - - gomod - - run: go test -v -race ./... - test_1_16: working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go executor: go1_16 @@ -60,9 +48,29 @@ jobs: - gomod - run: go test -v -race ./... - build_cli: + test_1_17: working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go executor: go1_17 + steps: + - checkout + - run: git submodule sync + - run: git submodule update --init + - gomod + - run: go test -v -race ./... + + test_1_18: + working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go + executor: go1_18 + steps: + - checkout + - run: git submodule sync + - run: git submodule update --init + - gomod + - run: go test -v -race ./... + + build_cli: + working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go + executor: go1_18 steps: - checkout - gomod @@ -73,7 +81,7 @@ jobs: build_image: working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go - executor: go1_17 + executor: go1_18 docker: - image: golang:1-alpine steps: @@ -101,11 +109,15 @@ workflows: filters: tags: only: v/[0-9]+\.[0-9]+\.[0-9]+/ - - test_1_15: + - test_1_16: filters: tags: only: v/[0-9]+\.[0-9]+\.[0-9]+/ - - test_1_16: + - test_1_17: + filters: + tags: + only: v/[0-9]+\.[0-9]+\.[0-9]+/ + - test_1_18: filters: tags: only: v/[0-9]+\.[0-9]+\.[0-9]+/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d85936fdd..03d655908 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,7 +33,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: Restore Go modules from cache uses: actions/cache@v2 @@ -67,7 +67,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: Restore Go modules from cache uses: actions/cache@v2 @@ -99,6 +99,12 @@ jobs: ref: ${{ github.event.inputs.ref }} fetch-depth: 0 + # For proper `deps` make target execution. + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - name: Build Docker image run: make image @@ -113,5 +119,11 @@ jobs: ref: ${{ github.event.inputs.ref }} fetch-depth: 0 + # For proper `deps` make target execution. + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - name: Build Docker image run: make image-wsc diff --git a/.github/workflows/publish_to_dockerhub.yml b/.github/workflows/publish_to_dockerhub.yml index 724a10599..8266c5693 100644 --- a/.github/workflows/publish_to_dockerhub.yml +++ b/.github/workflows/publish_to_dockerhub.yml @@ -48,7 +48,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: Restore go modules from cache uses: actions/cache@v2 @@ -113,7 +113,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: Restore go modules from cache uses: actions/cache@v2 diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 22bf1f610..250d9882a 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -56,7 +56,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: Restore Go modules from cache uses: actions/cache@v2 @@ -83,14 +83,16 @@ jobs: strategy: matrix: os: [ubuntu-20.04, windows-2022] - go_versions: [ '1.15', '1.16', '1.17' ] + go_versions: [ '1.16', '1.17', '1.18' ] exclude: - - os: windows-2022 - go_versions: '1.15' + # Only latest Go version for Windows. - os: windows-2022 go_versions: '1.16' - - os: ubuntu-20.04 + - os: windows-2022 go_versions: '1.17' + # Exclude latest Go version for Ubuntu as Coverage uses it. + - os: ubuntu-20.04 + go_versions: '1.18' fail-fast: false steps: - uses: actions/checkout@v2 diff --git a/Dockerfile b/Dockerfile index e2c4747fc..d85508db2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ # Builder image -FROM golang:1-alpine as builder +# Keep go version in sync with Build GA job. +FROM golang:1.18-alpine as builder + +# Display go version for information purposes. +RUN go version RUN set -x \ && apk add --no-cache git make \ diff --git a/Dockerfile.wsc b/Dockerfile.wsc index 0ffcabfeb..4ea7887f9 100644 --- a/Dockerfile.wsc +++ b/Dockerfile.wsc @@ -11,15 +11,65 @@ ENV GIT_DOWNLOAD_URL=https://github.com/git-for-windows/git/releases/download/v2 ENV GIT_DOWNLOAD_SHA256=8f65208f92c0b4c3ae4c0cf02d4b5f6791d539cd1a07b2df62b7116467724735 -RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip'; Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { Write-Host 'FAILED!'; exit 1; }; Write-Host 'Expanding ...'; Expand-Archive -Path git.zip -DestinationPath C:\git\.; Write-Host 'Removing ...'; Remove-Item git.zip -Force; Write-Host 'Updating PATH ...'; $env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); Write-Host 'Verifying install ("git version") ...'; git version; Write-Host 'Complete.'; +RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip'; \ + \ + Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \ + if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \ + Write-Host 'FAILED!'; \ + exit 1; \ + }; \ + \ + Write-Host 'Expanding ...'; \ + Expand-Archive -Path git.zip -DestinationPath C:\git\.; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item git.zip -Force; \ + \ + Write-Host 'Updating PATH ...'; \ + $env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \ + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ("git version") ...'; \ + git version; \ + \ + Write-Host 'Complete.'; ENV GOPATH=C:\\go -RUN $newPath = ('{0}\bin;C:\Program Files\Go\bin;{1}' -f $env:GOPATH, $env:PATH); Write-Host ('Updating PATH: {0}' -f $newPath); [Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); +RUN $newPath = ('{0}\bin;C:\Program Files\Go\bin;{1}' -f $env:GOPATH, $env:PATH); \ + Write-Host ('Updating PATH: {0}' -f $newPath); \ + [Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); -ENV GOLANG_VERSION=1.17.6 +# Keep go version in sync with Build GA job. +ENV GOLANG_VERSION=1.18 -RUN $url = 'https://dl.google.com/go/go1.17.6.windows-amd64.zip'; Write-Host ('Downloading {0} ...' -f $url); [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri $url -OutFile 'go.zip'; $sha256 = '5bf8f87aec7edfc08e6bc845f1c30dba6de32b863f89ae46553ff4bbcc1d4954'; Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { Write-Host 'FAILED!'; exit 1; }; Write-Host 'Expanding ...'; Expand-Archive go.zip -DestinationPath C:\; Write-Host 'Moving ...'; Move-Item -Path C:\go -Destination 'C:\Program Files\Go'; Write-Host 'Removing ...'; Remove-Item go.zip -Force; Write-Host 'Verifying install ("go version") ...'; go version; Write-Host 'Complete.'; +RUN $url = 'https://dl.google.com/go/go1.18.windows-amd64.zip'; \ + Write-Host ('Downloading {0} ...' -f $url); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri $url -OutFile 'go.zip'; \ + \ + $sha256 = '65c5c0c709a7ca1b357091b10b795b439d8b50e579d3893edab4c7e9b384f435'; \ + Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \ + if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { \ + Write-Host 'FAILED!'; \ + exit 1; \ + }; \ + \ + Write-Host 'Expanding ...'; \ + Expand-Archive go.zip -DestinationPath C:\; \ + \ + Write-Host 'Moving ...'; \ + Move-Item -Path C:\go -Destination 'C:\Program Files\Go'; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item go.zip -Force; \ + \ + Write-Host 'Verifying install ("go version") ...'; \ + go version; \ + \ + Write-Host 'Complete.'; COPY . /neo-go From d2bc4473ce9b00aae1a2660c126f090ca2acafa1 Mon Sep 17 00:00:00 2001 From: AnnaShaleva Date: Thu, 17 Mar 2022 13:33:52 +0300 Subject: [PATCH 7/9] circleci: upgrade golangci linter version The old one isn't able to properly work with go > 1.15. However, the updated version doesn't work with go 1.18, see https://github.com/golangci/golangci-lint/issues/2649. So let's keep go1_17 runner with the latest golangci by now. --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index be6323488..2703ce10c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,14 +28,15 @@ commands: jobs: lint: working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go - executor: go1_18 + # TODO: temp workaround, need to upgrade to go1_18 after https://github.com/golangci/golangci-lint/issues/2649 is resolved. + executor: go1_17 steps: - checkout - gomod - run: name: go-lint command: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.1 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.44.2 make lint test_1_16: From 7a8dc1179138a04ac9cf1888193573e286fa4421 Mon Sep 17 00:00:00 2001 From: AnnaShaleva Date: Fri, 18 Mar 2022 11:19:20 +0300 Subject: [PATCH 8/9] examples: update dependencies version --- examples/engine/go.mod | 2 +- examples/engine/go.sum | 4 ++-- examples/events/go.mod | 2 +- examples/events/go.sum | 4 ++-- examples/iterator/go.mod | 2 +- examples/iterator/go.sum | 4 ++-- examples/nft-d/go.mod | 2 +- examples/nft-d/go.sum | 4 ++-- examples/nft-nd-nns/go.mod | 2 +- examples/nft-nd-nns/go.sum | 4 ++-- examples/nft-nd/go.mod | 2 +- examples/nft-nd/go.sum | 4 ++-- examples/oracle/go.mod | 2 +- examples/oracle/go.sum | 4 ++-- examples/runtime/go.mod | 2 +- examples/runtime/go.sum | 4 ++-- examples/storage/go.mod | 2 +- examples/storage/go.sum | 4 ++-- examples/timer/go.mod | 2 +- examples/timer/go.sum | 4 ++-- examples/token-sale/go.mod | 2 +- examples/token-sale/go.sum | 4 ++-- examples/token/go.mod | 2 +- examples/token/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- 26 files changed, 39 insertions(+), 39 deletions(-) diff --git a/examples/engine/go.mod b/examples/engine/go.mod index 6738227e1..5bf7ee488 100644 --- a/examples/engine/go.mod +++ b/examples/engine/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/engine go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/engine/go.sum b/examples/engine/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/engine/go.sum +++ b/examples/engine/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/examples/events/go.mod b/examples/events/go.mod index 182e9eb19..b002e3b67 100644 --- a/examples/events/go.mod +++ b/examples/events/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/events go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/events/go.sum b/examples/events/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/events/go.sum +++ b/examples/events/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/examples/iterator/go.mod b/examples/iterator/go.mod index b3467204b..f7cfc4c75 100644 --- a/examples/iterator/go.mod +++ b/examples/iterator/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/iterator go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/iterator/go.sum b/examples/iterator/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/iterator/go.sum +++ b/examples/iterator/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/examples/nft-d/go.mod b/examples/nft-d/go.mod index 89b76c8b2..18f961ab0 100644 --- a/examples/nft-d/go.mod +++ b/examples/nft-d/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/nft go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/nft-d/go.sum b/examples/nft-d/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/nft-d/go.sum +++ b/examples/nft-d/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/examples/nft-nd-nns/go.mod b/examples/nft-nd-nns/go.mod index 559ef6e81..c18ac7889 100644 --- a/examples/nft-nd-nns/go.mod +++ b/examples/nft-nd-nns/go.mod @@ -4,6 +4,6 @@ go 1.16 require ( github.com/nspcc-dev/neo-go v0.98.2-pre.0.20220310092710-5379ef75bbb9 - github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 + github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b github.com/stretchr/testify v1.7.0 ) diff --git a/examples/nft-nd-nns/go.sum b/examples/nft-nd-nns/go.sum index df8f3bcfe..7b65113ab 100644 --- a/examples/nft-nd-nns/go.sum +++ b/examples/nft-nd-nns/go.sum @@ -179,8 +179,8 @@ github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8Yd github.com/nspcc-dev/neo-go v0.98.2-pre.0.20220310092710-5379ef75bbb9 h1:L6cY5S/1ZsH2zDax8sMidue2YpYIjrH5s773DBn+sgs= github.com/nspcc-dev/neo-go v0.98.2-pre.0.20220310092710-5379ef75bbb9/go.mod h1:ahEhaTYsPP78ODCXc9J6g364zEsGRlJ3Lg//REhWxaQ= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220301152507-4c415683e74e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= github.com/nspcc-dev/neofs-api-go/v2 v2.11.1 h1:SVqc523pZsSaS9vnPS1mm3VV6b6xY0gvdA0uYJ/GWZQ= github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= diff --git a/examples/nft-nd/go.mod b/examples/nft-nd/go.mod index 8a8f933fd..567d09e95 100644 --- a/examples/nft-nd/go.mod +++ b/examples/nft-nd/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/nft-nd go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/nft-nd/go.sum b/examples/nft-nd/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/nft-nd/go.sum +++ b/examples/nft-nd/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/examples/oracle/go.mod b/examples/oracle/go.mod index 2e3563e09..bcdf7291b 100644 --- a/examples/oracle/go.mod +++ b/examples/oracle/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/oracle go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/oracle/go.sum b/examples/oracle/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/oracle/go.sum +++ b/examples/oracle/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/examples/runtime/go.mod b/examples/runtime/go.mod index 7826a1917..d49b1feaa 100644 --- a/examples/runtime/go.mod +++ b/examples/runtime/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/runtime go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/runtime/go.sum b/examples/runtime/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/runtime/go.sum +++ b/examples/runtime/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/examples/storage/go.mod b/examples/storage/go.mod index cdb3542d3..31fb91c4f 100644 --- a/examples/storage/go.mod +++ b/examples/storage/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/storage go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/storage/go.sum b/examples/storage/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/storage/go.sum +++ b/examples/storage/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/examples/timer/go.mod b/examples/timer/go.mod index 6d41deb98..995775fe7 100644 --- a/examples/timer/go.mod +++ b/examples/timer/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/timer go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/timer/go.sum b/examples/timer/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/timer/go.sum +++ b/examples/timer/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/examples/token-sale/go.mod b/examples/token-sale/go.mod index feae86ab4..7345ce8ce 100644 --- a/examples/token-sale/go.mod +++ b/examples/token-sale/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/token-sale go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/token-sale/go.sum b/examples/token-sale/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/token-sale/go.sum +++ b/examples/token-sale/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/examples/token/go.mod b/examples/token/go.mod index 4a33b791b..8a45e521f 100644 --- a/examples/token/go.mod +++ b/examples/token/go.mod @@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/token go 1.16 -require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b diff --git a/examples/token/go.sum b/examples/token/go.sum index 1ef3847c5..8916f6ae5 100644 --- a/examples/token/go.sum +++ b/examples/token/go.sum @@ -1,2 +1,2 @@ -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= diff --git a/go.mod b/go.mod index a5282c958..e748d586a 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/nspcc-dev/dbft v0.0.0-20210721160347-1b03241391ac github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 - github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 + github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220113123743-7f3162110659 github.com/nspcc-dev/rfc6979 v0.2.0 github.com/pierrec/lz4 v2.6.1+incompatible diff --git a/go.sum b/go.sum index a2ab9aaa4..b5cff9b73 100644 --- a/go.sum +++ b/go.sum @@ -182,8 +182,8 @@ github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9 h1:RP0ZgihYsyaJrfJBJ8PhtTRz598DH9esSqZyNqnjLz8= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220310092710-5379ef75bbb9/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= github.com/nspcc-dev/neofs-api-go/v2 v2.11.1 h1:SVqc523pZsSaS9vnPS1mm3VV6b6xY0gvdA0uYJ/GWZQ= github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= From f6ac8daae6d4b3e17d63bf7ddbe2643ca58ebddf Mon Sep 17 00:00:00 2001 From: AnnaShaleva Date: Fri, 18 Mar 2022 11:41:02 +0300 Subject: [PATCH 9/9] examples: update neo-go dependency of nft-nd-nns --- examples/nft-nd-nns/go.mod | 2 +- examples/nft-nd-nns/go.sum | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/nft-nd-nns/go.mod b/examples/nft-nd-nns/go.mod index c18ac7889..adc516aae 100644 --- a/examples/nft-nd-nns/go.mod +++ b/examples/nft-nd-nns/go.mod @@ -3,7 +3,7 @@ module github.com/nspcc-dev/neo-go/examples/nft-nd-nns go 1.16 require ( - github.com/nspcc-dev/neo-go v0.98.2-pre.0.20220310092710-5379ef75bbb9 + github.com/nspcc-dev/neo-go v0.98.2-pre.0.20220318104433-7a8dc1179138 github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b github.com/stretchr/testify v1.7.0 ) diff --git a/examples/nft-nd-nns/go.sum b/examples/nft-nd-nns/go.sum index 7b65113ab..fb72cd0ae 100644 --- a/examples/nft-nd-nns/go.sum +++ b/examples/nft-nd-nns/go.sum @@ -176,9 +176,8 @@ github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM= -github.com/nspcc-dev/neo-go v0.98.2-pre.0.20220310092710-5379ef75bbb9 h1:L6cY5S/1ZsH2zDax8sMidue2YpYIjrH5s773DBn+sgs= -github.com/nspcc-dev/neo-go v0.98.2-pre.0.20220310092710-5379ef75bbb9/go.mod h1:ahEhaTYsPP78ODCXc9J6g364zEsGRlJ3Lg//REhWxaQ= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220301152507-4c415683e74e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= +github.com/nspcc-dev/neo-go v0.98.2-pre.0.20220318104433-7a8dc1179138 h1:r1oOvpba+RM+rAi02tSQhpa1Olhxv7XDJi/p1GyHTmI= +github.com/nspcc-dev/neo-go v0.98.2-pre.0.20220318104433-7a8dc1179138/go.mod h1:/O1Ih5Wmxg+RZgXiM/QRUkeip0Ynf1o5QuWehSIVKgc= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b h1:P2hmPjJP/i65zZBpReB+ve5LRNv5WhAgBoBkPMpFpdg= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220318080930-d2bc4473ce9b/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=