Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: all golint warnings removed #16852

Merged
merged 2 commits into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/hexutil/hexutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (

const uintBits = 32 << (uint64(^uint(0)) >> 63)

// Errors
var (
ErrEmptyString = &decError{"empty hex string"}
ErrSyntax = &decError{"invalid hex string"}
Expand Down
3 changes: 2 additions & 1 deletion common/math/big.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)

Expand Down
2 changes: 1 addition & 1 deletion common/math/integer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"strconv"
)

// Integer limit values.
const (
// Integer limit values.
MaxInt8 = 1<<7 - 1
MinInt8 = -1 << 7
MaxInt16 = 1<<15 - 1
Expand Down
6 changes: 4 additions & 2 deletions common/mclock/mclock.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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())
}
9 changes: 5 additions & 4 deletions common/number/int.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -181,7 +183,6 @@ func (i *Number) FirstBitSet() int {
}

// Variables

var (
Zero = Uint(0)
One = Uint(1)
Expand Down
1 change: 1 addition & 0 deletions common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/crypto/sha3"
)

// Lengths of hashes and addresses in bytes.
const (
HashLength = 32
AddressLength = 20
Expand Down