From 4f2fc6c1e69d41baf187332ee08fbd2b296f21ed Mon Sep 17 00:00:00 2001 From: Mikio Hara Date: Mon, 26 Oct 2015 12:18:18 +0900 Subject: [PATCH] ipv6: move unexposed error values into helper.go Change-Id: Iac5121529bb1044e64724937f5d5e2bff8a336a6 Reviewed-on: https://go-review.googlesource.com/16321 Reviewed-by: Ian Lance Taylor --- ipv6/control.go | 7 ------- ipv6/header.go | 3 +-- ipv6/helper.go | 8 +++++++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ipv6/control.go b/ipv6/control.go index 27f1d2f8..8f065aaf 100644 --- a/ipv6/control.go +++ b/ipv6/control.go @@ -5,18 +5,11 @@ package ipv6 import ( - "errors" "fmt" "net" "sync" ) -var ( - errMissingAddress = errors.New("missing address") - errInvalidConnType = errors.New("invalid conn type") - errNoSuchInterface = errors.New("no such interface") -) - // Note that RFC 3542 obsoletes RFC 2292 but OS X Snow Leopard and the // former still support RFC 2292 only. Please be aware that almost // all protocol implementations prohibit using a combination of RFC diff --git a/ipv6/header.go b/ipv6/header.go index 3c38b99c..b842b6b8 100644 --- a/ipv6/header.go +++ b/ipv6/header.go @@ -5,7 +5,6 @@ package ipv6 import ( - "errors" "fmt" "net" ) @@ -37,7 +36,7 @@ func (h *Header) String() string { // ParseHeader parses b as an IPv6 base header. func ParseHeader(b []byte) (*Header, error) { if len(b) < HeaderLen { - return nil, errors.New("header too short") + return nil, errHeaderTooShort } h := &Header{ Version: int(b[0]) >> 4, diff --git a/ipv6/helper.go b/ipv6/helper.go index 64934848..4a6f1069 100644 --- a/ipv6/helper.go +++ b/ipv6/helper.go @@ -9,7 +9,13 @@ import ( "net" ) -var errOpNoSupport = errors.New("operation not supported") +var ( + errMissingAddress = errors.New("missing address") + errHeaderTooShort = errors.New("header too short") + errInvalidConnType = errors.New("invalid conn type") + errOpNoSupport = errors.New("operation not supported") + errNoSuchInterface = errors.New("no such interface") +) func boolint(b bool) int { if b {