node: fix linter warnings

This commit is contained in:
tbjump 2023-05-03 22:28:38 +00:00 committed by tbjump
parent e420d26356
commit 91fd0e0517
5 changed files with 8 additions and 11 deletions

View File

@ -1553,11 +1553,8 @@ func runNode(cmd *cobra.Command, args []string) {
}
if shouldStart(publicWeb) {
publicwebService, err := publicwebServiceRunnable(logger, *publicWeb, *publicGRPCSocketPath, publicrpcServer,
publicwebService := publicwebServiceRunnable(logger, *publicWeb, *publicGRPCSocketPath, publicrpcServer,
*tlsHostname, *tlsProdEnv, path.Join(*dataDir, "autocert"))
if err != nil {
log.Fatal("failed to create publicrpc web service", zap.Error(err))
}
if err := supervisor.Run(ctx, "publicweb", publicwebService); err != nil {
return err

View File

@ -24,7 +24,7 @@ func allowCORSWrapper(h http.Handler) http.Handler {
if origin := r.Header.Get("Origin"); origin != "" {
w.Header().Set("Access-Control-Allow-Origin", origin)
if r.Method == "OPTIONS" && r.Header.Get("Access-Control-Request-Method") != "" {
corsPreflightHandler(w, r)
corsPreflightHandler(w)
return
}
}
@ -32,7 +32,7 @@ func allowCORSWrapper(h http.Handler) http.Handler {
})
}
func corsPreflightHandler(w http.ResponseWriter, r *http.Request) {
func corsPreflightHandler(w http.ResponseWriter) {
headers := []string{
"content-type",
"accept",
@ -55,7 +55,7 @@ func publicwebServiceRunnable(
tlsHostname string,
tlsProd bool,
tlsCacheDir string,
) (supervisor.Runnable, error) {
) supervisor.Runnable {
return func(ctx context.Context) error {
conn, err := grpc.DialContext(
ctx,
@ -162,5 +162,5 @@ func publicwebServiceRunnable(
case err := <-errC:
return err
}
}, nil
}
}

View File

@ -30,7 +30,7 @@ func TestKeyIndex(t *testing.T) {
}
for _, testCase := range tests {
t.Run(string(testCase.address), func(t *testing.T) {
t.Run(testCase.address, func(t *testing.T) {
gs := testCase.guardianSet
keyIndex, result := gs.KeyIndex(common.HexToAddress(testCase.address))
assert.Equal(t, result, testCase.result)

View File

@ -23,7 +23,7 @@ func storeVAA(db *Database, v *vaa.VAA) error {
return db.StoreSignedVAA(v)
}
func countVAAs(d *Database, chainId vaa.ChainID) (numThisChain int, numOtherChains int, err error) {
func countVAAs(d *Database, chainId vaa.ChainID) (numThisChain int, numOtherChains int, err error) { //nolint:unparam
if err = d.db.View(func(txn *badger.Txn) error {
opts := badger.DefaultIteratorOptions
opts.PrefetchSize = 10

View File

@ -8,7 +8,7 @@ import (
// DeterministicP2PPrivKeyByIndex generates a deterministic libp2p crypto.PrivateKey from a given index.
func DeterministicP2PPrivKeyByIndex(idx int64) crypto.PrivKey {
r := mathrand.New(mathrand.NewSource(int64(idx))) //#nosec G404 testnet / devnet keys are public knowledge
r := mathrand.New(mathrand.NewSource(idx)) //#nosec G404 testnet / devnet keys are public knowledge
priv, _, err := crypto.GenerateKeyPairWithReader(crypto.Ed25519, -1, r)
if err != nil {
panic(err)