diff --git a/Makefile b/Makefile index 35a6164344..acf81fc977 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ build-linux: LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build update_gaia_lite_docs: - @statik -src=client/lcd/swagger-ui -dest=client/lcd + @statik -src=client/lcd/swagger-ui -dest=client/lcd -f build_cosmos-sdk-cli: ifeq ($(OS),Windows_NT) @@ -182,14 +182,14 @@ test_cover: test_lint: gometalinter.v2 --config=tools/gometalinter.json ./... - !(gometalinter.v2 --exclude /usr/lib/go/src/ --disable-all --enable='errcheck' --vendor ./... | grep -v "client/") + !(gometalinter.v2 --exclude /usr/lib/go/src/ --exclude client/lcd/statik/statik.go --disable-all --enable='errcheck' --vendor ./... | grep -v "client/") find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s dep status >> /dev/null !(grep -n branch Gopkg.toml) format: - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -w -s - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs misspell -w + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofmt -w -s + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w benchmark: @go test -bench=. $(PACKAGES_NOSIMULATION) diff --git a/client/context/context.go b/client/context/context.go index 8ead39063d..ce36c37a8a 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -50,7 +50,7 @@ type CLIContext struct { GenerateOnly bool fromAddress types.AccAddress fromName string - Indent bool + Indent bool } // NewCLIContext returns a new initialized CLIContext with parameters from the diff --git a/client/flags.go b/client/flags.go index 591becfaaa..9d03939e02 100644 --- a/client/flags.go +++ b/client/flags.go @@ -17,25 +17,25 @@ const ( DefaultGasLimit = 200000 GasFlagSimulate = "simulate" - FlagUseLedger = "ledger" - FlagChainID = "chain-id" - FlagNode = "node" - FlagHeight = "height" - FlagGas = "gas" - FlagGasAdjustment = "gas-adjustment" - FlagTrustNode = "trust-node" - FlagFrom = "from" - FlagName = "name" - FlagAccountNumber = "account-number" - FlagSequence = "sequence" - FlagMemo = "memo" - FlagFee = "fee" - FlagAsync = "async" - FlagJson = "json" - FlagPrintResponse = "print-response" - FlagDryRun = "dry-run" - FlagGenerateOnly = "generate-only" - FlagIndentResponse= "indent" + FlagUseLedger = "ledger" + FlagChainID = "chain-id" + FlagNode = "node" + FlagHeight = "height" + FlagGas = "gas" + FlagGasAdjustment = "gas-adjustment" + FlagTrustNode = "trust-node" + FlagFrom = "from" + FlagName = "name" + FlagAccountNumber = "account-number" + FlagSequence = "sequence" + FlagMemo = "memo" + FlagFee = "fee" + FlagAsync = "async" + FlagJson = "json" + FlagPrintResponse = "print-response" + FlagDryRun = "dry-run" + FlagGenerateOnly = "generate-only" + FlagIndentResponse = "indent" ) // LineBreak can be included in a command list to provide a blank line diff --git a/client/lcd/lcd_test.go b/client/lcd/lcd_test.go index bab16125f9..485c5a2f6d 100644 --- a/client/lcd/lcd_test.go +++ b/client/lcd/lcd_test.go @@ -372,8 +372,8 @@ func TestCoinSendGenerateSignAndBroadcast(t *testing.T) { // broadcast tx broadcastPayload := struct { - Tx auth.StdTx `json:"tx"` - Return string `json:"return"` + Tx auth.StdTx `json:"tx"` + Return string `json:"return"` }{Tx: signedMsg, Return: "block"} json, err = cdc.MarshalJSON(broadcastPayload) require.Nil(t, err) diff --git a/client/lcd/root.go b/client/lcd/root.go index 0de6f839f1..ef690ed555 100644 --- a/client/lcd/root.go +++ b/client/lcd/root.go @@ -141,7 +141,6 @@ func createHandler(cdc *codec.Codec) *mux.Router { cliCtx := context.NewCLIContext().WithCodec(cdc) - // TODO: make more functional? aka r = keys.RegisterRoutes(r) r.HandleFunc("/version", CLIVersionRequestHandler).Methods("GET") r.HandleFunc("/node_version", NodeVersionRequestHandler(cliCtx)).Methods("GET") diff --git a/client/rpc/block.go b/client/rpc/block.go index 03c2dc844c..1090fd2d25 100644 --- a/client/rpc/block.go +++ b/client/rpc/block.go @@ -8,11 +8,11 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" + "github.com/cosmos/cosmos-sdk/client/utils" "github.com/gorilla/mux" "github.com/spf13/cobra" "github.com/spf13/viper" tmliteProxy "github.com/tendermint/tendermint/lite/proxy" - "github.com/cosmos/cosmos-sdk/client/utils" ) //BlockCommand returns the verified block data for a given heights diff --git a/client/rpc/status.go b/client/rpc/status.go index 7f34942160..b6675e8211 100644 --- a/client/rpc/status.go +++ b/client/rpc/status.go @@ -41,8 +41,7 @@ func getNodeStatus(cliCtx context.CLIContext) (*ctypes.ResultStatus, error) { func printNodeStatus(cmd *cobra.Command, args []string) error { // No need to verify proof in getting node status - viper.Set(client.FlagTrustNode, true) - cliCtx := context.NewCLIContext() + cliCtx := context.NewCLIContext().WithTrustNode(true) status, err := getNodeStatus(cliCtx) if err != nil { return err diff --git a/client/tx/query.go b/client/tx/query.go index 51fa415bba..ec7daf41b4 100644 --- a/client/tx/query.go +++ b/client/tx/query.go @@ -13,11 +13,11 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" + "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/spf13/viper" - "github.com/cosmos/cosmos-sdk/client/utils" ) // QueryTxCmd implements the default command for a tx query. diff --git a/client/tx/search.go b/client/tx/search.go index 174256eca1..672df0e339 100644 --- a/client/tx/search.go +++ b/client/tx/search.go @@ -15,8 +15,8 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - ctypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/cosmos/cosmos-sdk/client/utils" + ctypes "github.com/tendermint/tendermint/rpc/core/types" ) const ( diff --git a/tools/gometalinter.json b/tools/gometalinter.json index a7b9ab5175..74dc403308 100644 --- a/tools/gometalinter.json +++ b/tools/gometalinter.json @@ -6,5 +6,5 @@ "Deadline": "500s", "Vendor": true, "Cyclo": 11, - "Exclude": ["/usr/lib/go/src/"] + "Exclude": ["/usr/lib/go/src/", "client/lcd/statik/statik.go"] }