Skip to content

Commit d76c5ca

Browse files
roveneliahkaralabe
authored andcommitted
tests: golint fixes for tests directory (#16640)
1 parent c1ea527 commit d76c5ca

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

tests/block_test_util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (t *BlockTest) Run() error {
104104
return err
105105
}
106106
if gblock.Hash() != t.json.Genesis.Hash {
107-
return fmt.Errorf("genesis block hash doesn't match test: computed=%x, test=%x\n", gblock.Hash().Bytes()[:6], t.json.Genesis.Hash[:6])
107+
return fmt.Errorf("genesis block hash doesn't match test: computed=%x, test=%x", gblock.Hash().Bytes()[:6], t.json.Genesis.Hash[:6])
108108
}
109109
if gblock.Root() != t.json.Genesis.StateRoot {
110110
return fmt.Errorf("genesis block state root does not match test: computed=%x, test=%x", gblock.Root().Bytes()[:6], t.json.Genesis.StateRoot[:6])

tests/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"github.com/ethereum/go-ethereum/params"
2424
)
2525

26-
// This table defines supported forks and their chain config.
26+
// Forks table defines supported forks and their chain config.
2727
var Forks = map[string]*params.ChainConfig{
2828
"Frontier": {
2929
ChainId: big.NewInt(1),

tests/init_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var (
4242
difficultyTestDir = filepath.Join(baseDir, "BasicTests")
4343
)
4444

45-
func readJson(reader io.Reader, value interface{}) error {
45+
func readJSON(reader io.Reader, value interface{}) error {
4646
data, err := ioutil.ReadAll(reader)
4747
if err != nil {
4848
return fmt.Errorf("error reading JSON file: %v", err)
@@ -57,14 +57,14 @@ func readJson(reader io.Reader, value interface{}) error {
5757
return nil
5858
}
5959

60-
func readJsonFile(fn string, value interface{}) error {
60+
func readJSONFile(fn string, value interface{}) error {
6161
file, err := os.Open(fn)
6262
if err != nil {
6363
return err
6464
}
6565
defer file.Close()
6666

67-
err = readJson(file, value)
67+
err = readJSON(file, value)
6868
if err != nil {
6969
return fmt.Errorf("%s in file %s", err.Error(), fn)
7070
}
@@ -169,9 +169,8 @@ func (tm *testMatcher) checkFailure(t *testing.T, name string, err error) error
169169
if err != nil {
170170
t.Logf("error: %v", err)
171171
return nil
172-
} else {
173-
return fmt.Errorf("test succeeded unexpectedly")
174172
}
173+
return fmt.Errorf("test succeeded unexpectedly")
175174
}
176175
return err
177176
}
@@ -213,7 +212,7 @@ func (tm *testMatcher) runTestFile(t *testing.T, path, name string, runTest inte
213212

214213
// Load the file as map[string]<testType>.
215214
m := makeMapFromTestFunc(runTest)
216-
if err := readJsonFile(path, m.Addr().Interface()); err != nil {
215+
if err := readJSONFile(path, m.Addr().Interface()); err != nil {
217216
t.Fatal(err)
218217
}
219218

tests/transaction_test_util.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ func (tt *TransactionTest) Run(config *params.ChainConfig) error {
7272
if err := rlp.DecodeBytes(tt.json.RLP, tx); err != nil {
7373
if tt.json.Transaction == nil {
7474
return nil
75-
} else {
76-
return fmt.Errorf("RLP decoding failed: %v", err)
7775
}
76+
return fmt.Errorf("RLP decoding failed: %v", err)
7877
}
7978
// Check sender derivation.
8079
signer := types.MakeSigner(config, new(big.Int).SetUint64(uint64(tt.json.BlockNumber)))

0 commit comments

Comments
 (0)