Add travis.yml
This commit is contained in:
parent
155134204c
commit
6e2523a6cb
2 changed files with 14 additions and 5 deletions
6
.travis.yml
Normal file
6
.travis.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.0
|
||||
- 1.1
|
||||
- tip
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue