goimports incorrectly removed valid imports, manually restoring all files to original state

add task for format only as this is blocking lint validations
update linters to also lint test files
This commit is contained in:
Thomas Modeneis 2018-04-05 21:02:25 +02:00
parent a48f2a45b9
commit dea717b9f4
74 changed files with 110 additions and 37 deletions

View file

@ -41,7 +41,7 @@ lint: ## Run linters. Use make install-linters first.
build/env.sh go run build/ci.go lint
format: # Formats the code. Must have goimports installed
goimports -w -local github.com/ethereum/go-ethereum ./
build/gofmt.sh
clean:
rm -fr build/_workspace/pkg/ $(GOBIN)/*

View file

@ -21,6 +21,7 @@ import (
"errors"
"math/big"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
)

View file

@ -24,6 +24,7 @@ import (
"sync"
"time"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"

View file

@ -22,6 +22,7 @@ import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"

View file

@ -28,9 +28,8 @@ import (
"text/template"
"unicode"
"golang.org/x/tools/imports"
"github.com/ethereum/go-ethereum/accounts/abi"
"golang.org/x/tools/imports"
)
// Lang is a target programming language selector to generate bindings for.

View file

@ -27,6 +27,8 @@ import (
"sync"
"time"
"gopkg.in/fatih/set.v0"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"

View file

@ -24,9 +24,8 @@ import (
"sync"
"time"
set "gopkg.in/fatih/set.v0"
"github.com/ethereum/go-ethereum/log"
set "gopkg.in/fatih/set.v0"
)
// fileCache is a cache of files seen during scan of keystore.

View file

@ -332,6 +332,7 @@ func doLint(cmdline []string) {
// Run fast linters batched together
configs := []string{
"--vendor",
"--tests",
"--disable-all",
"--enable=goimports",
"--enable=varcheck",

16
build/gofmt.sh Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
find_files() {
find . -not \( \
\( \
-wholename '.github' \
-o -wholename './build/_workspace' \
-o -wholename './build/bin' \
-o -wholename './crypto/bn256' \
-o -wholename '*/vendor/*' \
\) -prune \
\) -name '*.go'
}
GOFMT="gofmt -s -w";
find_files | xargs $GOFMT;

View file

@ -24,6 +24,7 @@ import (
"path/filepath"
"github.com/pborman/uuid"
"gopkg.in/urfave/cli.v1"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/cmd/utils"

View file

@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/crypto"
"gopkg.in/urfave/cli.v1"
)
type outputInspect struct {

View file

@ -21,6 +21,7 @@ import (
"os"
"github.com/ethereum/go-ethereum/cmd/utils"
"gopkg.in/urfave/cli.v1"
)
const (

View file

@ -25,6 +25,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"gopkg.in/urfave/cli.v1"
)
type outputSign struct {

View file

@ -25,6 +25,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/console"
"github.com/ethereum/go-ethereum/crypto"
"gopkg.in/urfave/cli.v1"
)
// getPassPhrase obtains a passphrase given by the user. It first checks the

View file

@ -23,6 +23,7 @@ import (
"os"
"github.com/ethereum/go-ethereum/cmd/utils"
"gopkg.in/urfave/cli.v1"
)
var gitCommit = "" // Git SHA1 commit hash of the release (set via linker flags)

View file

@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum/console"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"gopkg.in/urfave/cli.v1"
)
var (

View file

@ -25,8 +25,6 @@ import (
"sync/atomic"
"time"
"github.com/syndtr/goleveldb/leveldb/util"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/console"
@ -38,6 +36,8 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/trie"
"github.com/syndtr/goleveldb/leveldb/util"
"gopkg.in/urfave/cli.v1"
)
var (

View file

@ -28,6 +28,7 @@ import (
"github.com/ethereum/go-ethereum/console"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
"gopkg.in/urfave/cli.v1"
)
var (

View file

@ -35,6 +35,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/node"
"gopkg.in/urfave/cli.v1"
)
const (

View file

@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/params"
"gopkg.in/urfave/cli.v1"
)
var (

View file

@ -25,11 +25,11 @@ import (
"strings"
"time"
"github.com/gizak/termui"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
"github.com/gizak/termui"
"gopkg.in/urfave/cli.v1"
)
var (

View file

@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/internal/debug"
"gopkg.in/urfave/cli.v1"
)
// AppHelpTemplate is the test template for the default, global app help topic.

View file

@ -45,6 +45,8 @@ import (
"strings"
"text/tabwriter"
"gopkg.in/urfave/cli.v1"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"

View file

@ -24,6 +24,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/log"
"gopkg.in/urfave/cli.v1"
)
// main is just a boring entry point to set up the CLI app.

View file

@ -25,6 +25,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/swarm/storage"
"gopkg.in/urfave/cli.v1"
)
func dbExport(ctx *cli.Context) {

View file

@ -23,6 +23,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/swarm/storage"
"gopkg.in/urfave/cli.v1"
)
func hash(ctx *cli.Context) {

View file

@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
swarm "github.com/ethereum/go-ethereum/swarm/api/client"
"gopkg.in/urfave/cli.v1"
)
func list(ctx *cli.Context) {

View file

@ -44,6 +44,8 @@ import (
"github.com/ethereum/go-ethereum/swarm"
bzzapi "github.com/ethereum/go-ethereum/swarm/api"
swarmmetrics "github.com/ethereum/go-ethereum/swarm/metrics"
"gopkg.in/urfave/cli.v1"
)
const clientIdentifier = "swarm"

View file

@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/swarm/api"
swarm "github.com/ethereum/go-ethereum/swarm/api/client"
"gopkg.in/urfave/cli.v1"
)
const bzzManifestJSON = "application/bzz-manifest+json"

View file

@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
swarm "github.com/ethereum/go-ethereum/swarm/api/client"
"gopkg.in/urfave/cli.v1"
)
func upload(ctx *cli.Context) {

View file

@ -28,6 +28,7 @@ import (
"strings"
"github.com/ethereum/go-ethereum/common/math"
"gopkg.in/urfave/cli.v1"
)
// Custom type which is registered in the flags library which cli uses for

View file

@ -56,6 +56,7 @@ import (
"github.com/ethereum/go-ethereum/p2p/netutil"
"github.com/ethereum/go-ethereum/params"
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
"gopkg.in/urfave/cli.v1"
)
var (

View file

@ -28,6 +28,7 @@ import (
"strings"
"syscall"
"github.com/mattn/go-colorable"
"github.com/peterh/liner"
"github.com/robertkrimen/otto"

View file

@ -27,8 +27,6 @@ import (
"sync/atomic"
"time"
"gopkg.in/karalabe/cookiejar.v2/collections/prque"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/consensus"
@ -43,6 +41,8 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
"github.com/hashicorp/golang-lru"
"gopkg.in/karalabe/cookiejar.v2/collections/prque"
)
var (

View file

@ -26,6 +26,8 @@ import (
"sync/atomic"
"time"
"github.com/hashicorp/golang-lru"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/core/types"

View file

@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
"gopkg.in/fatih/set.v0"
)
var (

View file

@ -24,6 +24,7 @@ import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"

View file

@ -16,6 +16,8 @@
package ethclient
import "github.com/ethereum/go-ethereum"
// Verify that Client implements the ethereum interfaces.
var (
_ = ethereum.ChainReader(&Client{})

View file

@ -30,6 +30,7 @@ import (
"github.com/ethereum/go-ethereum/log/term"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/exp"
"gopkg.in/urfave/cli.v1"
)
var (

View file

@ -34,6 +34,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/hashicorp/golang-lru"
)
var (

View file

@ -35,6 +35,7 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"gopkg.in/fatih/set.v0"
)
const (

View file

@ -26,6 +26,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/log"
"github.com/jackpal/go-nat-pmp"
)
// An implementation of nat.Interface can map local ports to ports

View file

@ -21,6 +21,8 @@ import (
"net"
"strings"
"time"
"github.com/jackpal/go-nat-pmp"
)
// natPMPClient adapts the NAT-PMP protocol implementation so it conforms to

View file

@ -22,6 +22,8 @@ import (
"context"
"net"
"time"
"gopkg.in/natefinch/npipe.v2"
)
// This is used if the dialing context has no deadline. It is much smaller than the

View file

@ -26,6 +26,7 @@ import (
"sync/atomic"
"github.com/ethereum/go-ethereum/log"
"gopkg.in/fatih/set.v0"
)
const MetadataApi = "rpc"

View file

@ -24,6 +24,7 @@ import (
"sync"
"github.com/ethereum/go-ethereum/common/hexutil"
"gopkg.in/fatih/set.v0"
)
// API describes the set of methods offered over the RPC interface

View file

@ -32,6 +32,7 @@ import (
"golang.org/x/net/websocket"
"github.com/ethereum/go-ethereum/log"
"gopkg.in/fatih/set.v0"
)
// websocketJSONCodec is a custom JSON codec with payload size enforcement and

View file

@ -23,6 +23,7 @@ import (
"github.com/ethereum/go-ethereum/log"
gethmetrics "github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/influxdb"
"gopkg.in/urfave/cli.v1"
)
var (

View file

@ -13,6 +13,7 @@ import (
"time"
"github.com/Azure/go-autorest/autorest"
"github.com/dgrijalva/jwt-go"
)
const (

View file

@ -8,6 +8,7 @@ import (
"runtime"
"sync"
"github.com/go-ole/go-ole"
"github.com/go-ole/go-ole/oleutil"
)

View file

@ -37,6 +37,7 @@ import (
"sync"
"time"
"github.com/go-ole/go-ole"
"github.com/go-ole/go-ole/oleutil"
)

View file

@ -7,6 +7,9 @@ import (
"strconv"
"strings"
"sync"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
)
var (

View file

@ -9,6 +9,8 @@ import (
"strconv"
"sync"
"time"
"github.com/nsf/termbox-go"
)
type Event struct {

View file

@ -7,6 +7,8 @@ package termui
import (
"regexp"
"strings"
"github.com/mitchellh/go-wordwrap"
)
// TextBuilder is a minimal interface to produce text []Cell using specific syntax (markdown).

View file

@ -9,6 +9,8 @@ import (
"strings"
"syscall"
"unsafe"
"github.com/mattn/go-isatty"
)
const (

View file

@ -2,6 +2,7 @@
package termbox
import "github.com/mattn/go-runewidth"
import "fmt"
import "os"
import "os/signal"

View file

@ -3,6 +3,7 @@ package termbox
import "syscall"
import "unsafe"
import "unicode/utf16"
import "github.com/mattn/go-runewidth"
type (
wchar uint16

View file

@ -11,6 +11,8 @@ import (
"math"
"regexp"
"strings"
"github.com/mattn/go-runewidth"
)
var ansi = regexp.MustCompile("\033\\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]")

View file

@ -2,7 +2,6 @@ package ast
import (
"fmt"
"github.com/robertkrimen/otto/file"
)

View file

@ -5,6 +5,8 @@ package file
import (
"fmt"
"strings"
"gopkg.in/sourcemap.v1"
)
// Idx is a compact encoding of a source position within a file set.

View file

@ -43,6 +43,7 @@ import (
"github.com/robertkrimen/otto/ast"
"github.com/robertkrimen/otto/file"
"github.com/robertkrimen/otto/token"
"gopkg.in/sourcemap.v1"
)
// A Mode value is a set of flags (or 0). They control optional parser functionality.

View file

@ -1,5 +1,7 @@
package otto
import ()
type _resultKind int
const (

View file

@ -6,11 +6,10 @@
package require
import (
assert "github.com/stretchr/testify/assert"
http "net/http"
url "net/url"
time "time"
assert "github.com/stretchr/testify/assert"
)
// Condition uses a Comparison to assert a complex condition.

View file

@ -6,11 +6,10 @@
package require
import (
assert "github.com/stretchr/testify/assert"
http "net/http"
url "net/url"
time "time"
assert "github.com/stretchr/testify/assert"
)
// Condition uses a Comparison to assert a complex condition.

View file

@ -1,9 +1,8 @@
package leveldb
import (
"sync/atomic"
"github.com/syndtr/goleveldb/leveldb/storage"
"sync/atomic"
)
type iStorage struct {

View file

@ -10,9 +10,8 @@ import (
"bufio"
"bytes"
"encoding/base64"
"io"
"golang.org/x/crypto/openpgp/errors"
"io"
)
// A Block represents an OpenPGP armored structure.

View file

@ -8,10 +8,9 @@ import (
"compress/bzip2"
"compress/flate"
"compress/zlib"
"golang.org/x/crypto/openpgp/errors"
"io"
"strconv"
"golang.org/x/crypto/openpgp/errors"
)
// Compressed represents a compressed OpenPGP packet. The decompressed contents

View file

@ -7,11 +7,10 @@ package packet
import (
"crypto"
"encoding/binary"
"io"
"strconv"
"golang.org/x/crypto/openpgp/errors"
"golang.org/x/crypto/openpgp/s2k"
"io"
"strconv"
)
// OnePassSignature represents a one-pass signature packet. See RFC 4880,

View file

@ -11,11 +11,10 @@ import (
"crypto/aes"
"crypto/cipher"
"crypto/des"
"io"
"math/big"
"golang.org/x/crypto/cast5"
"golang.org/x/crypto/openpgp/errors"
"io"
"math/big"
)
// readFull is the same as io.ReadFull except that reading zero bytes returns

View file

@ -5,9 +5,8 @@
package packet
import (
"io"
"golang.org/x/crypto/openpgp/errors"
"io"
)
// Reader reads packets from an io.Reader and allows packets to be 'unread' so

View file

@ -8,11 +8,10 @@ import (
"crypto/cipher"
"crypto/sha1"
"crypto/subtle"
"golang.org/x/crypto/openpgp/errors"
"hash"
"io"
"strconv"
"golang.org/x/crypto/openpgp/errors"
)
// SymmetricallyEncrypted represents a symmetrically encrypted byte string. The

View file

@ -7,10 +7,9 @@
package terminal // import "golang.org/x/crypto/ssh/terminal"
import (
"golang.org/x/sys/unix"
"io"
"syscall"
"golang.org/x/sys/unix"
)
// State contains the state of a terminal.

View file

@ -19,6 +19,7 @@ package shhclient
import (
"context"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rpc"
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"