Skip to content

Commit

Permalink
Use nil for interface compliance (#2139)
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
  • Loading branch information
dhrubabasu and joshua-kim committed Oct 26, 2022
1 parent 7356c05 commit 63f32a8
Show file tree
Hide file tree
Showing 366 changed files with 496 additions and 496 deletions.
2 changes: 1 addition & 1 deletion api/admin/client.go
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/ava-labs/avalanchego/utils/rpc"
)

var _ Client = &client{}
var _ Client = (*client)(nil)

// Client interface for the Avalanche Platform Info API Endpoint
type Client interface {
Expand Down
2 changes: 1 addition & 1 deletion api/auth/auth.go
Expand Up @@ -53,7 +53,7 @@ var (
errNoEndpoints = errors.New("must name at least one endpoint")
errTooManyEndpoints = fmt.Errorf("can only name at most %d endpoints", maxEndpoints)

_ Auth = &auth{}
_ Auth = (*auth)(nil)
)

type Auth interface {
Expand Down
2 changes: 1 addition & 1 deletion api/health/client.go
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/ava-labs/avalanchego/utils/rpc"
)

var _ Client = &client{}
var _ Client = (*client)(nil)

// Client interface for Avalanche Health API Endpoint
type Client interface {
Expand Down
2 changes: 1 addition & 1 deletion api/health/health.go
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/ava-labs/avalanchego/utils/logging"
)

var _ Health = &health{}
var _ Health = (*health)(nil)

// Health defines the full health service interface for registering, reporting
// and refreshing health checks.
Expand Down
2 changes: 1 addition & 1 deletion api/info/client.go
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/ava-labs/avalanchego/vms/platformvm/signer"
)

var _ Client = &client{}
var _ Client = (*client)(nil)

// Client interface for an Info API Client
type Client interface {
Expand Down
2 changes: 1 addition & 1 deletion api/ipcs/client.go
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/ava-labs/avalanchego/utils/rpc"
)

var _ Client = &client{}
var _ Client = (*client)(nil)

// Client interface for interacting with the IPCS endpoint
type Client interface {
Expand Down
2 changes: 1 addition & 1 deletion api/keystore/blockchain_keystore.go
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ava-labs/avalanchego/utils/logging"
)

var _ BlockchainKeystore = &blockchainKeystore{}
var _ BlockchainKeystore = (*blockchainKeystore)(nil)

type BlockchainKeystore interface {
// Get a database that is able to read and write unencrypted values from the
Expand Down
2 changes: 1 addition & 1 deletion api/keystore/client.go
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/ava-labs/avalanchego/utils/rpc"
)

var _ Client = &client{}
var _ Client = (*client)(nil)

