mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-16 18:00:46 +00:00
all: fix staticcheck warning S1039: unnecessary use of fmt.Sprintf
This commit is contained in:
parent
e52b8a2de2
commit
f79763ca88
6 changed files with 10 additions and 10 deletions
|
|
@ -821,7 +821,7 @@ func TestBindings(t *testing.T) {
|
||||||
}
|
}
|
||||||
t.Log("Using config", params.TestXDPoSMockChainConfig)
|
t.Log("Using config", params.TestXDPoSMockChainConfig)
|
||||||
// Skip the test if the go-ethereum sources are symlinked (https://github.com/golang/go/issues/14845)
|
// Skip the test if the go-ethereum sources are symlinked (https://github.com/golang/go/issues/14845)
|
||||||
linkTestCode := fmt.Sprintf("package linktest\nfunc CheckSymlinks(){\nfmt.Println(backends.NewSimulatedBackend(nil))\n}")
|
linkTestCode := "package linktest\nfunc CheckSymlinks(){\nfmt.Println(backends.NewSimulatedBackend(nil))\n}"
|
||||||
linkTestDeps, err := imports.Process(os.TempDir(), []byte(linkTestCode), nil)
|
linkTestDeps, err := imports.Process(os.TempDir(), []byte(linkTestCode), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed check for goimports symlink bug: %v", err)
|
t.Fatalf("failed check for goimports symlink bug: %v", err)
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ func checkExplorer(client *sshClient, network string) (*explorerInfos, error) {
|
||||||
// Run a sanity check to see if the devp2p is reachable
|
// Run a sanity check to see if the devp2p is reachable
|
||||||
nodePort := infos.portmap[infos.envvars["NODE_PORT"]]
|
nodePort := infos.portmap[infos.envvars["NODE_PORT"]]
|
||||||
if err = checkPort(client.server, nodePort); err != nil {
|
if err = checkPort(client.server, nodePort); err != nil {
|
||||||
log.Warn(fmt.Sprintf("Explorer devp2p port seems unreachable"), "server", client.server, "port", nodePort, "err", err)
|
log.Warn("Explorer devp2p port seems unreachable", "server", client.server, "port", nodePort, "err", err)
|
||||||
}
|
}
|
||||||
// Assemble and return the useful infos
|
// Assemble and return the useful infos
|
||||||
stats := &explorerInfos{
|
stats := &explorerInfos{
|
||||||
|
|
|
||||||
|
|
@ -181,11 +181,11 @@ func checkWallet(client *sshClient, network string) (*walletInfos, error) {
|
||||||
// Run a sanity check to see if the devp2p and RPC ports are reachable
|
// Run a sanity check to see if the devp2p and RPC ports are reachable
|
||||||
nodePort := infos.portmap[infos.envvars["NODE_PORT"]]
|
nodePort := infos.portmap[infos.envvars["NODE_PORT"]]
|
||||||
if err = checkPort(client.server, nodePort); err != nil {
|
if err = checkPort(client.server, nodePort); err != nil {
|
||||||
log.Warn(fmt.Sprintf("Wallet devp2p port seems unreachable"), "server", client.server, "port", nodePort, "err", err)
|
log.Warn("Wallet devp2p port seems unreachable", "server", client.server, "port", nodePort, "err", err)
|
||||||
}
|
}
|
||||||
rpcPort := infos.portmap["8545/tcp"]
|
rpcPort := infos.portmap["8545/tcp"]
|
||||||
if err = checkPort(client.server, rpcPort); err != nil {
|
if err = checkPort(client.server, rpcPort); err != nil {
|
||||||
log.Warn(fmt.Sprintf("Wallet RPC port seems unreachable"), "server", client.server, "port", rpcPort, "err", err)
|
log.Warn("Wallet RPC port seems unreachable", "server", client.server, "port", rpcPort, "err", err)
|
||||||
}
|
}
|
||||||
// Assemble and return the useful infos
|
// Assemble and return the useful infos
|
||||||
stats := &walletInfos{
|
stats := &walletInfos{
|
||||||
|
|
|
||||||
|
|
@ -648,7 +648,7 @@ loop:
|
||||||
}
|
}
|
||||||
log.Trace("loop stopped")
|
log.Trace("loop stopped")
|
||||||
|
|
||||||
log.Debug(fmt.Sprintf("shutting down"))
|
log.Debug("shutting down")
|
||||||
if net.conn != nil {
|
if net.conn != nil {
|
||||||
net.conn.Close()
|
net.conn.Close()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ func checkClockDrift() {
|
||||||
}
|
}
|
||||||
if drift < -driftThreshold || drift > driftThreshold {
|
if drift < -driftThreshold || drift > driftThreshold {
|
||||||
warning := fmt.Sprintf("System clock seems off by %v, which can prevent network connectivity", drift)
|
warning := fmt.Sprintf("System clock seems off by %v, which can prevent network connectivity", drift)
|
||||||
howtofix := fmt.Sprintf("Please enable network time synchronisation in system settings")
|
howtofix := "Please enable network time synchronisation in system settings"
|
||||||
separator := strings.Repeat("-", len(warning))
|
separator := strings.Repeat("-", len(warning))
|
||||||
|
|
||||||
log.Warn(separator)
|
log.Warn(separator)
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ func (s *WMailServer) validateRequest(peerID []byte, request *whisper.Envelope)
|
||||||
f := whisper.Filter{KeySym: s.key}
|
f := whisper.Filter{KeySym: s.key}
|
||||||
decrypted := request.Open(&f)
|
decrypted := request.Open(&f)
|
||||||
if decrypted == nil {
|
if decrypted == nil {
|
||||||
log.Warn(fmt.Sprintf("Failed to decrypt p2p request"))
|
log.Warn("Failed to decrypt p2p request")
|
||||||
return false, 0, 0, nil
|
return false, 0, 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,19 +171,19 @@ func (s *WMailServer) validateRequest(peerID []byte, request *whisper.Envelope)
|
||||||
// if you want to check the signature, you can do it here. e.g.:
|
// if you want to check the signature, you can do it here. e.g.:
|
||||||
// if !bytes.Equal(peerID, src) {
|
// if !bytes.Equal(peerID, src) {
|
||||||
if src == nil {
|
if src == nil {
|
||||||
log.Warn(fmt.Sprintf("Wrong signature of p2p request"))
|
log.Warn("Wrong signature of p2p request")
|
||||||
return false, 0, 0, nil
|
return false, 0, 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var bloom []byte
|
var bloom []byte
|
||||||
payloadSize := len(decrypted.Payload)
|
payloadSize := len(decrypted.Payload)
|
||||||
if payloadSize < 8 {
|
if payloadSize < 8 {
|
||||||
log.Warn(fmt.Sprintf("Undersized p2p request"))
|
log.Warn("Undersized p2p request")
|
||||||
return false, 0, 0, nil
|
return false, 0, 0, nil
|
||||||
} else if payloadSize == 8 {
|
} else if payloadSize == 8 {
|
||||||
bloom = whisper.MakeFullNodeBloom()
|
bloom = whisper.MakeFullNodeBloom()
|
||||||
} else if payloadSize < 8+whisper.BloomFilterSize {
|
} else if payloadSize < 8+whisper.BloomFilterSize {
|
||||||
log.Warn(fmt.Sprintf("Undersized bloom filter in p2p request"))
|
log.Warn("Undersized bloom filter in p2p request")
|
||||||
return false, 0, 0, nil
|
return false, 0, 0, nil
|
||||||
} else {
|
} else {
|
||||||
bloom = decrypted.Payload[8 : 8+whisper.BloomFilterSize]
|
bloom = decrypted.Payload[8 : 8+whisper.BloomFilterSize]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue