aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorkiel barry <kiel.j.barry@gmail.com>2018-06-14 17:52:50 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-06-14 17:52:50 +0800
commitd0fd8d6fc29ec859650adf30718e2b06786e854f (patch)
tree5eafbd61e5886245ab48c1670337ca5d6be14718 /common
parentcfde0b5f5204647e356a229463337b104552fe2a (diff)
downloadgo-tangerine-d0fd8d6fc29ec859650adf30718e2b06786e854f.tar.gz
go-tangerine-d0fd8d6fc29ec859650adf30718e2b06786e854f.tar.zst
go-tangerine-d0fd8d6fc29ec859650adf30718e2b06786e854f.zip
common: all golint warnings removed (#16852)
* common: all golint warnings removed * common: fixups
Diffstat (limited to 'common')
-rw-r--r--common/hexutil/hexutil.go1
-rw-r--r--common/math/big.go3
-rw-r--r--common/math/integer.go2
-rw-r--r--common/mclock/mclock.go6
-rw-r--r--common/number/int.go9
-rw-r--r--common/types.go1
6 files changed, 14 insertions, 8 deletions
diff --git a/common/hexutil/hexutil.go b/common/hexutil/hexutil.go
index 02c488a3f..46223a281 100644
--- a/common/hexutil/hexutil.go
+++ b/common/hexutil/hexutil.go
@@ -39,6 +39,7 @@ import (
const uintBits = 32 << (uint64(^uint(0)) >> 63)
+// Errors
var (
ErrEmptyString = &decError{"empty hex string"}
ErrSyntax = &decError{"invalid hex string"}
diff --git a/common/math/big.go b/common/math/big.go
index dbf2770a9..9d2e7946d 100644
--- a/common/math/big.go
+++ b/common/math/big.go
@@ -22,12 +22,13 @@ import (
"math/big"
)
+// Various big integer limit values.
var (
tt255 = BigPow(2, 255)
tt256 = BigPow(2, 256)
tt256m1 = new(big.Int).Sub(tt256, big.NewInt(1))
- MaxBig256 = new(big.Int).Set(tt256m1)
tt63 = BigPow(2, 63)
+ MaxBig256 = new(big.Int).Set(tt256m1)
MaxBig63 = new(big.Int).Sub(tt63, big.NewInt(1))
)
diff --git a/common/math/integer.go b/common/math/integer.go
index 7eff4d3b0..93b1d036d 100644
--- a/common/math/integer.go
+++ b/common/math/integer.go
@@ -21,8 +21,8 @@ import (
"strconv"
)
+// Integer limit values.
const (
- // Integer limit values.
MaxInt8 = 1<<7 - 1
MinInt8 = -1 << 7
MaxInt16 = 1<<15 - 1
diff --git a/common/mclock/mclock.go b/common/mclock/mclock.go
index 92005252e..02608d17b 100644
--- a/common/mclock/mclock.go
+++ b/common/mclock/mclock.go
@@ -14,7 +14,7 @@
// 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/>.
-// package mclock is a wrapper for a monotonic clock source
+// Package mclock is a wrapper for a monotonic clock source
package mclock
import (
@@ -23,8 +23,10 @@ import (
"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 {
return AbsTime(monotime.Now())
}
diff --git a/common/number/int.go b/common/number/int.go
index 5b5066970..0cac94254 100644
--- a/common/number/int.go
+++ b/common/number/int.go
@@ -22,9 +22,11 @@ import (
"github.com/ethereum/go-ethereum/common"
)
-var tt256 = new(big.Int).Lsh(big.NewInt(1), 256)
-var tt256m1 = new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(1))
-var tt255 = new(big.Int).Lsh(big.NewInt(1), 255)
+var (
+ tt256 = new(big.Int).Lsh(big.NewInt(1), 256)
+ 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 {
x.num.And(x.num, tt256m1)
@@ -181,7 +183,6 @@ func (i *Number) FirstBitSet() int {
}
// Variables
-
var (
Zero = Uint(0)
One = Uint(1)
diff --git a/common/types.go b/common/types.go
index 12c26d94b..4d374ad24 100644
--- a/common/types.go
+++ b/common/types.go
@@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/crypto/sha3"
)
+// Lengths of hashes and addresses in bytes.
const (
HashLength = 32
AddressLength = 20