From ddb735fe4cbf2e249be7582528399d58f75a53f9 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Fri, 15 Oct 2021 15:16:58 -0700 Subject: [PATCH] [lbry] fixups lint warnings --- blockchain/validate.go | 5 +---- btcec/genprecomps.go | 1 + btcec/gensecp256k1.go | 1 + limits/limits_unix.go | 1 + rpcclient/infrastructure.go | 1 + signalsigterm.go | 1 + upnp.go | 4 ++-- 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/blockchain/validate.go b/blockchain/validate.go index 19183aa9..85946611 100644 --- a/blockchain/validate.go +++ b/blockchain/validate.go @@ -224,10 +224,7 @@ func withinLevelBounds(reduction int64, lv int64) bool { return false } reduction++ - if ((reduction*reduction + reduction) >> 1) <= lv { - return false - } - return true + return ((reduction*reduction + reduction) >> 1) > lv } // CheckTransactionSanity performs some preliminary checks on a transaction to diff --git a/btcec/genprecomps.go b/btcec/genprecomps.go index f09ab311..ea40ceac 100644 --- a/btcec/genprecomps.go +++ b/btcec/genprecomps.go @@ -5,6 +5,7 @@ // This file is ignored during the regular build due to the following build tag. // It is called by go generate and used to automatically generate pre-computed // tables used to accelerate operations. +//go:build ignore // +build ignore package main diff --git a/btcec/gensecp256k1.go b/btcec/gensecp256k1.go index 1928702d..e079f553 100644 --- a/btcec/gensecp256k1.go +++ b/btcec/gensecp256k1.go @@ -4,6 +4,7 @@ // This file is ignored during the regular build due to the following build tag. // This build tag is set during go generate. +//go:build gensecp256k1 // +build gensecp256k1 package btcec diff --git a/limits/limits_unix.go b/limits/limits_unix.go index 7ebf8667..7972b05e 100644 --- a/limits/limits_unix.go +++ b/limits/limits_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. +//go:build !windows && !plan9 // +build !windows,!plan9 package limits diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index 592c0dde..aedf18b7 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -1382,6 +1382,7 @@ func dial(config *ConnConfig) (*websocket.Conn, error) { // cases above apply. return nil, errors.New(resp.Status) } + resp.Body.Close() return wsConn, nil } diff --git a/signalsigterm.go b/signalsigterm.go index 83165501..63bdb9c0 100644 --- a/signalsigterm.go +++ b/signalsigterm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package main diff --git a/upnp.go b/upnp.go index 402924f5..d07d5ce9 100644 --- a/upnp.go +++ b/upnp.go @@ -136,7 +136,7 @@ func Discover() (nat NAT, err error) { return } err = errors.New("UPnP port discovery failed") - return + return nat, err } // service represents the Service type in an UPnP xml description. @@ -269,7 +269,7 @@ func getServiceURL(rootURL string) (url string, err error) { return } url = combineURL(rootURL, d.ControlURL) - return + return url, err } // combineURL appends subURL onto rootURL.