diff --git a/api/rpc.go b/api/rpc.go index 84dd403..acdbf26 100644 --- a/api/rpc.go +++ b/api/rpc.go @@ -3,6 +3,9 @@ package api import ( "encoding/hex" "errors" + "net" + "sync" + "github.com/OpenBazaar/spvwallet" "github.com/OpenBazaar/spvwallet/api/pb" "github.com/OpenBazaar/wallet-interface" @@ -15,8 +18,6 @@ import ( "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/reflection" - "net" - "sync" ) const Addr = "127.0.0.1:8234" diff --git a/blockchain.go b/blockchain.go index 9f15da6..da466ef 100644 --- a/blockchain.go +++ b/blockchain.go @@ -5,14 +5,15 @@ package spvwallet import ( "errors" - "github.com/btcsuite/btcd/blockchain" - "github.com/btcsuite/btcd/chaincfg" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/wire" "math/big" "sort" "sync" "time" + + "github.com/btcsuite/btcd/blockchain" + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" ) // Blockchain settings. These are kindof Bitcoin specific, but not contained in diff --git a/blockchain_test.go b/blockchain_test.go index 10ce5e9..b8670dc 100644 --- a/blockchain_test.go +++ b/blockchain_test.go @@ -4,14 +4,15 @@ import ( "bytes" "crypto/rand" "encoding/hex" - "github.com/btcsuite/btcd/blockchain" - "github.com/btcsuite/btcd/chaincfg" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/wire" "math/big" "os" "testing" "time" + + "github.com/btcsuite/btcd/blockchain" + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" ) // New chain starting from regtest genesis diff --git a/checkpoints.go b/checkpoints.go index becefaa..4c2085a 100644 --- a/checkpoints.go +++ b/checkpoints.go @@ -1,10 +1,11 @@ package spvwallet import ( + "time" + "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" - "time" ) type Checkpoint struct { diff --git a/cli/cli.go b/cli/cli.go index 2b0bcaf..0a40ff1 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -6,6 +6,11 @@ import ( "encoding/json" "errors" "fmt" + "os" + "strconv" + "strings" + "time" + "github.com/OpenBazaar/jsonpb" "github.com/OpenBazaar/spvwallet" "github.com/OpenBazaar/spvwallet/api" @@ -16,10 +21,6 @@ import ( "github.com/jessevdk/go-flags" "golang.org/x/net/context" "google.golang.org/grpc" - "os" - "strconv" - "strings" - "time" ) func SetupCli(parser *flags.Parser) { diff --git a/cmd/spvwallet/main.go b/cmd/spvwallet/main.go index ae6c1cf..0129523 100644 --- a/cmd/spvwallet/main.go +++ b/cmd/spvwallet/main.go @@ -4,6 +4,15 @@ import ( "encoding/json" "errors" "fmt" + "io/ioutil" + "net" + "net/url" + "os" + "os/signal" + "path" + "strings" + "sync" + "time" "github.com/OpenBazaar/spvwallet" "github.com/OpenBazaar/spvwallet/api" @@ -24,15 +33,6 @@ import ( "github.com/skratchdot/open-golang/open" "github.com/yawning/bulb" "golang.org/x/net/proxy" - "io/ioutil" - "net" - "net/url" - "os" - "os/signal" - "path" - "strings" - "sync" - "time" ) var parser = flags.NewParser(nil, flags.Default) diff --git a/config.go b/config.go index e35cb7b..f7e0f27 100644 --- a/config.go +++ b/config.go @@ -1,17 +1,18 @@ package spvwallet import ( - "github.com/OpenBazaar/wallet-interface" - "github.com/btcsuite/btcd/chaincfg" - "github.com/mitchellh/go-homedir" - "github.com/op/go-logging" - "golang.org/x/net/proxy" "net" "net/url" "os" "path/filepath" "runtime" "time" + + "github.com/OpenBazaar/wallet-interface" + "github.com/btcsuite/btcd/chaincfg" + "github.com/mitchellh/go-homedir" + "github.com/op/go-logging" + "golang.org/x/net/proxy" ) type Config struct { diff --git a/db/database.go b/db/database.go index 8f7aded..295c110 100644 --- a/db/database.go +++ b/db/database.go @@ -2,11 +2,13 @@ package db import ( "database/sql" - "github.com/OpenBazaar/wallet-interface" - _ "github.com/mattn/go-sqlite3" "path" "sync" "time" + + "github.com/OpenBazaar/wallet-interface" + + _ "github.com/mattn/go-sqlite3" ) // This database is mostly just an example implementation used for testing. diff --git a/db/keys.go b/db/keys.go index d731c3f..603a8d6 100644 --- a/db/keys.go +++ b/db/keys.go @@ -5,11 +5,12 @@ import ( "encoding/hex" "errors" "fmt" - "github.com/OpenBazaar/wallet-interface" - "github.com/btcsuite/btcd/btcec" "math/rand" "strconv" "sync" + + "github.com/OpenBazaar/wallet-interface" + "github.com/btcsuite/btcd/btcec" ) type KeysDB struct { diff --git a/db/keys_test.go b/db/keys_test.go index ef22551..2521e75 100644 --- a/db/keys_test.go +++ b/db/keys_test.go @@ -5,10 +5,11 @@ import ( "crypto/rand" "database/sql" "encoding/hex" - "github.com/OpenBazaar/wallet-interface" - "github.com/btcsuite/btcd/btcec" "sync" "testing" + + "github.com/OpenBazaar/wallet-interface" + "github.com/btcsuite/btcd/btcec" ) var kdb KeysDB diff --git a/db/stxo.go b/db/stxo.go index 43adc50..b30d8c0 100644 --- a/db/stxo.go +++ b/db/stxo.go @@ -3,12 +3,13 @@ package db import ( "database/sql" "encoding/hex" - "github.com/OpenBazaar/wallet-interface" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/wire" "strconv" "strings" "sync" + + "github.com/OpenBazaar/wallet-interface" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" ) type StxoDB struct { diff --git a/db/stxo_test.go b/db/stxo_test.go index 9075cf9..b9c9b63 100644 --- a/db/stxo_test.go +++ b/db/stxo_test.go @@ -4,12 +4,13 @@ import ( "bytes" "database/sql" "encoding/hex" - "github.com/OpenBazaar/wallet-interface" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/wire" "strconv" "sync" "testing" + + "github.com/OpenBazaar/wallet-interface" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" ) var sxdb StxoDB diff --git a/db/txns.go b/db/txns.go index 6408dce..1818b42 100644 --- a/db/txns.go +++ b/db/txns.go @@ -3,11 +3,12 @@ package db import ( "bytes" "database/sql" + "sync" + "time" + "github.com/OpenBazaar/wallet-interface" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" - "sync" - "time" ) type TxnsDB struct { diff --git a/db/txns_test.go b/db/txns_test.go index ef37efb..5bc7791 100644 --- a/db/txns_test.go +++ b/db/txns_test.go @@ -4,10 +4,11 @@ import ( "bytes" "database/sql" "encoding/hex" - "github.com/btcsuite/btcd/wire" "sync" "testing" "time" + + "github.com/btcsuite/btcd/wire" ) var txdb TxnsDB diff --git a/db/utxo.go b/db/utxo.go index ac1b24a..06067e7 100644 --- a/db/utxo.go +++ b/db/utxo.go @@ -3,12 +3,13 @@ package db import ( "database/sql" "encoding/hex" - "github.com/OpenBazaar/wallet-interface" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/wire" "strconv" "strings" "sync" + + "github.com/OpenBazaar/wallet-interface" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" ) type UtxoDB struct { diff --git a/db/utxo_test.go b/db/utxo_test.go index d784ecf..e86f8ef 100644 --- a/db/utxo_test.go +++ b/db/utxo_test.go @@ -4,12 +4,13 @@ import ( "bytes" "database/sql" "encoding/hex" - "github.com/OpenBazaar/wallet-interface" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/wire" "strconv" "sync" "testing" + + "github.com/OpenBazaar/wallet-interface" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" ) var uxdb UtxoDB diff --git a/eight333.go b/eight333.go index 70ef423..5db68fd 100644 --- a/eight333.go +++ b/eight333.go @@ -1,12 +1,13 @@ package spvwallet import ( + "net" + "time" + "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" peerpkg "github.com/btcsuite/btcd/peer" "github.com/btcsuite/btcd/wire" - "net" - "time" ) const ( diff --git a/exchangerates/bitcoinprices.go b/exchangerates/bitcoinprices.go index cb62fa1..b4daa99 100644 --- a/exchangerates/bitcoinprices.go +++ b/exchangerates/bitcoinprices.go @@ -7,12 +7,12 @@ import ( "net/http" "reflect" "strconv" + "strings" "sync" "time" "github.com/op/go-logging" "golang.org/x/net/proxy" - "strings" ) const SatoshiPerBTC = 100000000 diff --git a/fees.go b/fees.go index 0e83286..1c30767 100644 --- a/fees.go +++ b/fees.go @@ -2,11 +2,12 @@ package spvwallet import ( "encoding/json" - "github.com/OpenBazaar/wallet-interface" - "golang.org/x/net/proxy" "net" "net/http" "time" + + "github.com/OpenBazaar/wallet-interface" + "golang.org/x/net/proxy" ) type httpClient interface { diff --git a/fees_test.go b/fees_test.go index a9a67b4..025863f 100644 --- a/fees_test.go +++ b/fees_test.go @@ -2,9 +2,10 @@ package spvwallet import ( "bytes" - "github.com/OpenBazaar/wallet-interface" "net/http" "testing" + + "github.com/OpenBazaar/wallet-interface" ) type ClosingBuffer struct { diff --git a/gui/bootstrap/run.go b/gui/bootstrap/run.go index 4834669..db3378a 100644 --- a/gui/bootstrap/run.go +++ b/gui/bootstrap/run.go @@ -1,11 +1,12 @@ package bootstrap import ( + "os" + "path/filepath" + "github.com/asticode/go-astilectron" "github.com/asticode/go-astilog" "github.com/pkg/errors" - "os" - "path/filepath" ) func Asset(src string) ([]byte, error) { diff --git a/gui/bootstrap/server.go b/gui/bootstrap/server.go index 8ebaa6e..f548df8 100644 --- a/gui/bootstrap/server.go +++ b/gui/bootstrap/server.go @@ -3,9 +3,8 @@ package bootstrap import ( "net" "net/http" - "text/template" - "path/filepath" + "text/template" "github.com/asticode/go-astilog" "github.com/asticode/go-astitools/template" diff --git a/headers.go b/headers.go index 66c3578..d517e0e 100644 --- a/headers.go +++ b/headers.go @@ -9,13 +9,13 @@ import ( "math/big" "path" "sort" + "strings" "sync" "github.com/boltdb/bolt" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" "github.com/cevaris/ordered_map" - "strings" ) const ( diff --git a/headers_test.go b/headers_test.go index 81508f6..ff0416a 100644 --- a/headers_test.go +++ b/headers_test.go @@ -3,14 +3,15 @@ package spvwallet import ( "bytes" "crypto/rand" - "github.com/boltdb/bolt" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/wire" "math/big" "os" "strings" "testing" "time" + + "github.com/boltdb/bolt" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" ) var ( diff --git a/keys_test.go b/keys_test.go index cea748c..cda2ea5 100644 --- a/keys_test.go +++ b/keys_test.go @@ -3,13 +3,14 @@ package spvwallet import ( "bytes" "encoding/hex" + "testing" + "github.com/OpenBazaar/wallet-interface" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil/hdkeychain" - "testing" ) func createKeyManager() (*KeyManager, error) { diff --git a/mblock.go b/mblock.go index d478d69..2460983 100644 --- a/mblock.go +++ b/mblock.go @@ -1,9 +1,9 @@ package spvwallet import ( + "errors" "fmt" - "errors" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" ) diff --git a/mblock_test.go b/mblock_test.go index 0b24a83..e939c43 100644 --- a/mblock_test.go +++ b/mblock_test.go @@ -4,9 +4,10 @@ import ( "bytes" "crypto/sha256" "encoding/hex" + "testing" + "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" - "testing" ) func TestMakeMerkleParent(t *testing.T) { diff --git a/mock.go b/mock.go index 7c84b49..11b10b2 100644 --- a/mock.go +++ b/mock.go @@ -4,14 +4,15 @@ import ( "bytes" "encoding/hex" "errors" - "github.com/OpenBazaar/wallet-interface" - "github.com/btcsuite/btcd/btcec" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/wire" "sort" "strconv" "testing" "time" + + "github.com/OpenBazaar/wallet-interface" + "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" ) type MockDatastore struct { diff --git a/peers.go b/peers.go index 49c2c08..87eb9df 100644 --- a/peers.go +++ b/peers.go @@ -2,12 +2,12 @@ package spvwallet import ( "errors" + "fmt" "net" "strconv" "sync" "time" - "fmt" "github.com/btcsuite/btcd/addrmgr" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" diff --git a/sortsignsend_test.go b/sortsignsend_test.go index 491d79c..2e0e176 100644 --- a/sortsignsend_test.go +++ b/sortsignsend_test.go @@ -2,12 +2,13 @@ package spvwallet import ( "bytes" + "os" + "testing" + "github.com/OpenBazaar/wallet-interface" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" - "os" - "testing" ) func MockWallet() *SPVWallet { diff --git a/txsizes_test.go b/txsizes_test.go index 22297d0..d681979 100644 --- a/txsizes_test.go +++ b/txsizes_test.go @@ -9,8 +9,9 @@ package spvwallet import ( "bytes" "encoding/hex" - "github.com/btcsuite/btcd/wire" "testing" + + "github.com/btcsuite/btcd/wire" ) const ( diff --git a/txstore.go b/txstore.go index 857ea1d..440c6f4 100644 --- a/txstore.go +++ b/txstore.go @@ -6,6 +6,9 @@ package spvwallet import ( "bytes" "errors" + "sync" + "time" + "github.com/OpenBazaar/wallet-interface" "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/chaincfg" @@ -14,8 +17,6 @@ import ( "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil/bloom" - "sync" - "time" ) type TxStore struct { diff --git a/wallet.go b/wallet.go index 23fb65c..46fb03a 100644 --- a/wallet.go +++ b/wallet.go @@ -2,6 +2,10 @@ package spvwallet import ( "errors" + "io" + "sync" + "time" + "github.com/OpenBazaar/spvwallet/exchangerates" "github.com/OpenBazaar/wallet-interface" "github.com/btcsuite/btcd/btcec" @@ -14,9 +18,6 @@ import ( "github.com/btcsuite/btcwallet/wallet/txrules" "github.com/op/go-logging" b39 "github.com/tyler-smith/go-bip39" - "io" - "sync" - "time" ) type SPVWallet struct {