diff --git a/go.mod b/go.mod index ddfd63a..706c25f 100644 --- a/go.mod +++ b/go.mod @@ -2,9 +2,9 @@ module github.com/ryboe/q go 1.19 -require github.com/kr/pretty v0.3.0 +require github.com/kr/pretty v0.3.1 require ( github.com/kr/text v0.2.0 // indirect - github.com/rogpeppe/go-internal v1.6.1 // indirect + github.com/rogpeppe/go-internal v1.9.0 // indirect ) diff --git a/go.sum b/go.sum index 801b302..f5733ef 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= diff --git a/vendor/github.com/kr/pretty/.gitignore b/vendor/github.com/kr/pretty/.gitignore index 1f0a99f..b2d4781 100644 --- a/vendor/github.com/kr/pretty/.gitignore +++ b/vendor/github.com/kr/pretty/.gitignore @@ -2,3 +2,4 @@ _go* _test* _obj +/.idea diff --git a/vendor/github.com/kr/pretty/formatter.go b/vendor/github.com/kr/pretty/formatter.go index 249f089..8e6969c 100644 --- a/vendor/github.com/kr/pretty/formatter.go +++ b/vendor/github.com/kr/pretty/formatter.go @@ -92,6 +92,24 @@ type visit struct { typ reflect.Type } +func (p *printer) catchPanic(v reflect.Value, method string) { + if r := recover(); r != nil { + if v.Kind() == reflect.Ptr && v.IsNil() { + writeByte(p, '(') + io.WriteString(p, v.Type().String()) + io.WriteString(p, ")(nil)") + return + } + writeByte(p, '(') + io.WriteString(p, v.Type().String()) + io.WriteString(p, ")(PANIC=calling method ") + io.WriteString(p, strconv.Quote(method)) + io.WriteString(p, ": ") + fmt.Fprint(p, r) + writeByte(p, ')') + } +} + func (p *printer) printValue(v reflect.Value, showType, quote bool) { if p.depth > 10 { io.WriteString(p, "!%v(DEPTH EXCEEDED)") @@ -101,6 +119,7 @@ func (p *printer) printValue(v reflect.Value, showType, quote bool) { if v.IsValid() && v.CanInterface() { i := v.Interface() if goStringer, ok := i.(fmt.GoStringer); ok { + defer p.catchPanic(v, "GoString") io.WriteString(p, goStringer.GoString()) return } diff --git a/vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem.go b/vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem.go index 07c4a47..4e4c294 100644 --- a/vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem.go +++ b/vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem.go @@ -1,3 +1,4 @@ +//go:build go1.12 // +build go1.12 package fmtsort @@ -7,12 +8,16 @@ import "reflect" const brokenNaNs = false func mapElems(mapValue reflect.Value) ([]reflect.Value, []reflect.Value) { - key := make([]reflect.Value, mapValue.Len()) - value := make([]reflect.Value, len(key)) + // Note: this code is arranged to not panic even in the presence + // of a concurrent map update. The runtime is responsible for + // yelling loudly if that happens. See issue 33275. + n := mapValue.Len() + key := make([]reflect.Value, 0, n) + value := make([]reflect.Value, 0, n) iter := mapValue.MapRange() - for i := 0; iter.Next(); i++ { - key[i] = iter.Key() - value[i] = iter.Value() + for iter.Next() { + key = append(key, iter.Key()) + value = append(value, iter.Value()) } return key, value } diff --git a/vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem_1.11.go b/vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem_1.11.go index 8c28451..873bf7f 100644 --- a/vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem_1.11.go +++ b/vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem_1.11.go @@ -1,3 +1,4 @@ +//go:build !go1.12 // +build !go1.12 package fmtsort @@ -8,8 +9,8 @@ const brokenNaNs = true func mapElems(mapValue reflect.Value) ([]reflect.Value, []reflect.Value) { key := mapValue.MapKeys() - value := make([]reflect.Value, len(key)) - for i, k := range key { + value := make([]reflect.Value, 0, len(key)) + for _, k := range key { v := mapValue.MapIndex(k) if !v.IsValid() { // Note: we can't retrieve the value, probably because @@ -17,7 +18,7 @@ func mapElems(mapValue reflect.Value) ([]reflect.Value, []reflect.Value) { // add a zero value of the correct type in that case. v = reflect.Zero(mapValue.Type().Elem()) } - value[i] = v + value = append(value, v) } return key, value } diff --git a/vendor/modules.txt b/vendor/modules.txt index 66acc57..fc42ce5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,9 +1,9 @@ -# github.com/kr/pretty v0.3.0 +# github.com/kr/pretty v0.3.1 ## explicit; go 1.12 github.com/kr/pretty # github.com/kr/text v0.2.0 ## explicit github.com/kr/text -# github.com/rogpeppe/go-internal v1.6.1 -## explicit; go 1.11 +# github.com/rogpeppe/go-internal v1.9.0 +## explicit; go 1.17 github.com/rogpeppe/go-internal/fmtsort