👌Linting

This commit is contained in:
Bruce Marriner 2019-04-10 01:12:21 +00:00
parent c3f5528809
commit 272c8fb215
2 changed files with 9 additions and 9 deletions

View File

@ -16,19 +16,19 @@ var (
// You may customize this to set a different epoch for your application. // You may customize this to set a different epoch for your application.
Epoch int64 = 1288834974657 Epoch int64 = 1288834974657
// Number of bits to use for Node // NodeBits holds the number of bits to use for Node
// Remember, you have a total 22 bits to share between Node/Step // Remember, you have a total 22 bits to share between Node/Step
NodeBits uint8 = 10 NodeBits uint8 = 10
// Number of bits to use for Step // StepBits holds the number of bits to use for Step
// Remember, you have a total 22 bits to share between Node/Step // Remember, you have a total 22 bits to share between Node/Step
StepBits uint8 = 12 StepBits uint8 = 12
nodeMax int64 = -1 ^ (-1 << NodeBits) nodeMax int64 = -1 ^ (-1 << NodeBits)
nodeMask int64 = nodeMax << StepBits nodeMask = nodeMax << StepBits
stepMask int64 = -1 ^ (-1 << StepBits) stepMask int64 = -1 ^ (-1 << StepBits)
timeShift uint8 = NodeBits + StepBits timeShift = NodeBits + StepBits
nodeShift uint8 = StepBits nodeShift = StepBits
) )
const encodeBase32Map = "ybndrfg8ejkmcpqxot1uwisza345h769" const encodeBase32Map = "ybndrfg8ejkmcpqxot1uwisza345h769"
@ -95,7 +95,7 @@ func NewNode(node int64) (*Node, error) {
stepMask = -1 ^ (-1 << StepBits) stepMask = -1 ^ (-1 << StepBits)
timeShift = NodeBits + StepBits timeShift = NodeBits + StepBits
nodeShift = StepBits nodeShift = StepBits
if node < 0 || node > nodeMax { if node < 0 || node > nodeMax {
return nil, errors.New("Node number must be between 0 and " + strconv.FormatInt(nodeMax, 10)) return nil, errors.New("Node number must be between 0 and " + strconv.FormatInt(nodeMax, 10))
} }

View File

@ -50,7 +50,7 @@ func TestMarshalsIntBytes(t *testing.T) {
func TestUnmarshalJSON(t *testing.T) { func TestUnmarshalJSON(t *testing.T) {
tt := []struct { tt := []struct {
json string json string
expectedId ID expectedID ID
expectedErr error expectedErr error
}{ }{
{`"13587"`, 13587, nil}, {`"13587"`, 13587, nil},
@ -65,8 +65,8 @@ func TestUnmarshalJSON(t *testing.T) {
t.Errorf("Expected to get error '%s' decoding JSON, but got '%s'", tc.expectedErr, err) t.Errorf("Expected to get error '%s' decoding JSON, but got '%s'", tc.expectedErr, err)
} }
if id != tc.expectedId { if id != tc.expectedID {
t.Errorf("Expected to get ID '%s' decoding JSON, but got '%s'", tc.expectedId, id) t.Errorf("Expected to get ID '%s' decoding JSON, but got '%s'", tc.expectedID, id)
} }
} }
} }