more golint updating
This commit is contained in:
@@ -23,6 +23,7 @@ type secureContext struct {
|
||||
log.Logger
|
||||
}
|
||||
|
||||
// NewContext - create a new secureContext
|
||||
func NewContext(chain string, logger log.Logger) basecoin.Context {
|
||||
return secureContext{
|
||||
id: nonce(rand.Int63()),
|
||||
|
||||
+16
-11
@@ -33,10 +33,15 @@ type RawTx struct {
|
||||
data.Bytes
|
||||
}
|
||||
|
||||
var _ basecoin.TxInner = RawTx{}
|
||||
|
||||
// nolint
|
||||
func NewRawTx(d []byte) basecoin.Tx {
|
||||
return RawTx{data.Bytes(d)}.Wrap()
|
||||
}
|
||||
func (r RawTx) Wrap() basecoin.Tx {
|
||||
return basecoin.Tx{r}
|
||||
}
|
||||
|
||||
func (r RawTx) ValidateBasic() error {
|
||||
if len(r.Bytes) > rawMaxSize {
|
||||
return errors.ErrTooLarge()
|
||||
@@ -44,10 +49,6 @@ func (r RawTx) ValidateBasic() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewRawTx(d []byte) basecoin.Tx {
|
||||
return RawTx{data.Bytes(d)}.Wrap()
|
||||
}
|
||||
|
||||
// OKHandler just used to return okay to everything
|
||||
type OKHandler struct {
|
||||
Log string
|
||||
@@ -56,7 +57,8 @@ type OKHandler struct {
|
||||
|
||||
var _ basecoin.Handler = OKHandler{}
|
||||
|
||||
func (_ OKHandler) Name() string {
|
||||
// Name - return handler's name
|
||||
func (OKHandler) Name() string {
|
||||
return NameOK
|
||||
}
|
||||
|
||||
@@ -77,18 +79,19 @@ type EchoHandler struct {
|
||||
|
||||
var _ basecoin.Handler = EchoHandler{}
|
||||
|
||||
func (_ EchoHandler) Name() string {
|
||||
// Name - return handler's name
|
||||
func (EchoHandler) Name() string {
|
||||
return NameEcho
|
||||
}
|
||||
|
||||
// CheckTx always returns an empty success tx
|
||||
func (_ EchoHandler) CheckTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx) (res basecoin.Result, err error) {
|
||||
func (EchoHandler) CheckTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx) (res basecoin.Result, err error) {
|
||||
data, err := data.ToWire(tx)
|
||||
return basecoin.Result{Data: data}, err
|
||||
}
|
||||
|
||||
// DeliverTx always returns an empty success tx
|
||||
func (_ EchoHandler) DeliverTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx) (res basecoin.Result, err error) {
|
||||
func (EchoHandler) DeliverTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx) (res basecoin.Result, err error) {
|
||||
data, err := data.ToWire(tx)
|
||||
return basecoin.Result{Data: data}, err
|
||||
}
|
||||
@@ -101,7 +104,8 @@ type FailHandler struct {
|
||||
|
||||
var _ basecoin.Handler = FailHandler{}
|
||||
|
||||
func (_ FailHandler) Name() string {
|
||||
// Name - return handler's name
|
||||
func (FailHandler) Name() string {
|
||||
return NameFail
|
||||
}
|
||||
|
||||
@@ -124,7 +128,8 @@ type PanicHandler struct {
|
||||
|
||||
var _ basecoin.Handler = PanicHandler{}
|
||||
|
||||
func (_ PanicHandler) Name() string {
|
||||
// Name - return handler's name
|
||||
func (PanicHandler) Name() string {
|
||||
return NamePanic
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//nolint
|
||||
package stack
|
||||
|
||||
import (
|
||||
|
||||
+33
-16
@@ -1,3 +1,4 @@
|
||||
//nolint
|
||||
package stack
|
||||
|
||||
import (
|
||||
@@ -19,57 +20,70 @@ type Middleware interface {
|
||||
}
|
||||
|
||||
type CheckerMiddle interface {
|
||||
CheckTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx, next basecoin.Checker) (basecoin.Result, error)
|
||||
CheckTx(ctx basecoin.Context, store state.KVStore,
|
||||
tx basecoin.Tx, next basecoin.Checker) (basecoin.Result, error)
|
||||
}
|
||||
|
||||
type CheckerMiddleFunc func(basecoin.Context, state.KVStore, basecoin.Tx, basecoin.Checker) (basecoin.Result, error)
|
||||
type CheckerMiddleFunc func(basecoin.Context, state.KVStore,
|
||||
basecoin.Tx, basecoin.Checker) (basecoin.Result, error)
|
||||
|
||||
func (c CheckerMiddleFunc) CheckTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx, next basecoin.Checker) (basecoin.Result, error) {
|
||||
func (c CheckerMiddleFunc) CheckTx(ctx basecoin.Context, store state.KVStore,
|
||||
tx basecoin.Tx, next basecoin.Checker) (basecoin.Result, error) {
|
||||
return c(ctx, store, tx, next)
|
||||
}
|
||||
|
||||
type DeliverMiddle interface {
|
||||
DeliverTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx, next basecoin.Deliver) (basecoin.Result, error)
|
||||
DeliverTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx,
|
||||
next basecoin.Deliver) (basecoin.Result, error)
|
||||
}
|
||||
|
||||
type DeliverMiddleFunc func(basecoin.Context, state.KVStore, basecoin.Tx, basecoin.Deliver) (basecoin.Result, error)
|
||||
type DeliverMiddleFunc func(basecoin.Context, state.KVStore,
|
||||
basecoin.Tx, basecoin.Deliver) (basecoin.Result, error)
|
||||
|
||||
func (d DeliverMiddleFunc) DeliverTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx, next basecoin.Deliver) (basecoin.Result, error) {
|
||||
func (d DeliverMiddleFunc) DeliverTx(ctx basecoin.Context, store state.KVStore,
|
||||
tx basecoin.Tx, next basecoin.Deliver) (basecoin.Result, error) {
|
||||
return d(ctx, store, tx, next)
|
||||
}
|
||||
|
||||
type SetOptionMiddle interface {
|
||||
SetOption(l log.Logger, store state.KVStore, module, key, value string, next basecoin.SetOptioner) (string, error)
|
||||
SetOption(l log.Logger, store state.KVStore, module,
|
||||
key, value string, next basecoin.SetOptioner) (string, error)
|
||||
}
|
||||
|
||||
type SetOptionMiddleFunc func(log.Logger, state.KVStore, string, string, string, basecoin.SetOptioner) (string, error)
|
||||
type SetOptionMiddleFunc func(log.Logger, state.KVStore,
|
||||
string, string, string, basecoin.SetOptioner) (string, error)
|
||||
|
||||
func (c SetOptionMiddleFunc) SetOption(l log.Logger, store state.KVStore, module, key, value string, next basecoin.SetOptioner) (string, error) {
|
||||
func (c SetOptionMiddleFunc) SetOption(l log.Logger, store state.KVStore,
|
||||
module, key, value string, next basecoin.SetOptioner) (string, error) {
|
||||
return c(l, store, module, key, value, next)
|
||||
}
|
||||
|
||||
// holders
|
||||
type PassCheck struct{}
|
||||
|
||||
func (_ PassCheck) CheckTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx, next basecoin.Checker) (basecoin.Result, error) {
|
||||
func (_ PassCheck) CheckTx(ctx basecoin.Context, store state.KVStore,
|
||||
tx basecoin.Tx, next basecoin.Checker) (basecoin.Result, error) {
|
||||
return next.CheckTx(ctx, store, tx)
|
||||
}
|
||||
|
||||
type PassDeliver struct{}
|
||||
|
||||
func (_ PassDeliver) DeliverTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx, next basecoin.Deliver) (basecoin.Result, error) {
|
||||
func (_ PassDeliver) DeliverTx(ctx basecoin.Context, store state.KVStore,
|
||||
tx basecoin.Tx, next basecoin.Deliver) (basecoin.Result, error) {
|
||||
return next.DeliverTx(ctx, store, tx)
|
||||
}
|
||||
|
||||
type PassOption struct{}
|
||||
|
||||
func (_ PassOption) SetOption(l log.Logger, store state.KVStore, module, key, value string, next basecoin.SetOptioner) (string, error) {
|
||||
func (_ PassOption) SetOption(l log.Logger, store state.KVStore, module,
|
||||
key, value string, next basecoin.SetOptioner) (string, error) {
|
||||
return next.SetOption(l, store, module, key, value)
|
||||
}
|
||||
|
||||
type NopOption struct{}
|
||||
|
||||
func (_ NopOption) SetOption(l log.Logger, store state.KVStore, module, key, value string, next basecoin.SetOptioner) (string, error) {
|
||||
func (_ NopOption) SetOption(l log.Logger, store state.KVStore, module,
|
||||
key, value string, next basecoin.SetOptioner) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
@@ -98,14 +112,17 @@ func (w wrapped) Name() string {
|
||||
return w.h.Name()
|
||||
}
|
||||
|
||||
func (w wrapped) CheckTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx, _ basecoin.Checker) (basecoin.Result, error) {
|
||||
func (w wrapped) CheckTx(ctx basecoin.Context, store state.KVStore,
|
||||
tx basecoin.Tx, _ basecoin.Checker) (basecoin.Result, error) {
|
||||
return w.h.CheckTx(ctx, store, tx)
|
||||
}
|
||||
|
||||
func (w wrapped) DeliverTx(ctx basecoin.Context, store state.KVStore, tx basecoin.Tx, _ basecoin.Deliver) (basecoin.Result, error) {
|
||||
func (w wrapped) DeliverTx(ctx basecoin.Context, store state.KVStore,
|
||||
tx basecoin.Tx, _ basecoin.Deliver) (basecoin.Result, error) {
|
||||
return w.h.DeliverTx(ctx, store, tx)
|
||||
}
|
||||
|
||||
func (w wrapped) SetOption(l log.Logger, store state.KVStore, module, key, value string, _ basecoin.SetOptioner) (string, error) {
|
||||
func (w wrapped) SetOption(l log.Logger, store state.KVStore,
|
||||
module, key, value string, _ basecoin.SetOptioner) (string, error) {
|
||||
return w.h.SetOption(l, store, module, key, value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user