Bump go-connections and canonical go dependencies to the latest version

Logging bugfix for github.com/docker/go-connections
github.com/docker/go rebased to go 1.6

Signed-off-by: Ying Li <ying.li@docker.com>
This commit is contained in:
Ying Li 2016-03-08 11:16:57 -08:00
parent 40a24c3793
commit dc377b3ceb
7 changed files with 163 additions and 92 deletions

8
Godeps/Godeps.json generated
View File

@ -97,13 +97,13 @@
},
{
"ImportPath": "github.com/docker/go-connections/tlsconfig",
"Comment": "v0.1.2-7-g6e4c13d",
"Rev": "6e4c13dc022344c3623c9eacbaf7cfd0fa9fcae3"
"Comment": "v0.1.2-16-gf549a93",
"Rev": "f549a9393d05688dff0992ef3efd8bbe6c628aeb"
},
{
"ImportPath": "github.com/docker/go/canonical/json",
"Comment": "v1.5.1-1-1-gbaf439e",
"Rev": "baf439e6c161bd2106346fc8022b74ac2444e311"
"Comment": "v1.5.1-1-6-gd30aec9",
"Rev": "d30aec9fd63c35133f8f79c3412ad91a3b08be06"
},
{
"ImportPath": "github.com/docker/libtrust",

View File

@ -72,12 +72,7 @@ func certPool(caFile string) (*x509.CertPool, error) {
if !certPool.AppendCertsFromPEM(pem) {
return nil, fmt.Errorf("failed to append certificates from PEM file: %q", caFile)
}
s := certPool.Subjects()
subjects := make([]string, len(s))
for i, subject := range s {
subjects[i] = string(subject)
}
logrus.Debugf("Trusting certs with subjects: %v", subjects)
logrus.Debugf("Trusting %d certs", len(certPool.Subjects()))
return certPool, nil
}

View File

@ -37,6 +37,7 @@ import (
// To unmarshal JSON into a struct, Unmarshal matches incoming object
// keys to the keys used by Marshal (either the struct field name or its tag),
// preferring an exact match but also accepting a case-insensitive match.
// Unmarshal will only set exported fields of the struct.
//
// To unmarshal JSON into an interface value,
// Unmarshal stores one of these in the interface value:
@ -48,16 +49,26 @@ import (
// map[string]interface{}, for JSON objects
// nil for JSON null
//
// To unmarshal a JSON array into a slice, Unmarshal resets the slice to nil
// and then appends each element to the slice.
// To unmarshal a JSON array into a slice, Unmarshal resets the slice length
// to zero and then appends each element to the slice.
// As a special case, to unmarshal an empty JSON array into a slice,
// Unmarshal replaces the slice with a new empty slice.
//
// To unmarshal a JSON object into a map, Unmarshal replaces the map
// with an empty map and then adds key-value pairs from the object to
// the map.
// To unmarshal a JSON array into a Go array, Unmarshal decodes
// JSON array elements into corresponding Go array elements.
// If the Go array is smaller than the JSON array,
// the additional JSON array elements are discarded.
// If the JSON array is smaller than the Go array,
// the additional Go array elements are set to zero values.
//
// To unmarshal a JSON object into a string-keyed map, Unmarshal first
// establishes a map to use, If the map is nil, Unmarshal allocates a new map.
// Otherwise Unmarshal reuses the existing map, keeping existing entries.
// Unmarshal then stores key-value pairs from the JSON object into the map.
//
// If a JSON value is not appropriate for a given target type,
// or if a JSON number overflows the target type, Unmarshal
// skips that field and completes the unmarshalling as best it can.
// skips that field and completes the unmarshaling as best it can.
// If no more serious errors are encountered, Unmarshal returns
// an UnmarshalTypeError describing the earliest such error.
//
@ -174,6 +185,66 @@ func (n Number) Int64() (int64, error) {
return strconv.ParseInt(string(n), 10, 64)
}
// isValidNumber reports whether s is a valid JSON number literal.
func isValidNumber(s string) bool {
// This function implements the JSON numbers grammar.
// See https://tools.ietf.org/html/rfc7159#section-6
// and http://json.org/number.gif
if s == "" {
return false
}
// Optional -
if s[0] == '-' {
s = s[1:]
if s == "" {
return false
}
}
// Digits
switch {
default:
return false
case s[0] == '0':
s = s[1:]
case '1' <= s[0] && s[0] <= '9':
s = s[1:]
for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
s = s[1:]
}
}
// . followed by 1 or more digits.
if len(s) >= 2 && s[0] == '.' && '0' <= s[1] && s[1] <= '9' {
s = s[2:]
for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
s = s[1:]
}
}
// e or E followed by an optional - or + and
// 1 or more digits.
if len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') {
s = s[1:]
if s[0] == '+' || s[0] == '-' {
s = s[1:]
if s == "" {
return false
}
}
for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
s = s[1:]
}
}
// Make sure we are at the end.
return s == ""
}
// decodeState represents the state while decoding a JSON value.
type decodeState struct {
data []byte
@ -242,7 +313,7 @@ func (d *decodeState) scanWhile(op int) int {
newOp = d.scan.eof()
d.off = len(d.data) + 1 // mark processed EOF with len+1
} else {
c := int(d.data[d.off])
c := d.data[d.off]
d.off++
newOp = d.scan.step(&d.scan, c)
}
@ -758,7 +829,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
d.saveError(err)
break
}
v.Set(reflect.ValueOf(b[0:n]))
v.SetBytes(b[:n])
case reflect.String:
v.SetString(string(s))
case reflect.Interface:
@ -782,6 +853,9 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
default:
if v.Kind() == reflect.String && v.Type() == numberType {
v.SetString(s)
if !isValidNumber(s) {
d.error(fmt.Errorf("json: invalid number literal, trying to unmarshal %q into Number", item))
}
break
}
if fromQuoted {

View File

@ -14,6 +14,7 @@ import (
"bytes"
"encoding"
"encoding/base64"
"fmt"
"math"
"reflect"
"runtime"
@ -30,7 +31,10 @@ import (
// Marshal traverses the value v recursively.
// If an encountered value implements the Marshaler interface
// and is not a nil pointer, Marshal calls its MarshalJSON method
// to produce JSON. The nil pointer exception is not strictly necessary
// to produce JSON. If no MarshalJSON method is present but the
// value implements encoding.TextMarshaler instead, Marshal calls
// its MarshalText method.
// The nil pointer exception is not strictly necessary
// but mimics a similar, necessary exception in the behavior of
// UnmarshalJSON.
//
@ -457,12 +461,10 @@ func textMarshalerEncoder(e *encodeState, v reflect.Value, quoted bool) {
}
m := v.Interface().(encoding.TextMarshaler)
b, err := m.MarshalText()
if err == nil {
_, err = e.stringBytes(b)
}
if err != nil {
e.error(&MarshalerError{v.Type(), err})
}
e.stringBytes(b)
}
func addrTextMarshalerEncoder(e *encodeState, v reflect.Value, quoted bool) {
@ -473,12 +475,10 @@ func addrTextMarshalerEncoder(e *encodeState, v reflect.Value, quoted bool) {
}
m := va.Interface().(encoding.TextMarshaler)
b, err := m.MarshalText()
if err == nil {
_, err = e.stringBytes(b)
}
if err != nil {
e.error(&MarshalerError{v.Type(), err})
}
e.stringBytes(b)
}
func boolEncoder(e *encodeState, v reflect.Value, quoted bool) {
@ -548,9 +548,14 @@ var (
func stringEncoder(e *encodeState, v reflect.Value, quoted bool) {
if v.Type() == numberType {
numStr := v.String()
// In Go1.5 the empty string encodes to "0", while this is not a valid number literal
// we keep compatibility so check validity after this.
if numStr == "" {
numStr = "0" // Number's zero-val
}
if !isValidNumber(numStr) {
e.error(fmt.Errorf("json: invalid number literal %q", numStr))
}
e.WriteString(numStr)
return
}
@ -798,7 +803,7 @@ func (sv stringValues) Less(i, j int) bool { return sv.get(i) < sv.get(j) }
func (sv stringValues) get(i int) string { return sv[i].String() }
// NOTE: keep in sync with stringBytes below.
func (e *encodeState) string(s string) (int, error) {
func (e *encodeState) string(s string) int {
len0 := e.Len()
e.WriteByte('"')
start := 0
@ -876,11 +881,11 @@ func (e *encodeState) string(s string) (int, error) {
e.WriteString(s[start:])
}
e.WriteByte('"')
return e.Len() - len0, nil
return e.Len() - len0
}
// NOTE: keep in sync with string above.
func (e *encodeState) stringBytes(s []byte) (int, error) {
func (e *encodeState) stringBytes(s []byte) int {
len0 := e.Len()
e.WriteByte('"')
start := 0
@ -958,7 +963,7 @@ func (e *encodeState) stringBytes(s []byte) (int, error) {
e.Write(s[start:])
}
e.WriteByte('"')
return e.Len() - len0, nil
return e.Len() - len0
}
// A field represents a single field found in a struct.
@ -1052,7 +1057,7 @@ func typeFields(t reflect.Type) []field {
// Scan f.typ for fields to include.
for i := 0; i < f.typ.NumField(); i++ {
sf := f.typ.Field(i)
if sf.PkgPath != "" { // unexported
if sf.PkgPath != "" && !sf.Anonymous { // unexported
continue
}
tag := sf.Tag.Get("json")

View File

@ -36,7 +36,7 @@ func compact(dst *bytes.Buffer, src []byte, escape bool) error {
dst.WriteByte(hex[src[i+2]&0xF])
start = i + 3
}
v := scan.step(&scan, int(c))
v := scan.step(&scan, c)
if v >= scanSkipSpace {
if v == scanError {
break
@ -70,8 +70,12 @@ func newline(dst *bytes.Buffer, prefix, indent string, depth int) {
// indented line beginning with prefix followed by one or more
// copies of indent according to the indentation nesting.
// The data appended to dst does not begin with the prefix nor
// any indentation, and has no trailing newline, to make it
// easier to embed inside other formatted JSON data.
// any indentation, to make it easier to embed inside other formatted JSON data.
// Although leading space characters (space, tab, carriage return, newline)
// at the beginning of src are dropped, trailing space characters
// at the end of src are preserved and copied to dst.
// For example, if src has no trailing spaces, neither will dst;
// if src ends in a trailing newline, so will dst.
func Indent(dst *bytes.Buffer, src []byte, prefix, indent string) error {
origLen := dst.Len()
var scan scanner
@ -80,7 +84,7 @@ func Indent(dst *bytes.Buffer, src []byte, prefix, indent string) error {
depth := 0
for _, c := range src {
scan.bytes++
v := scan.step(&scan, int(c))
v := scan.step(&scan, c)
if v == scanSkipSpace {
continue
}

View File

@ -21,7 +21,7 @@ func checkValid(data []byte, scan *scanner) error {
scan.reset()
for _, c := range data {
scan.bytes++
if scan.step(scan, int(c)) == scanError {
if scan.step(scan, c) == scanError {
return scan.err
}
}
@ -37,7 +37,7 @@ func checkValid(data []byte, scan *scanner) error {
func nextValue(data []byte, scan *scanner) (value, rest []byte, err error) {
scan.reset()
for i, c := range data {
v := scan.step(scan, int(c))
v := scan.step(scan, c)
if v >= scanEndObject {
switch v {
// probe the scanner with a space to determine whether we will
@ -50,7 +50,7 @@ func nextValue(data []byte, scan *scanner) (value, rest []byte, err error) {
case scanError:
return nil, nil, scan.err
case scanEnd:
return data[0:i], data[i:], nil
return data[:i], data[i:], nil
}
}
}
@ -85,7 +85,7 @@ type scanner struct {
// Also tried using an integer constant and a single func
// with a switch, but using the func directly was 10% faster
// on a 64-bit Mac Mini, and it's nicer to read.
step func(*scanner, int) int
step func(*scanner, byte) int
// Reached end of top-level value.
endTop bool
@ -99,7 +99,7 @@ type scanner struct {
// 1-byte redo (see undo method)
redo bool
redoCode int
redoState func(*scanner, int) int
redoState func(*scanner, byte) int
// total bytes consumed, updated by decoder.Decode
bytes int64
@ -188,13 +188,13 @@ func (s *scanner) popParseState() {
}
}
func isSpace(c rune) bool {
func isSpace(c byte) bool {
return c == ' ' || c == '\t' || c == '\r' || c == '\n'
}
// stateBeginValueOrEmpty is the state after reading `[`.
func stateBeginValueOrEmpty(s *scanner, c int) int {
if c <= ' ' && isSpace(rune(c)) {
func stateBeginValueOrEmpty(s *scanner, c byte) int {
if c <= ' ' && isSpace(c) {
return scanSkipSpace
}
if c == ']' {
@ -204,8 +204,8 @@ func stateBeginValueOrEmpty(s *scanner, c int) int {
}
// stateBeginValue is the state at the beginning of the input.
func stateBeginValue(s *scanner, c int) int {
if c <= ' ' && isSpace(rune(c)) {
func stateBeginValue(s *scanner, c byte) int {
if c <= ' ' && isSpace(c) {
return scanSkipSpace
}
switch c {
@ -244,8 +244,8 @@ func stateBeginValue(s *scanner, c int) int {
}
// stateBeginStringOrEmpty is the state after reading `{`.
func stateBeginStringOrEmpty(s *scanner, c int) int {
if c <= ' ' && isSpace(rune(c)) {
func stateBeginStringOrEmpty(s *scanner, c byte) int {
if c <= ' ' && isSpace(c) {
return scanSkipSpace
}
if c == '}' {
@ -257,8 +257,8 @@ func stateBeginStringOrEmpty(s *scanner, c int) int {
}
// stateBeginString is the state after reading `{"key": value,`.
func stateBeginString(s *scanner, c int) int {
if c <= ' ' && isSpace(rune(c)) {
func stateBeginString(s *scanner, c byte) int {
if c <= ' ' && isSpace(c) {
return scanSkipSpace
}
if c == '"' {
@ -270,7 +270,7 @@ func stateBeginString(s *scanner, c int) int {
// stateEndValue is the state after completing a value,
// such as after reading `{}` or `true` or `["x"`.
func stateEndValue(s *scanner, c int) int {
func stateEndValue(s *scanner, c byte) int {
n := len(s.parseState)
if n == 0 {
// Completed top-level before the current byte.
@ -278,7 +278,7 @@ func stateEndValue(s *scanner, c int) int {
s.endTop = true
return stateEndTop(s, c)
}
if c <= ' ' && isSpace(rune(c)) {
if c <= ' ' && isSpace(c) {
s.step = stateEndValue
return scanSkipSpace
}
@ -319,7 +319,7 @@ func stateEndValue(s *scanner, c int) int {
// stateEndTop is the state after finishing the top-level value,
// such as after reading `{}` or `[1,2,3]`.
// Only space characters should be seen now.
func stateEndTop(s *scanner, c int) int {
func stateEndTop(s *scanner, c byte) int {
if c != ' ' && c != '\t' && c != '\r' && c != '\n' {
// Complain about non-space byte on next call.
s.error(c, "after top-level value")
@ -328,7 +328,7 @@ func stateEndTop(s *scanner, c int) int {
}
// stateInString is the state after reading `"`.
func stateInString(s *scanner, c int) int {
func stateInString(s *scanner, c byte) int {
if c == '"' {
s.step = stateEndValue
return scanContinue
@ -344,13 +344,12 @@ func stateInString(s *scanner, c int) int {
}
// stateInStringEsc is the state after reading `"\` during a quoted string.
func stateInStringEsc(s *scanner, c int) int {
func stateInStringEsc(s *scanner, c byte) int {
switch c {
case 'b', 'f', 'n', 'r', 't', '\\', '/', '"':
s.step = stateInString
return scanContinue
}
if c == 'u' {
case 'u':
s.step = stateInStringEscU
return scanContinue
}
@ -358,7 +357,7 @@ func stateInStringEsc(s *scanner, c int) int {
}
// stateInStringEscU is the state after reading `"\u` during a quoted string.
func stateInStringEscU(s *scanner, c int) int {
func stateInStringEscU(s *scanner, c byte) int {
if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
s.step = stateInStringEscU1
return scanContinue
@ -368,7 +367,7 @@ func stateInStringEscU(s *scanner, c int) int {
}
// stateInStringEscU1 is the state after reading `"\u1` during a quoted string.
func stateInStringEscU1(s *scanner, c int) int {
func stateInStringEscU1(s *scanner, c byte) int {
if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
s.step = stateInStringEscU12
return scanContinue
@ -378,7 +377,7 @@ func stateInStringEscU1(s *scanner, c int) int {
}
// stateInStringEscU12 is the state after reading `"\u12` during a quoted string.
func stateInStringEscU12(s *scanner, c int) int {
func stateInStringEscU12(s *scanner, c byte) int {
if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
s.step = stateInStringEscU123
return scanContinue
@ -388,7 +387,7 @@ func stateInStringEscU12(s *scanner, c int) int {
}
// stateInStringEscU123 is the state after reading `"\u123` during a quoted string.
func stateInStringEscU123(s *scanner, c int) int {
func stateInStringEscU123(s *scanner, c byte) int {
if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
s.step = stateInString
return scanContinue
@ -398,7 +397,7 @@ func stateInStringEscU123(s *scanner, c int) int {
}
// stateNeg is the state after reading `-` during a number.
func stateNeg(s *scanner, c int) int {
func stateNeg(s *scanner, c byte) int {
if c == '0' {
s.step = state0
return scanContinue
@ -412,7 +411,7 @@ func stateNeg(s *scanner, c int) int {
// state1 is the state after reading a non-zero integer during a number,
// such as after reading `1` or `100` but not `0`.
func state1(s *scanner, c int) int {
func state1(s *scanner, c byte) int {
if '0' <= c && c <= '9' {
s.step = state1
return scanContinue
@ -421,7 +420,7 @@ func state1(s *scanner, c int) int {
}
// state0 is the state after reading `0` during a number.
func state0(s *scanner, c int) int {
func state0(s *scanner, c byte) int {
if c == '.' {
s.step = stateDot
return scanContinue
@ -435,7 +434,7 @@ func state0(s *scanner, c int) int {
// stateDot is the state after reading the integer and decimal point in a number,
// such as after reading `1.`.
func stateDot(s *scanner, c int) int {
func stateDot(s *scanner, c byte) int {
if '0' <= c && c <= '9' {
s.step = stateDot0
return scanContinue
@ -445,9 +444,8 @@ func stateDot(s *scanner, c int) int {
// stateDot0 is the state after reading the integer, decimal point, and subsequent
// digits of a number, such as after reading `3.14`.
func stateDot0(s *scanner, c int) int {
func stateDot0(s *scanner, c byte) int {
if '0' <= c && c <= '9' {
s.step = stateDot0
return scanContinue
}
if c == 'e' || c == 'E' {
@ -459,12 +457,8 @@ func stateDot0(s *scanner, c int) int {
// stateE is the state after reading the mantissa and e in a number,
// such as after reading `314e` or `0.314e`.
func stateE(s *scanner, c int) int {
if c == '+' {
s.step = stateESign
return scanContinue
}
if c == '-' {
func stateE(s *scanner, c byte) int {
if c == '+' || c == '-' {
s.step = stateESign
return scanContinue
}
@ -473,7 +467,7 @@ func stateE(s *scanner, c int) int {
// stateESign is the state after reading the mantissa, e, and sign in a number,
// such as after reading `314e-` or `0.314e+`.
func stateESign(s *scanner, c int) int {
func stateESign(s *scanner, c byte) int {
if '0' <= c && c <= '9' {
s.step = stateE0
return scanContinue
@ -484,16 +478,15 @@ func stateESign(s *scanner, c int) int {
// stateE0 is the state after reading the mantissa, e, optional sign,
// and at least one digit of the exponent in a number,
// such as after reading `314e-2` or `0.314e+1` or `3.14e0`.
func stateE0(s *scanner, c int) int {
func stateE0(s *scanner, c byte) int {
if '0' <= c && c <= '9' {
s.step = stateE0
return scanContinue
}
return stateEndValue(s, c)
}
// stateT is the state after reading `t`.
func stateT(s *scanner, c int) int {
func stateT(s *scanner, c byte) int {
if c == 'r' {
s.step = stateTr
return scanContinue
@ -502,7 +495,7 @@ func stateT(s *scanner, c int) int {
}
// stateTr is the state after reading `tr`.
func stateTr(s *scanner, c int) int {
func stateTr(s *scanner, c byte) int {
if c == 'u' {
s.step = stateTru
return scanContinue
@ -511,7 +504,7 @@ func stateTr(s *scanner, c int) int {
}
// stateTru is the state after reading `tru`.
func stateTru(s *scanner, c int) int {
func stateTru(s *scanner, c byte) int {
if c == 'e' {
s.step = stateEndValue
return scanContinue
@ -520,7 +513,7 @@ func stateTru(s *scanner, c int) int {
}
// stateF is the state after reading `f`.
func stateF(s *scanner, c int) int {
func stateF(s *scanner, c byte) int {
if c == 'a' {
s.step = stateFa
return scanContinue
@ -529,7 +522,7 @@ func stateF(s *scanner, c int) int {
}
// stateFa is the state after reading `fa`.
func stateFa(s *scanner, c int) int {
func stateFa(s *scanner, c byte) int {
if c == 'l' {
s.step = stateFal
return scanContinue
@ -538,7 +531,7 @@ func stateFa(s *scanner, c int) int {
}
// stateFal is the state after reading `fal`.
func stateFal(s *scanner, c int) int {
func stateFal(s *scanner, c byte) int {
if c == 's' {
s.step = stateFals
return scanContinue
@ -547,7 +540,7 @@ func stateFal(s *scanner, c int) int {
}
// stateFals is the state after reading `fals`.
func stateFals(s *scanner, c int) int {
func stateFals(s *scanner, c byte) int {
if c == 'e' {
s.step = stateEndValue
return scanContinue
@ -556,7 +549,7 @@ func stateFals(s *scanner, c int) int {
}
// stateN is the state after reading `n`.
func stateN(s *scanner, c int) int {
func stateN(s *scanner, c byte) int {
if c == 'u' {
s.step = stateNu
return scanContinue
@ -565,7 +558,7 @@ func stateN(s *scanner, c int) int {
}
// stateNu is the state after reading `nu`.
func stateNu(s *scanner, c int) int {
func stateNu(s *scanner, c byte) int {
if c == 'l' {
s.step = stateNul
return scanContinue
@ -574,7 +567,7 @@ func stateNu(s *scanner, c int) int {
}
// stateNul is the state after reading `nul`.
func stateNul(s *scanner, c int) int {
func stateNul(s *scanner, c byte) int {
if c == 'l' {
s.step = stateEndValue
return scanContinue
@ -584,19 +577,19 @@ func stateNul(s *scanner, c int) int {
// stateError is the state after reaching a syntax error,
// such as after reading `[1}` or `5.1.2`.
func stateError(s *scanner, c int) int {
func stateError(s *scanner, c byte) int {
return scanError
}
// error records an error and switches to the error state.
func (s *scanner) error(c int, context string) int {
func (s *scanner) error(c byte, context string) int {
s.step = stateError
s.err = &SyntaxError{"invalid character " + quoteChar(c) + " " + context, s.bytes}
return scanError
}
// quoteChar formats c as a quoted character literal
func quoteChar(c int) string {
func quoteChar(c byte) string {
// special cases - different from quoted strings
if c == '\'' {
return `'\''`
@ -623,7 +616,7 @@ func (s *scanner) undo(scanCode int) {
}
// stateRedo helps implement the scanner's 1-byte undo.
func stateRedo(s *scanner, c int) int {
func stateRedo(s *scanner, c byte) int {
s.redo = false
s.step = s.redoState
return s.redoCode

View File

@ -90,7 +90,7 @@ Input:
// Look in the buffer for a new value.
for i, c := range dec.buf[scanp:] {
dec.scan.bytes++
v := dec.scan.step(&dec.scan, int(c))
v := dec.scan.step(&dec.scan, c)
if v == scanEnd {
scanp += i
break Input
@ -157,7 +157,7 @@ func (dec *Decoder) refill() error {
func nonSpace(b []byte) bool {
for _, c := range b {
if !isSpace(rune(c)) {
if !isSpace(c) {
return true
}
}
@ -440,7 +440,7 @@ func (dec *Decoder) tokenError(c byte) (Token, error) {
case tokenObjectComma:
context = " after object key:value pair"
}
return nil, &SyntaxError{"invalid character " + quoteChar(int(c)) + " " + context, 0}
return nil, &SyntaxError{"invalid character " + quoteChar(c) + " " + context, 0}
}
// More reports whether there is another element in the
@ -455,7 +455,7 @@ func (dec *Decoder) peek() (byte, error) {
for {
for i := dec.scanp; i < len(dec.buf); i++ {
c := dec.buf[i]
if isSpace(rune(c)) {
if isSpace(c) {
continue
}
dec.scanp = i