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

Commit

Permalink
Apply source code formating provided by go tool
Browse files Browse the repository at this point in the history
  • Loading branch information
r8d8 committed Mar 19, 2018
1 parent 86ed8b7 commit a40f229
Show file tree
Hide file tree
Showing 49 changed files with 511 additions and 207 deletions.
5 changes: 3 additions & 2 deletions accounts/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ package accounts

import (
"fmt"
"github.com/davecgh/go-spew/spew"
"github.com/ethereumproject/go-ethereum/common"
"io/ioutil"
"math/rand"
"os"
Expand All @@ -28,6 +26,9 @@ import (
"sort"
"testing"
"time"

"github.com/davecgh/go-spew/spew"
"github.com/ethereumproject/go-ethereum/common"
)

var (
Expand Down
7 changes: 4 additions & 3 deletions accounts/cachedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ import (
"bytes"
"errors"
"fmt"
"runtime"
"sort"
"sync"

"github.com/boltdb/bolt"
"github.com/ethereumproject/go-ethereum/common"
"github.com/ethereumproject/go-ethereum/logger"
"github.com/ethereumproject/go-ethereum/logger/glog"
"github.com/mailru/easyjson"
"runtime"
"sort"
"sync"
)

var addrBucketName = []byte("byAddr")
Expand Down
3 changes: 2 additions & 1 deletion accounts/caching.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ package accounts

import (
"fmt"
"github.com/ethereumproject/go-ethereum/common"
"os"
"strings"
"time"

"github.com/ethereumproject/go-ethereum/common"
)

// Minimum amount of time between cache reloads. This limit applies if the platform does
Expand Down
3 changes: 2 additions & 1 deletion accounts/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ import (
"time"

"encoding/json"
"path/filepath"

"github.com/ethereumproject/go-ethereum/common"
"github.com/ethereumproject/go-ethereum/crypto"
"path/filepath"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions accounts/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ package accounts

import (
"fmt"
"github.com/davecgh/go-spew/spew"
"github.com/ethereumproject/go-ethereum/logger/glog"
"io/ioutil"
"math/rand"
"os"
Expand All @@ -28,6 +26,9 @@ import (
"strings"
"testing"
"time"

"github.com/davecgh/go-spew/spew"
"github.com/ethereumproject/go-ethereum/logger/glog"
)

func init() {
Expand Down
3 changes: 2 additions & 1 deletion accounts/managerdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package accounts

import (
"fmt"
"github.com/davecgh/go-spew/spew"
"io/ioutil"
"math/rand"
"os"
Expand All @@ -12,6 +11,8 @@ import (
"strings"
"testing"
"time"

"github.com/davecgh/go-spew/spew"
)

func tmpManager_CacheDB(t *testing.T) (string, *Manager) {
Expand Down
Binary file added accounts/testdata/keystore/accounts.db
Binary file not shown.
3 changes: 2 additions & 1 deletion cmd/geth/apicmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import (

"gopkg.in/urfave/cli.v1"

"os"

"github.com/ethereumproject/go-ethereum/node"
"github.com/ethereumproject/go-ethereum/rpc"
"os"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions cmd/geth/flag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import (

"reflect"

"os/exec"

"github.com/ethereumproject/go-ethereum/accounts"
"github.com/ethereumproject/go-ethereum/common"
"github.com/ethereumproject/go-ethereum/core"
"gopkg.in/urfave/cli.v1"
"github.com/ethereumproject/go-ethereum/logger/glog"
"os/exec"
"gopkg.in/urfave/cli.v1"
)

var ogHome string // placeholder
Expand Down Expand Up @@ -223,7 +224,6 @@ func TestGetChainIdentityValue(t *testing.T) {
t.Fatalf("process ran with err %v, want exit status 1", err)
}


}
}

Expand Down
7 changes: 4 additions & 3 deletions cmd/geth/log_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (

"gopkg.in/urfave/cli.v1"

"github.com/ethereumproject/go-ethereum/logger"
"github.com/ethereumproject/go-ethereum/logger/glog"
"os"
"path/filepath"

"github.com/ethereumproject/go-ethereum/logger"
"github.com/ethereumproject/go-ethereum/logger/glog"
)

const defaultStatusLog = "sync=60s"
Expand Down Expand Up @@ -180,7 +181,7 @@ func parseWithSuffix(str string, mapping map[rune]uint64) (uint64, error) {
number := strings.ToLower(strings.TrimLeftFunc(str, unicode.IsSpace))

trim := ""
for k, _ := range mapping {
for k := range mapping {
if k != 0 {
trim += string(k)
}
Expand Down
23 changes: 12 additions & 11 deletions cmd/geth/log_display_basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ package main

import (
"fmt"
"math/big"
"strconv"
"time"

"github.com/ethereumproject/go-ethereum/core"
"github.com/ethereumproject/go-ethereum/core/types"
"github.com/ethereumproject/go-ethereum/eth"
"github.com/ethereumproject/go-ethereum/eth/downloader"
"github.com/ethereumproject/go-ethereum/logger"
"github.com/ethereumproject/go-ethereum/logger/glog"
"gopkg.in/urfave/cli.v1"
"math/big"
"strconv"
"time"
)

// basicDisplaySystem is the basic display system spec'd in #127.
Expand All @@ -50,18 +51,18 @@ var basicDisplaySystem = displayEventHandlers{
},
{
eventT: logEventMinedBlock,
ev: core.NewMinedBlockEvent{},
ev: core.NewMinedBlockEvent{},
handlers: displayEventHandlerFns{
func(ctx *cli.Context, e *eth.Ethereum, evData interface{}, tickerInterval time.Duration) {
switch d := evData.(type) {
case core.NewMinedBlockEvent:
glog.D(logger.Warn).Infof(basicScanLn,
"Mined",
formatBlockNumber(d.Block.NumberU64()),
d.Block.Hash().Hex()[2 : 2+len(xlocalHeadHashD)],
fmt.Sprintf("%3d/%2d", d.Block.Transactions().Len(), new(big.Int).Div(d.Block.GasUsed(), big.NewInt(1000000)).Int64()),
"txs/mgas",
fmt.Sprintf("%2d/%2d peers", e.Downloader().GetPeers().Len(), ctx.GlobalInt(aliasableName(MaxPeersFlag.Name, ctx))),
formatBlockNumber(d.Block.NumberU64()),
d.Block.Hash().Hex()[2:2+len(xlocalHeadHashD)],
fmt.Sprintf("%3d/%2d", d.Block.Transactions().Len(), new(big.Int).Div(d.Block.GasUsed(), big.NewInt(1000000)).Int64()),
"txs/mgas",
fmt.Sprintf("%2d/%2d peers", e.Downloader().GetPeers().Len(), ctx.GlobalInt(aliasableName(MaxPeersFlag.Name, ctx))),
)
currentBlockNumber = d.Block.NumberU64()
}
Expand Down Expand Up @@ -235,13 +236,13 @@ var PrintStatusBasic = func(e *eth.Ethereum, tickerInterval time.Duration, inser
if currentModeLocal == lsModeImport && insertEvent != nil && insertEvent.Processed == 1 {
blks, txs, mgas = 1, localHead.Transactions().Len(), int(new(big.Int).Div(localHead.GasUsed(), big.NewInt(1000000)).Uint64())
} else if insertEvent != nil && insertEvent.Processed > 1 {
blks, txs, mgas = calcBlockDiff(e, localHead.NumberU64() - uint64(insertEvent.Processed), localHead)
blks, txs, mgas = calcBlockDiff(e, localHead.NumberU64()-uint64(insertEvent.Processed), localHead)
} else if currentBlockNumber == 0 && origin > 0 {
blks, txs, mgas = calcBlockDiff(e, origin, localHead)
} else if currentBlockNumber != 0 && currentBlockNumber < localHead.NumberU64() {
blks, txs, mgas = calcBlockDiff(e, currentBlockNumber, localHead)
} else {
blks, txs, mgas = calcBlockDiff(e, localHead.NumberU64() - 1, localHead)
blks, txs, mgas = calcBlockDiff(e, localHead.NumberU64()-1, localHead)
}

switch currentModeLocal {
Expand Down
42 changes: 21 additions & 21 deletions cmd/geth/log_display_dash.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,27 @@
package main

import (
"time"
"fmt"
"gopkg.in/urfave/cli.v1"
"github.com/gizak/termui"
"time"

"github.com/ethereumproject/go-ethereum/core"
"github.com/ethereumproject/go-ethereum/eth"
"github.com/ethereumproject/go-ethereum/logger/glog"
"github.com/ethereumproject/go-ethereum/logger"
"github.com/ethereumproject/go-ethereum/core"
"github.com/ethereumproject/go-ethereum/logger/glog"
"github.com/ethereumproject/go-ethereum/metrics"
"github.com/gizak/termui"
"gopkg.in/urfave/cli.v1"
)

const (
tuiHeaderHeight = 2
tuiHeaderStart = 1
tuiSmallHeight = 3
tuiHeaderStart = 1
tuiSmallHeight = 3
tuiMediumHeight = 5
tuiLargeHeight = 8
tuiSmallWidth = 20
tuiMediumWidth = 50
tuiLargeWidth = 100
tuiLargeHeight = 8
tuiSmallWidth = 20
tuiMediumWidth = 50
tuiLargeWidth = 100

tuiSpaceHeight = 1

Expand All @@ -76,10 +77,10 @@ var (
headerInfo *termui.Par
syncheightGauge *termui.Gauge

peerCountSpark termui.Sparkline
peerCountSpark termui.Sparkline
peerCountSparkHolder *termui.Sparklines

peerList *termui.List
peerList *termui.List
peerListData []string

mgasSpark termui.Sparkline
Expand All @@ -88,7 +89,6 @@ var (
blkMgasTxsSparkHolder *termui.Sparklines
)


func tuiDrawDash(e *eth.Ethereum) {
if currentMode == lsModeImport || currentMode == lsModeDiscover {
syncheightGauge.Label = ""
Expand All @@ -101,10 +101,10 @@ func tuiDrawDash(e *eth.Ethereum) {
if cacheChainIdentity != "" {
cname = cacheChainIdentity
}
headerInfo.Text = fmt.Sprintf(" Mode=%s Chain=%v(%d) Chain Id=%d \n" +
headerInfo.Text = fmt.Sprintf(" Mode=%s Chain=%v(%d) Chain Id=%d \n"+
" local_head ◼ n=%d ⬡=%s txs=%d time=%v ago",
currentMode, cname, cnet, cid, currentBlockNumber, cb.Hash().Hex()[:10] + "…", cb.Transactions().Len(),
time.Since(time.Unix(cb.Time().Int64(), 0)).Round(time.Second))
currentMode, cname, cnet, cid, currentBlockNumber, cb.Hash().Hex()[:10]+"…", cb.Transactions().Len(),
time.Since(time.Unix(cb.Time().Int64(), 0)).Round(time.Second))
syncheightGauge.BorderLabel = fmt.Sprintf("Sync")

}
Expand Down Expand Up @@ -174,7 +174,7 @@ func tuiSetupDashComponents() {
peerList.X = 0
peerList.Y = peerCountSparkHolder.Y + peerCountSparkHolder.Height
peerList.Width = peerCountSparkHolder.Width
peerList.Height = tuiLargeHeight*2
peerList.Height = tuiLargeHeight * 2
peerList.BorderTop = false
}

Expand Down Expand Up @@ -225,7 +225,7 @@ var dashDisplaySystem = displayEventHandlers{
switch d := evData.(type) {
case core.ChainInsertEvent:
localheight := d.LastNumber
_, head, syncheight, _ ,_ := e.Downloader().Progress()
_, head, syncheight, _, _ := e.Downloader().Progress()
if head > localheight {
localheight = head
}
Expand All @@ -240,7 +240,7 @@ var dashDisplaySystem = displayEventHandlers{
}

if currentBlockNumber != 0 {
b := e.BlockChain().GetBlockByNumber(localheight)
b := e.BlockChain().GetBlockByNumber(localheight)
if b == nil {
return
}
Expand Down Expand Up @@ -344,4 +344,4 @@ func tuiSetupHandlers() {
blkMgasTxsSparkHolder.Lines[2].Data = blkMgasTxsSparkHolder.Lines[2].Data[1:]
}
})
}
}
9 changes: 5 additions & 4 deletions cmd/geth/log_display_green.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@
package main

import (
"time"
"fmt"
"math/big"
"github.com/ethereumproject/go-ethereum/logger"
"strings"
"github.com/ethereumproject/go-ethereum/logger/glog"
"time"

"github.com/ethereumproject/go-ethereum/core"
"github.com/ethereumproject/go-ethereum/eth"
"github.com/ethereumproject/go-ethereum/eth/downloader"
"github.com/ethereumproject/go-ethereum/logger"
"github.com/ethereumproject/go-ethereum/logger/glog"
"gopkg.in/urfave/cli.v1"
"github.com/ethereumproject/go-ethereum/core"
)

var lsModeIcon = []string{
Expand Down
3 changes: 2 additions & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ package main

import (
"fmt"
"gopkg.in/urfave/cli.v1"
"log"
"math/rand"
"os"
"path/filepath"
"time"

"gopkg.in/urfave/cli.v1"

"github.com/ethereumproject/benchmark/rtprof"
"github.com/ethereumproject/go-ethereum/common"
"github.com/ethereumproject/go-ethereum/console"
Expand Down
7 changes: 4 additions & 3 deletions cmd/geth/migrate_datadir.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ package main

import (
"fmt"
"math/big"
"os"
"path/filepath"

"github.com/ethereumproject/go-ethereum/common"
"github.com/ethereumproject/go-ethereum/core"
"github.com/ethereumproject/go-ethereum/ethdb"
"github.com/ethereumproject/go-ethereum/logger"
"github.com/ethereumproject/go-ethereum/logger/glog"
"gopkg.in/urfave/cli.v1"
"math/big"
"os"
"path/filepath"
)

// handleIfDataDirSchemaMigrations is a handlers for the conditional logic around
Expand Down
Loading

0 comments on commit a40f229

Please sign in to comment.