From f82774393478960927b3225e9e8a190be8e9b891 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 19 Apr 2016 17:00:53 -0400 Subject: [PATCH] Modify goclean.sh to run go vet recursively. Fix remaining issues discovered by vet. --- cmd/sweepaccount/main.go | 4 ++-- goclean.sh | 2 +- internal/cfgutil/amount.go | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/sweepaccount/main.go b/cmd/sweepaccount/main.go index 6fcddea..63c5cfe 100644 --- a/cmd/sweepaccount/main.go +++ b/cmd/sweepaccount/main.go @@ -55,7 +55,7 @@ var opts = struct { RPCConnect: "localhost", RPCUsername: "", RPCCertificateFile: filepath.Join(walletDataDirectory, "rpc.cert"), - FeeRate: &cfgutil.AmountFlag{txrules.DefaultRelayFeePerKb}, + FeeRate: cfgutil.NewAmountFlag(txrules.DefaultRelayFeePerKb), SourceAccount: "imported", DestinationAccount: "default", RequiredConfirmations: 1, @@ -337,7 +337,7 @@ func parseOutPoint(input *btcjson.ListUnspentResult) (wire.OutPoint, error) { if err != nil { return wire.OutPoint{}, err } - return wire.OutPoint{*txHash, input.Vout}, nil + return wire.OutPoint{Hash: *txHash, Index: input.Vout}, nil } func pickNoun(n int, singularForm, pluralForm string) string { diff --git a/goclean.sh b/goclean.sh index 4ce493d..139b4bb 100755 --- a/goclean.sh +++ b/goclean.sh @@ -13,7 +13,7 @@ set -ex test -z "$(gofmt -l -w . | tee /dev/stderr)" test -z "$(goimports -l -w . | tee /dev/stderr)" test -z "$(golint ./... | grep -v 'ALL_CAPS\|OP_\|NewFieldVal\|RpcCommand\|RpcRawCommand\|RpcSend\|Dns\|api.pb.go\|StartConsensusRpc\|factory_test.go\|legacy' | tee /dev/stderr)" -test -z "$(go tool vet . 2>&1 | grep -v 'Example\|newestSha\|rpcserver/server.go' | tee /dev/stderr)" +test -z "$(go vet ./... 2>&1 | grep -v 'Example\|newestSha\|rpcserver/server.go' | tee /dev/stderr)" env GORACE="halt_on_error=1" go test -v -race ./... # Run test coverage on each subdirectories and merge the coverage profile. diff --git a/internal/cfgutil/amount.go b/internal/cfgutil/amount.go index 9a24a9a..5fa9c0c 100644 --- a/internal/cfgutil/amount.go +++ b/internal/cfgutil/amount.go @@ -17,6 +17,11 @@ type AmountFlag struct { btcutil.Amount } +// NewAmountFlag creates an AmountFlag with a default btcutil.Amount. +func NewAmountFlag(defaultValue btcutil.Amount) *AmountFlag { + return &AmountFlag{defaultValue} +} + // MarshalFlag satisifes the flags.Marshaler interface. func (a *AmountFlag) MarshalFlag() (string, error) { return a.Amount.String(), nil