Commit d0fd8d6f authored by kiel barry's avatar kiel barry Committed by Péter Szilágyi

common: all golint warnings removed (#16852)

* common: all golint warnings removed

* common: fixups
parent cfde0b5f
...@@ -39,6 +39,7 @@ import ( ...@@ -39,6 +39,7 @@ import (
const uintBits = 32 << (uint64(^uint(0)) >> 63) const uintBits = 32 << (uint64(^uint(0)) >> 63)
// Errors
var ( var (
ErrEmptyString = &decError{"empty hex string"} ErrEmptyString = &decError{"empty hex string"}
ErrSyntax = &decError{"invalid hex string"} ErrSyntax = &decError{"invalid hex string"}
......
...@@ -22,12 +22,13 @@ import ( ...@@ -22,12 +22,13 @@ import (
"math/big" "math/big"
) )
// Various big integer limit values.
var ( var (
tt255 = BigPow(2, 255) tt255 = BigPow(2, 255)
tt256 = BigPow(2, 256) tt256 = BigPow(2, 256)
tt256m1 = new(big.Int).Sub(tt256, big.NewInt(1)) tt256m1 = new(big.Int).Sub(tt256, big.NewInt(1))
MaxBig256 = new(big.Int).Set(tt256m1)
tt63 = BigPow(2, 63) tt63 = BigPow(2, 63)
MaxBig256 = new(big.Int).Set(tt256m1)
MaxBig63 = new(big.Int).Sub(tt63, big.NewInt(1)) MaxBig63 = new(big.Int).Sub(tt63, big.NewInt(1))
) )
......
...@@ -21,8 +21,8 @@ import ( ...@@ -21,8 +21,8 @@ import (
"strconv" "strconv"
) )
// Integer limit values.
const ( const (
// Integer limit values.
MaxInt8 = 1<<7 - 1 MaxInt8 = 1<<7 - 1
MinInt8 = -1 << 7 MinInt8 = -1 << 7
MaxInt16 = 1<<15 - 1 MaxInt16 = 1<<15 - 1
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// package mclock is a wrapper for a monotonic clock source // Package mclock is a wrapper for a monotonic clock source
package mclock package mclock
import ( import (
...@@ -23,8 +23,10 @@ import ( ...@@ -23,8 +23,10 @@ import (
"github.com/aristanetworks/goarista/monotime" "github.com/aristanetworks/goarista/monotime"
) )
type AbsTime time.Duration // absolute monotonic time // AbsTime represents absolute monotonic time.
type AbsTime time.Duration
// Now returns the current absolute monotonic time.
func Now() AbsTime { func Now() AbsTime {
return AbsTime(monotime.Now()) return AbsTime(monotime.Now())
} }
...@@ -22,9 +22,11 @@ import ( ...@@ -22,9 +22,11 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
) )
var tt256 = new(big.Int).Lsh(big.NewInt(1), 256) var (
var tt256m1 = new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(1)) tt256 = new(big.Int).Lsh(big.NewInt(1), 256)
var tt255 = new(big.Int).Lsh(big.NewInt(1), 255) tt256m1 = new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(1))
tt255 = new(big.Int).Lsh(big.NewInt(1), 255)
)
func limitUnsigned256(x *Number) *Number { func limitUnsigned256(x *Number) *Number {
x.num.And(x.num, tt256m1) x.num.And(x.num, tt256m1)
...@@ -181,7 +183,6 @@ func (i *Number) FirstBitSet() int { ...@@ -181,7 +183,6 @@ func (i *Number) FirstBitSet() int {
} }
// Variables // Variables
var ( var (
Zero = Uint(0) Zero = Uint(0)
One = Uint(1) One = Uint(1)
......
...@@ -29,6 +29,7 @@ import ( ...@@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/crypto/sha3" "github.com/ethereum/go-ethereum/crypto/sha3"
) )
// Lengths of hashes and addresses in bytes.
const ( const (
HashLength = 32 HashLength = 32
AddressLength = 20 AddressLength = 20
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment