node: fix golint warnings

This commit is contained in:
Daniel Liu 2024-11-08 17:24:31 +08:00
parent 0da60fc517
commit fb2f822abe
5 changed files with 10 additions and 10 deletions

View file

@ -249,7 +249,7 @@ func (api *PrivateAdminAPI) StartWS(host *string, port *int, allowedOrigins *str
return true, nil return true, nil
} }
// StopRPC terminates an already running websocket RPC API endpoint. // StopWS terminates an already running websocket RPC API endpoint.
func (api *PrivateAdminAPI) StopWS() (bool, error) { func (api *PrivateAdminAPI) StopWS() (bool, error) {
api.node.lock.Lock() api.node.lock.Lock()
defer api.node.lock.Unlock() defer api.node.lock.Unlock()

View file

@ -215,7 +215,7 @@ func DefaultHTTPEndpoint() string {
return config.HTTPEndpoint() return config.HTTPEndpoint()
} }
// WSEndpoint resolves an websocket endpoint based on the configured host interface // WSEndpoint resolves a websocket endpoint based on the configured host interface
// and port parameters. // and port parameters.
func (c *Config) WSEndpoint() string { func (c *Config) WSEndpoint() string {
if c.WSHost == "" { if c.WSHost == "" {

View file

@ -59,7 +59,7 @@ using the same data directory will store this information in different subdirect
the data directory. the data directory.
LevelDB databases are also stored within the instance subdirectory. If multiple node LevelDB databases are also stored within the instance subdirectory. If multiple node
instances use the same data directory, openening the databases with identical names will instances use the same data directory, opening the databases with identical names will
create one database for each instance. create one database for each instance.
The account key store is shared among all node instances using the same data directory The account key store is shared among all node instances using the same data directory
@ -69,7 +69,7 @@ unless its location is changed through the KeyStoreDir configuration option.
Data Directory Sharing Example Data Directory Sharing Example
In this example, two node instances named A and B are started with the same data In this example, two node instances named A and B are started with the same data
directory. Mode instance A opens the database "db", node instance B opens the databases directory. Node instance A opens the database "db", node instance B opens the databases
"db" and "db-2". The following files will be created in the data directory: "db" and "db-2". The following files will be created in the data directory:
data-directory/ data-directory/
@ -84,7 +84,7 @@ directory. Mode instance A opens the database "db", node instance B opens the da
static-nodes.json -- devp2p static node list of instance B static-nodes.json -- devp2p static node list of instance B
db/ -- LevelDB content for "db" db/ -- LevelDB content for "db"
db-2/ -- LevelDB content for "db-2" db-2/ -- LevelDB content for "db-2"
B.ipc -- JSON-RPC UNIX domain socket endpoint of instance A B.ipc -- JSON-RPC UNIX domain socket endpoint of instance B
keystore/ -- account key store, used by both instances keystore/ -- account key store, used by both instances
*/ */
package node package node

View file

@ -506,8 +506,8 @@ func TestAPIGather(t *testing.T) {
} }
// Register a batch of services with some configured APIs // Register a batch of services with some configured APIs
calls := make(chan string, 1) calls := make(chan string, 1)
makeAPI := func(result string) *OneMethodApi { makeAPI := func(result string) *OneMethodAPI {
return &OneMethodApi{fun: func() { calls <- result }} return &OneMethodAPI{fun: func() { calls <- result }}
} }
services := map[string]struct { services := map[string]struct {
APIs []rpc.API APIs []rpc.API

View file

@ -123,12 +123,12 @@ func InstrumentedServiceMakerC(base ServiceConstructor) ServiceConstructor {
return InstrumentingWrapperMaker(base, reflect.TypeOf(InstrumentedServiceC{})) return InstrumentingWrapperMaker(base, reflect.TypeOf(InstrumentedServiceC{}))
} }
// OneMethodApi is a single-method API handler to be returned by test services. // OneMethodAPI is a single-method API handler to be returned by test services.
type OneMethodApi struct { type OneMethodAPI struct {
fun func() fun func()
} }
func (api *OneMethodApi) TheOneMethod() { func (api *OneMethodAPI) TheOneMethod() {
if api.fun != nil { if api.fun != nil {
api.fun() api.fun()
} }