Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
reslove conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing committed Apr 20, 2022
2 parents d6e0f76 + aa9cd85 commit 698df43
Show file tree
Hide file tree
Showing 49 changed files with 145 additions and 156 deletions.
8 changes: 4 additions & 4 deletions abci/example/kvstore/kvstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package kvstore
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"sort"
"testing"

Expand Down Expand Up @@ -57,7 +57,7 @@ func TestKVStoreKV(t *testing.T) {
}

func TestPersistentKVStoreKV(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "abci-kvstore-test") // TODO
dir, err := os.MkdirTemp("/tmp", "abci-kvstore-test")
if err != nil {
t.Fatal(err)
}
Expand All @@ -73,7 +73,7 @@ func TestPersistentKVStoreKV(t *testing.T) {
}

func TestPersistentKVStoreInfo(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "abci-kvstore-test") // TODO
dir, err := os.MkdirTemp("/tmp", "abci-kvstore-test")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -105,7 +105,7 @@ func TestPersistentKVStoreInfo(t *testing.T) {

// add a validator, remove a validator, update a validator
func TestValUpdates(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "abci-kvstore-test") // TODO
dir, err := os.MkdirTemp("/tmp", "abci-kvstore-test")
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions abci/types/protoreplace/protoreplace.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//go:build ignore
// +build ignore

package main

import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"regexp"
Expand All @@ -21,7 +21,7 @@ func main() {
bytePattern := regexp.MustCompile("[[][]]byte")
const oldPath = "types/types.pb.go"
const tmpPath = "types/types.pb.new"
content, err := ioutil.ReadFile(oldPath)
content, err := os.ReadFile(oldPath)
if err != nil {
panic("cannot read " + oldPath)
os.Exit(1)
Expand Down
11 changes: 5 additions & 6 deletions abci/types/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package types
import (
"crypto/sha256"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -99,7 +98,7 @@ func (reader *SnapshotReader) LoadFromRestoration(hash SHA256Sum) ([]byte, error

func (reader *SnapshotReader) loadImpl(hash SHA256Sum, category string) ([]byte, error) {
toRead := filepath.Join(reader.DbDir, snapshotDir, strconv.FormatInt(reader.Height, 10), category, fmt.Sprintf("%x", hash))
return ioutil.ReadFile(toRead)
return os.ReadFile(toRead)
}

func (reader *SnapshotReader) LoadManifest(height int64) (int64, []byte, error) {
Expand All @@ -114,7 +113,7 @@ func (reader *SnapshotReader) LoadManifest(height int64) (int64, []byte, error)
return 0, nil, fmt.Errorf("requested wrong height: %d, reader height: %d", height, reader.Height)
} else {
toRead := filepath.Join(reader.DbDir, snapshotDir, strconv.FormatInt(lookupHeight, 10), finalizedDir, manifestFileName)
manifest, err := ioutil.ReadFile(toRead)
manifest, err := os.ReadFile(toRead)
return lookupHeight, manifest, err
}
}
Expand All @@ -129,7 +128,7 @@ func (reader *SnapshotReader) InitSnapshotHeight() int64 {
var latestHeight int64

toTraverse := filepath.Join(reader.DbDir, snapshotDir)
if files, err := ioutil.ReadDir(toTraverse); err == nil {
if files, err := os.ReadDir(toTraverse); err == nil {
for _, f := range files {
if f.IsDir() {
if height, err := strconv.ParseInt(f.Name(), 10, 64); err == nil && height > latestHeight {
Expand Down Expand Up @@ -157,7 +156,7 @@ func (writer *SnapshotWriter) Write(hash SHA256Sum, chunk []byte) error {
return err
}
toWrite := filepath.Join(path, fmt.Sprintf("%x", hash))
return ioutil.WriteFile(toWrite, chunk, 0600)
return os.WriteFile(toWrite, chunk, 0600)
}

func (writer *SnapshotWriter) WriteManifest(manifest []byte) error {
Expand All @@ -166,7 +165,7 @@ func (writer *SnapshotWriter) WriteManifest(manifest []byte) error {
return err
}
toWrite := filepath.Join(path, manifestFileName)
return ioutil.WriteFile(toWrite, manifest, 0600)
return os.WriteFile(toWrite, manifest, 0600)
}

func (writer *SnapshotWriter) Finalize() error {
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v1/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/assert"
abci "github.com/tendermint/tendermint/abci/types"
cfg "github.com/tendermint/tendermint/config"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/mock"
"github.com/tendermint/tendermint/p2p"
Expand All @@ -20,7 +21,6 @@ import (
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
dbm "github.com/tendermint/tendermint/libs/db"
)

var config *cfg.Config
Expand Down
3 changes: 1 addition & 2 deletions cmd/tendermint/commands/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package commands

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -168,5 +167,5 @@ func WriteConfigVals(dir string, vals map[string]string) error {
data += fmt.Sprintf("%s = \"%s\"\n", k, v)
}
cfile := filepath.Join(dir, "config.toml")
return ioutil.WriteFile(cfile, []byte(data), 0600)
return os.WriteFile(cfile, []byte(data), 0600)
}
4 changes: 2 additions & 2 deletions config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package config
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"text/template"

Expand Down Expand Up @@ -480,7 +480,7 @@ func ResetTestRoot(testName string) *Config {

func ResetTestRootWithChainID(testName string, chainID string) *Config {
// create a unique, concurrency-safe test directory under os.TempDir()
rootDir, err := ioutil.TempDir("", fmt.Sprintf("%s-%s_", chainID, testName))
rootDir, err := os.MkdirTemp("", fmt.Sprintf("%s-%s_", chainID, testName))
if err != nil {
panic(err)
}
Expand Down
7 changes: 3 additions & 4 deletions config/toml_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package config

import (
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand All @@ -23,15 +22,15 @@ func TestEnsureRoot(t *testing.T) {
require := require.New(t)

// setup temp dir for test
tmpDir, err := ioutil.TempDir("", "config-test")
tmpDir, err := os.MkdirTemp("", "config-test")
require.Nil(err)
defer os.RemoveAll(tmpDir) // nolint: errcheck

// create root dir
EnsureRoot(tmpDir)

// make sure config is set properly
data, err := ioutil.ReadFile(filepath.Join(tmpDir, defaultConfigFilePath))
data, err := os.ReadFile(filepath.Join(tmpDir, defaultConfigFilePath))
require.Nil(err)

if !checkConfig(string(data)) {
Expand All @@ -52,7 +51,7 @@ func TestEnsureTestRoot(t *testing.T) {
rootDir := cfg.RootDir

// make sure config is set properly
data, err := ioutil.ReadFile(filepath.Join(rootDir, defaultConfigFilePath))
data, err := os.ReadFile(filepath.Join(rootDir, defaultConfigFilePath))
require.Nil(err)

if !checkConfig(string(data)) {
Expand Down
2 changes: 1 addition & 1 deletion consensus/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ func newCounter() abci.Application {
}

func newPersistentKVStore() abci.Application {
dir, err := ioutil.TempDir("", "persistent-kvstore")
dir, err := os.MkdirTemp("", "persistent-kvstore")
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion consensus/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ func TestNewValidBlockMessageValidateBasic(t *testing.T) {
},
{
func(msg *NewValidBlockMessage) { msg.BlockParts = cmn.NewBitArray(types.MaxBlockPartsCount + 1) },
"BlockParts bit array size 1602 not equal to BlockPartsHeader.Total 1",
"BlockParts bit array size 102 not equal to BlockPartsHeader.Total 1",
},
}

Expand Down
2 changes: 1 addition & 1 deletion consensus/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func startNewConsensusStateAndWaitForBlock(t *testing.T, consensusReplayConfig *
cs := newConsensusStateWithConfigAndBlockStore(consensusReplayConfig, state, privValidator, kvstore.NewKVStoreApplication(), blockDB)
cs.SetLogger(logger)

bytes, _ := ioutil.ReadFile(cs.config.WalFile())
bytes, _ := os.ReadFile(cs.config.WalFile())
t.Logf("====== WAL: \n\r%X\n", bytes)

err := cs.Start()
Expand Down
7 changes: 3 additions & 4 deletions consensus/wal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package consensus
import (
"bytes"
"crypto/rand"
"io/ioutil"
"os"
"path/filepath"

Expand All @@ -27,7 +26,7 @@ const (
)

func TestWALTruncate(t *testing.T) {
walDir, err := ioutil.TempDir("", "wal")
walDir, err := os.MkdirTemp("", "wal")
require.NoError(t, err)
defer os.RemoveAll(walDir)

Expand Down Expand Up @@ -103,7 +102,7 @@ func TestWALEncoderDecoder(t *testing.T) {
}

func TestWALWrite(t *testing.T) {
walDir, err := ioutil.TempDir("", "wal")
walDir, err := os.MkdirTemp("", "wal")
require.NoError(t, err)
defer os.RemoveAll(walDir)
walFile := filepath.Join(walDir, "wal")
Expand Down Expand Up @@ -166,7 +165,7 @@ func TestWALSearchForEndHeight(t *testing.T) {
}

func TestWALPeriodicSync(t *testing.T) {
walDir, err := ioutil.TempDir("", "wal")
walDir, err := os.MkdirTemp("", "wal")
require.NoError(t, err)
defer os.RemoveAll(walDir)

Expand Down
4 changes: 2 additions & 2 deletions crypto/armor/armor.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package armor
import (
"bytes"
"fmt"
"io/ioutil"
"io"

"golang.org/x/crypto/openpgp/armor"
)
Expand Down Expand Up @@ -31,7 +31,7 @@ func DecodeArmor(armorStr string) (blockType string, headers map[string]string,
if err != nil {
return "", nil, nil, err
}
data, err = ioutil.ReadAll(block.Body)
data, err = io.ReadAll(block.Body)
if err != nil {
return "", nil, nil, err
}
Expand Down
49 changes: 29 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,51 +1,60 @@
module github.com/tendermint/tendermint

go 1.16
go 1.17

require (
github.com/VividCortex/gohistogram v1.0.0 // indirect
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a
github.com/etcd-io/bbolt v1.3.3
github.com/fortytw2/leaktest v1.2.0
github.com/go-kit/kit v0.6.0
github.com/go-logfmt/logfmt v0.3.0
github.com/go-stack/stack v1.8.0 // indirect
github.com/gogo/protobuf v1.2.1
github.com/golang/protobuf v1.3.2
github.com/golang/snappy v0.0.1
github.com/google/gofuzz v1.0.0 // indirect
github.com/gorilla/websocket v1.2.0
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmhodges/levigo v1.0.0
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect
github.com/libp2p/go-buffer-pool v0.0.2
github.com/magiconair/properties v1.8.0
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pkg/errors v0.8.1
github.com/prometheus/client_golang v0.9.1
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect
github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39 // indirect
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d // indirect
github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165
github.com/rs/cors v1.6.0
github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa
github.com/spf13/afero v1.1.2 // indirect
github.com/spf13/cast v1.3.0 // indirect
github.com/spf13/cobra v0.0.1
github.com/spf13/jwalterweatherman v1.0.0 // indirect
github.com/spf13/pflag v1.0.3 // indirect
github.com/spf13/viper v1.0.0
github.com/stretchr/testify v1.3.0
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965
github.com/tendermint/go-amino v0.14.1
go.etcd.io/bbolt v1.3.3 // indirect
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
golang.org/x/net v0.0.0-20190909003024-a7b16738d86b
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 // indirect
google.golang.org/grpc v1.23.0
)

require (
github.com/VividCortex/gohistogram v1.0.0 // indirect
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.7 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/google/gofuzz v1.0.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect
github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39 // indirect
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d // indirect
github.com/spf13/afero v1.1.2 // indirect
github.com/spf13/cast v1.3.0 // indirect
github.com/spf13/jwalterweatherman v1.0.0 // indirect
github.com/spf13/pflag v1.0.3 // indirect
go.etcd.io/bbolt v1.3.3 // indirect
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a // indirect
golang.org/x/text v0.3.0 // indirect
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 // indirect
gopkg.in/yaml.v2 v2.2.1 // indirect
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90Pveol
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190909003024-a7b16738d86b h1:XfVGCX+0T4WOStkaOsJRllbsiImhB2jgVBGc9L0lPGc=
golang.org/x/net v0.0.0-20190909003024-a7b16738d86b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand All @@ -139,7 +138,6 @@ golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpdZNbLuQj6FOzCaZe3w+vhLjn5AcFA=
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
Expand Down
5 changes: 2 additions & 3 deletions libs/autofile/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package autofile

import (
"io"
"io/ioutil"
"os"
"testing"

Expand Down Expand Up @@ -115,14 +114,14 @@ func TestRotateFile(t *testing.T) {
g.FlushAndSync()

// Read g.Head.Path+"000"
body1, err := ioutil.ReadFile(g.Head.Path + ".000")
body1, err := os.ReadFile(g.Head.Path + ".000")
assert.NoError(t, err, "Failed to read first rolled file")
if string(body1) != "Line 1\nLine 2\nLine 3\n" {
t.Errorf("Got unexpected contents: [%v]", string(body1))
}

// Read g.Head.Path
body2, err := ioutil.ReadFile(g.Head.Path)
body2, err := os.ReadFile(g.Head.Path)
assert.NoError(t, err, "Failed to read first rolled file")
if string(body2) != "Line 4\nLine 5\nLine 6\n" {
t.Errorf("Got unexpected contents: [%v]", string(body2))
Expand Down
Loading

0 comments on commit 698df43

Please sign in to comment.