Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dep as a dependency management tool #369

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
262 changes: 262 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
required = [
"github.com/golang/mock/mockgen"
]

[[constraint]]
name = "github.com/ethereum/go-ethereum"
branch = "status/1.7.0-unstable-dep"
source = "https://github.com/status-im/go-ethereum.git"
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,24 @@ lint:
@echo "Linter: gosimple\n--------------------"
@gometalinter --disable-all --deadline 45s --enable=gosimple extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"

install:
dep ensure

mkdir _vendor_keep
# keep github.com/karalabe/hid
mkdir -p _vendor_keep/github.com/karalabe/hid
cp -R vendor/github.com/karalabe/hid/* _vendor_keep/github.com/karalabe/hid
# keep github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1
mkdir -p _vendor_keep/github.com/ethereum/go-ethereum/crypto/secp256k1
cp -R vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1 _vendor_keep/github.com/ethereum/go-ethereum/crypto/secp256k1

dep prune
# bring back kept packages
cp -R _vendor_keep/github.com/karalabe/hid vendor/github.com/karalabe
cp -R _vendor_keep/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1 vendor/github.com/ethereum/go-ethereum/crypto/secp256k1
# clean up
rm -rf _vendor_keep

mock-install:
go get -u github.com/golang/mock/mockgen

Expand Down
6 changes: 3 additions & 3 deletions geth/account/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (m *Manager) VerifyAccountPassword(keyStoreDir, address, password string) (
}

if len(keyJSON) == 0 {
return nil, fmt.Errorf("cannot locate account for address: %x", addressObj)
return nil, fmt.Errorf("cannot locate account for address: %s", addressObj.Hex())
}

key, err := keystore.DecryptKey(keyJSON, password)
Expand All @@ -188,7 +188,7 @@ func (m *Manager) VerifyAccountPassword(keyStoreDir, address, password string) (

// avoid swap attack
if key.Address != addressObj {
return nil, fmt.Errorf("account mismatch: have %x, want %x", key.Address, addressObj)
return nil, fmt.Errorf("account mismatch: have %s, want %s", key.Address.Hex(), addressObj.Hex())
}

return key, nil
Expand Down Expand Up @@ -293,7 +293,7 @@ func (m *Manager) importExtendedKey(extKey *extkeys.ExtendedKey, password string
if err != nil {
return "", "", err
}
address = fmt.Sprintf("%x", account.Address)
address = account.Address.Hex()

// obtain public key to return
account, key, err := keyStore.AccountDecryptedKey(account, password)
Expand Down
4 changes: 2 additions & 2 deletions geth/account/accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (s *AccountsTestSuite) TestVerifyAccountPassword() {
emptyKeyStoreDir,
TestConfig.Account1.Address,
TestConfig.Account1.Password,
fmt.Errorf("cannot locate account for address: %x", account1Address),
fmt.Errorf("cannot locate account for address: %s", account1Address.Hex()),
},
{
"wrong address, correct password",
Expand Down Expand Up @@ -108,7 +108,7 @@ func (s *AccountsTestSuite) TestVerifyAccountPassword() {
}
accountAddress := gethcommon.BytesToAddress(gethcommon.FromHex(testCase.address))
if accountKey.Address != accountAddress {
s.T().Fatalf("account mismatch: have %x, want %x", accountKey.Address, accountAddress)
s.T().Fatalf("account mismatch: have %s, want %s", accountKey.Address.Hex(), accountAddress.Hex())
}
}
}
Expand Down
Loading