Merge pull request #5 from sdboyer/iotas

Idiomatic go: use iotas for const declarations
This commit is contained in:
Jeffrey Wilcke 2014-02-19 11:38:02 +01:00
commit 531b3a96eb
2 changed files with 9 additions and 3 deletions

View File

@ -19,6 +19,9 @@ var MagicToken = []byte{34, 64, 8, 145}
type MsgType byte type MsgType byte
const ( const (
// Values are given explicitly instead of by iota because these values are
// defined by the wire protocol spec; it is easier for humans to ensure
// correctness when values are explicit.
MsgHandshakeTy = 0x00 MsgHandshakeTy = 0x00
MsgDiscTy = 0x01 MsgDiscTy = 0x01
MsgPingTy = 0x02 MsgPingTy = 0x02

View File

@ -23,6 +23,9 @@ const (
type DiscReason byte type DiscReason byte
const ( const (
// Values are given explicitly instead of by iota because these values are
// defined by the wire protocol spec; it is easier for humans to ensure
// correctness when values are explicit.
DiscReRequested = 0x00 DiscReRequested = 0x00
DiscReTcpSysErr = 0x01 DiscReTcpSysErr = 0x01
DiscBadProto = 0x02 DiscBadProto = 0x02
@ -56,9 +59,9 @@ func (d DiscReason) String() string {
type Caps byte type Caps byte
const ( const (
CapPeerDiscTy = 0x01 CapPeerDiscTy = 1 << iota
CapTxTy = 0x02 CapTxTy
CapChainTy = 0x04 CapChainTy
CapDefault = CapChainTy | CapTxTy | CapPeerDiscTy CapDefault = CapChainTy | CapTxTy | CapPeerDiscTy
) )