From 98f62db2427531476039375ea77beaf141e616f3 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Sun, 15 Mar 2020 14:10:15 -0400 Subject: [PATCH] Fix linting --- client/context/context.go | 4 ++-- client/tx/tx.go | 4 ++-- codec/std/msgs_test.go | 4 ---- codec/std/tx.go | 6 +++--- docs/architecture/adr-020-protobuf-transaction-encoding.md | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/client/context/context.go b/client/context/context.go index eec74e7feb..ae05761226 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -26,7 +26,7 @@ type CLIContext struct { FromAddress sdk.AccAddress Client rpcclient.Client ChainID string - TxGenerator clientx.TxGenerator + TxGenerator clientx.Generator Marshaler codec.Marshaler Keybase keys.Keybase Input io.Reader @@ -136,7 +136,7 @@ func (ctx CLIContext) WithInput(r io.Reader) CLIContext { } // WithTxGenerator returns a copy of the CLIContext with an updated TxGenerator. -func (ctx CLIContext) WithTxGenerator(txg clientx.TxGenerator) CLIContext { +func (ctx CLIContext) WithTxGenerator(txg clientx.Generator) CLIContext { ctx.TxGenerator = txg return ctx } diff --git a/client/tx/tx.go b/client/tx/tx.go index ead819f334..84c918832e 100644 --- a/client/tx/tx.go +++ b/client/tx/tx.go @@ -6,10 +6,10 @@ import ( ) type ( - // TxGenerator defines an interface a client can utilize to generate an + // Generator defines an interface a client can utilize to generate an // application-defined concrete transaction type. The type returned must // implement ClientTx. - TxGenerator interface { + Generator interface { NewTx() ClientTx } diff --git a/codec/std/msgs_test.go b/codec/std/msgs_test.go index bd3063ecba..f0bd00efae 100644 --- a/codec/std/msgs_test.go +++ b/codec/std/msgs_test.go @@ -12,10 +12,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" ) -type BadEvidence struct { - *std.Evidence_Equivocation -} - func TestNewMsgSubmitEvidence(t *testing.T) { s := sdk.AccAddress("foo") e := evidence.Equivocation{ diff --git a/codec/std/tx.go b/codec/std/tx.go index 2a9b9af29b..eca3553f30 100644 --- a/codec/std/tx.go +++ b/codec/std/tx.go @@ -8,9 +8,9 @@ import ( ) var ( - _ sdk.Tx = (*Transaction)(nil) - _ clientx.ClientTx = (*Transaction)(nil) - _ clientx.TxGenerator = TxGenerator{} + _ sdk.Tx = (*Transaction)(nil) + _ clientx.ClientTx = (*Transaction)(nil) + _ clientx.Generator = TxGenerator{} ) // TxGenerator defines a transaction generator that allows clients to construct diff --git a/docs/architecture/adr-020-protobuf-transaction-encoding.md b/docs/architecture/adr-020-protobuf-transaction-encoding.md index d5a72f3afb..8038cea80f 100644 --- a/docs/architecture/adr-020-protobuf-transaction-encoding.md +++ b/docs/architecture/adr-020-protobuf-transaction-encoding.md @@ -103,7 +103,7 @@ to handle all the types, but also knows how to generate transactions, signatures and messages. ```go -type TxGenerator interface { +type Generator interface { NewTx() ClientTx } @@ -123,7 +123,7 @@ type ClientTx interface { } ``` -We then update `CLIContext` to have two new fields: `TxGenerator` and `TxGenerator`. +We then update `CLIContext` to have two new fields: `Generator` and `Generator`. Then, each module will at the minimum accept a `Marshaler` instead of a concrete Amino codec. If the module needs to work with any interface types, it will use