aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Kisiel <kamil@kamilkisiel.net>2013-12-01 01:25:48 +0400
committerKamil Kisiel <kamil@kamilkisiel.net>2013-12-01 01:25:48 +0400
commit6e2523a6cb00e3df30adb7c3d188f33d39dd42d6 (patch)
tree97280c4391893e020dce55fae08700e40b6ff82b
parent155134204c034796bcd7a72c1e1b53ba005735c6 (diff)
Add travis.yml
-rw-r--r--.travis.yml6
-rw-r--r--securecookie.go13
2 files changed, 14 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..70e012b
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,6 @@
+language: go
+
+go:
+ - 1.0
+ - 1.1
+ - tip
diff --git a/securecookie.go b/securecookie.go
index 2f34bfe..9147f6a 100644
--- a/securecookie.go
+++ b/securecookie.go
@@ -22,6 +22,11 @@ import (
"time"
)
+var (
+ errNoCodecs = errors.New("securecookie: no codecs provided")
+ errHashKeyNotSet = errors.New("securecookie: hash key is not set")
+)
+
// Codec defines an interface to encode and decode cookie values.
type Codec interface {
Encode(name string, value interface{}) (string, error)
@@ -46,7 +51,7 @@ func New(hashKey, blockKey []byte) *SecureCookie {
maxLength: 4096,
}
if hashKey == nil {
- s.err = errors.New("securecookie: hash key is not set")
+ s.err = errHashKeyNotSet
}
if blockKey != nil {
s.BlockFunc(aes.NewCipher)
@@ -130,7 +135,7 @@ func (s *SecureCookie) Encode(name string, value interface{}) (string, error) {
return "", s.err
}
if s.hashKey == nil {
- s.err = errors.New("securecookie: hash key is not set")
+ s.err = errHashKeyNotSet
return "", s.err
}
var err error
@@ -174,7 +179,7 @@ func (s *SecureCookie) Decode(name, value string, dst interface{}) error {
return s.err
}
if s.hashKey == nil {
- s.err = errors.New("securecookie: hash key is not set")
+ s.err = errHashKeyNotSet
return s.err
}
// 1. Check length.
@@ -357,8 +362,6 @@ func CodecsFromPairs(keyPairs ...[]byte) []Codec {
return codecs
}
-var errNoCodecs = errors.New("securecookie: no codecs provided")
-
// EncodeMulti encodes a cookie value using a group of codecs.
//
// The codecs are tried in order. Multiple codecs are accepted to allow