// Client interface for Avalanche Keystore API Endpoint
type Client interface {
Expand Down
2 changes: 1 addition & 1 deletion api/keystore/gkeystore/keystore_client.go
Expand Up @@ -16,7 +16,7 @@ import (
rpcdbpb "github.com/ava-labs/avalanchego/proto/pb/rpcdb"
)

var _ keystore.BlockchainKeystore = &Client{}
var _ keystore.BlockchainKeystore = (*Client)(nil)

// Client is a snow.Keystore that talks over RPC.
type Client struct {
Expand Down
2 changes: 1 addition & 1 deletion api/keystore/gkeystore/keystore_server.go
Expand Up @@ -17,7 +17,7 @@ import (
rpcdbpb "github.com/ava-labs/avalanchego/proto/pb/rpcdb"
)

var _ keystorepb.KeystoreServer = &Server{}
var _ keystorepb.KeystoreServer = (*Server)(nil)

// Server is a snow.Keystore that is managed over RPC.
type Server struct {
Expand Down
2 changes: 1 addition & 1 deletion api/keystore/keystore.go
Expand Up @@ -34,7 +34,7 @@ var (
usersPrefix = []byte("users")
bcsPrefix = []byte("bcs")

_ Keystore = &keystore{}
_ Keystore = (*keystore)(nil)
)

type Keystore interface {
Expand Down
2 changes: 1 addition & 1 deletion api/metrics/multi_gatherer.go
Expand Up @@ -17,7 +17,7 @@ import (
var (
errDuplicatedPrefix = errors.New("duplicated prefix")

_ MultiGatherer = &multiGatherer{}
_ MultiGatherer = (*multiGatherer)(nil)
)

// MultiGatherer extends the Gatherer interface by allowing additional gatherers
Expand Down
2 changes: 1 addition & 1 deletion api/metrics/optional_gatherer.go
Expand Up @@ -15,7 +15,7 @@ import (
var (
errDuplicatedRegister = errors.New("duplicated register")

_ OptionalGatherer = &optionalGatherer{}
_ OptionalGatherer = (*optionalGatherer)(nil)
)

// OptionalGatherer extends the Gatherer interface by allowing the optional
Expand Down
2 changes: 1 addition & 1 deletion api/server/server.go
Expand Up @@ -38,7 +38,7 @@ var (
errUnknownLockOption = errors.New("invalid lock options")

_ PathAdder = readPathAdder{}
_ Server = &server{}
_ Server = (*server)(nil)
)

type PathAdder interface {
Expand Down
4 changes: 2 additions & 2 deletions app/plugin/plugin.go
Expand Up @@ -29,8 +29,8 @@ var (
Name: &appPlugin{},
}

_ plugin.Plugin = &appPlugin{}
_ plugin.GRPCPlugin = &appPlugin{}
_ plugin.Plugin = (*appPlugin)(nil)
_ plugin.GRPCPlugin = (*appPlugin)(nil)
)

type appPlugin struct {
Expand Down
2 changes: 1 addition & 1 deletion app/process/process.go
Expand Up @@ -31,7 +31,7 @@ var (
stakingPortName = fmt.Sprintf("%s-staking", constants.AppName)
httpPortName = fmt.Sprintf("%s-http", constants.AppName)

_ app.App = &process{}
_ app.App = (*process)(nil)
)

// process is a wrapper around a node that runs in this process
Expand Down
2 changes: 1 addition & 1 deletion cache/lru_cache.go
Expand Up @@ -10,7 +10,7 @@ import (

const minCacheSize = 32

var _ Cacher = &LRU{}
var _ Cacher = (*LRU)(nil)

type entry struct {
Key interface{}
Expand Down
2 changes: 1 addition & 1 deletion cache/metercacher/cache.go
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/ava-labs/avalanchego/utils/timer/mockable"
)

var _ cache.Cacher = &Cache{}
var _ cache.Cacher = (*Cache)(nil)

type Cache struct {
metrics
Expand Down
2 changes: 1 addition & 1 deletion cache/unique_cache.go
Expand Up @@ -8,7 +8,7 @@ import (
"sync"
)

var _ Deduplicator = &EvictableLRU{}
var _ Deduplicator = (*EvictableLRU)(nil)

// EvictableLRU is an LRU cache that notifies the objects when they are evicted.
type EvictableLRU struct {
Expand Down
2 changes: 1 addition & 1 deletion chains/atomic/gsharedmemory/shared_memory_client.go
Expand Up @@ -24,7 +24,7 @@ const (
baseElementSize = 8 // bytes
)

var _ atomic.SharedMemory = &Client{}
var _ atomic.SharedMemory = (*Client)(nil)

// Client is atomic.SharedMemory that talks over RPC.
type Client struct {
Expand Down
2 changes: 1 addition & 1 deletion chains/atomic/gsharedmemory/shared_memory_server.go
Expand Up @@ -14,7 +14,7 @@ import (
sharedmemorypb "github.com/ava-labs/avalanchego/proto/pb/sharedmemory"
)

var _ sharedmemorypb.SharedMemoryServer = &Server{}
var _ sharedmemorypb.SharedMemoryServer = (*Server)(nil)

// Server is shared memory that is managed over RPC.
type Server struct {
Expand Down
2 changes: 1 addition & 1 deletion chains/atomic/shared_memory.go
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/ava-labs/avalanchego/ids"
)

var _ SharedMemory = &sharedMemory{}
var _ SharedMemory = (*sharedMemory)(nil)

type Requests struct {
RemoveRequests [][]byte `serialize:"true"`
Expand Down
2 changes: 1 addition & 1 deletion chains/manager.go
Expand Up @@ -72,7 +72,7 @@ var (
errCreatePlatformVM = errors.New("attempted to create a chain running the PlatformVM")
errNotBootstrapped = errors.New("chains not bootstrapped")

_ Manager = &manager{}
_ Manager = (*manager)(nil)
)

// Manager manages the chains running on this node.
Expand Down
2 changes: 1 addition & 1 deletion chains/mock_manager.go
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/ava-labs/avalanchego/snow/networking/router"
)

var _ Manager = MockManager{}
var _ Manager = (*MockManager)(nil)

// MockManager implements Manager but does nothing. Always returns nil error.
// To be used only in tests
Expand Down
2 changes: 1 addition & 1 deletion chains/subnet.go
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ava-labs/avalanchego/snow/networking/sender"
)

var _ Subnet = &subnet{}
var _ Subnet = (*subnet)(nil)

// Subnet keeps track of the currently bootstrapping chains in a subnet. If no
// chains in the subnet are currently bootstrapping, the subnet is considered
Expand Down
8 changes: 4 additions & 4 deletions codec/hierarchycodec/codec.go
Expand Up @@ -19,10 +19,10 @@ const (
)

var (
_ Codec = &hierarchyCodec{}
_ codec.Codec = &hierarchyCodec{}
_ codec.Registry = &hierarchyCodec{}
_ codec.GeneralCodec = &hierarchyCodec{}
_ Codec = (*hierarchyCodec)(nil)
_ codec.Codec = (*hierarchyCodec)(nil)
_ codec.Registry = (*hierarchyCodec)(nil)
_ codec.GeneralCodec = (*hierarchyCodec)(nil)
)

// Codec marshals and unmarshals
Expand Down
8 changes: 4 additions & 4 deletions codec/linearcodec/codec.go
Expand Up @@ -19,10 +19,10 @@ const (
)

var (
_ Codec = &linearCodec{}
_ codec.Codec = &linearCodec{}
_ codec.Registry = &linearCodec{}
_ codec.GeneralCodec = &linearCodec{}
_ Codec = (*linearCodec)(nil)
_ codec.Codec = (*linearCodec)(nil)
_ codec.Registry = (*linearCodec)(nil)
_ codec.GeneralCodec = (*linearCodec)(nil)
)

// Codec marshals and unmarshals
Expand Down
2 changes: 1 addition & 1 deletion codec/manager.go
Expand Up @@ -31,7 +31,7 @@ var (
errDuplicatedVersion = errors.New("duplicated codec version")
)

var _ Manager = &manager{}
var _ Manager = (*manager)(nil)

// Manager describes the functionality for managing codec versions.
type Manager interface {
Expand Down
2 changes: 1 addition & 1 deletion codec/reflectcodec/struct_fielder.go
Expand Up @@ -18,7 +18,7 @@ const (
TagValue = "true"
)

var _ StructFielder = &structFielder{}
var _ StructFielder = (*structFielder)(nil)

type FieldDesc struct {
Index int
Expand Down
2 changes: 1 addition & 1 deletion codec/reflectcodec/type_codec.go
Expand Up @@ -27,7 +27,7 @@ var (
errExtraSpace = errors.New("trailing buffer space")
)

var _ codec.Codec = &genericCodec{}
var _ codec.Codec = (*genericCodec)(nil)

type TypeCodec interface {
// UnpackPrefix unpacks the prefix of an interface from the given packer.
Expand Down
4 changes: 2 additions & 2 deletions codec/test_codec.go
Expand Up @@ -49,8 +49,8 @@ var MultipleTagsTests = []func(c GeneralCodec, t testing.TB){
// for the sake of testing

var (
_ Foo = &MyInnerStruct{}
_ Foo = &MyInnerStruct2{}
_ Foo = (*MyInnerStruct)(nil)
_ Foo = (*MyInnerStruct2)(nil)
)

type Foo interface {
Expand Down
4 changes: 2 additions & 2 deletions database/corruptabledb/db.go
Expand Up @@ -11,8 +11,8 @@ import (
)

var (
_ database.Database = &Database{}
_ database.Batch = &batch{}
_ database.Database = (*Database)(nil)
_ database.Batch = (*batch)(nil)
)

// CorruptableDB is a wrapper around Database
Expand Down
6 changes: 3 additions & 3 deletions database/encdb/db.go
Expand Up @@ -23,9 +23,9 @@ const (
)

var (
_ database.Database = &Database{}
_ database.Batch = &batch{}
_ database.Iterator = &iterator{}
_ database.Database = (*Database)(nil)
_ database.Batch = (*batch)(nil)
_ database.Iterator = (*iterator)(nil)
)

// Database encrypts all values that are provided
Expand Down
6 changes: 3 additions & 3 deletions database/leveldb/db.go
Expand Up @@ -63,9 +63,9 @@ const (
)

var (
_ database.Database = &Database{}
_ database.Batch = &batch{}
_ database.Iterator = &iter{}
_ database.Database = (*Database)(nil)
_ database.Batch = (*batch)(nil)
_ database.Iterator = (*iter)(nil)
)

// Database is a persistent key-value store. Apart from basic data storage
Expand Down
4 changes: 2 additions & 2 deletions database/linkeddb/linkeddb.go
Expand Up @@ -18,8 +18,8 @@ const (
var (
headKey = []byte{0x01}

_ LinkedDB = &linkedDB{}
_ database.Iterator = &iterator{}
_ LinkedDB = (*linkedDB)(nil)
_ database.Iterator = (*iterator)(nil)
)

// LinkedDB provides a key value interface while allowing iteration.
Expand Down
2 changes: 1 addition & 1 deletion database/manager/manager.go
Expand Up @@ -29,7 +29,7 @@ var (
errNoDBs = errors.New("no dbs given")
)

var _ Manager = &manager{}
var _ Manager = (*manager)(nil)

type Manager interface {
// Current returns the database with the current database version.
Expand Down
6 changes: 3 additions & 3 deletions database/memdb/db.go
Expand Up @@ -22,9 +22,9 @@ const (
)

var (
_ database.Database = &Database{}
_ database.Batch = &batch{}
_ database.Iterator = &iterator{}
_ database.Database = (*Database)(nil)
_ database.Batch = (*batch)(nil)
_ database.Iterator = (*iterator)(nil)
)

// Database is an ephemeral key-value store that implements the Database
Expand Down
6 changes: 3 additions & 3 deletions database/meterdb/db.go
Expand Up @@ -11,9 +11,9 @@ import (
)

var (
_ database.Database = &Database{}
_ database.Batch = &batch{}
_ database.Iterator = &iterator{}
_ database.Database = (*Database)(nil)
_ database.Batch = (*batch)(nil)
_ database.Iterator = (*iterator)(nil)
)

// Database tracks the amount of time each operation takes and how many bytes
Expand Down
2 changes: 1 addition & 1 deletion database/mockdb/db.go
Expand Up @@ -12,7 +12,7 @@ import (
var (
errNoFunction = errors.New("user didn't specify what value(s) return")

_ database.Database = &Database{}
_ database.Database = (*Database)(nil)
)

// Database is a mock database meant to be used in tests.
Expand Down
6 changes: 3 additions & 3 deletions database/nodb/db.go
Expand Up @@ -8,9 +8,9 @@ import (
)

var (
_ database.Database = &Database{}
_ database.Batch = &Batch{}
_ database.Iterator = &Iterator{}
_ database.Database = (*Database)(nil)
_ database.Batch = (*Batch)(nil)
_ database.Iterator = (*Iterator)(nil)
)

// Database is a lightning fast key value store with probabilistic operations.
Expand Down

0 comments on commit 63f32a8

Please sign in to comment.