소스 검색

Update jmespath/go-jmespath version to revision:c2b33e84

赖新南 6 년 전
부모
커밋
da3a70fec8

+ 11 - 3
Gopkg.lock

@@ -18,12 +18,19 @@
   version = "v1.1.1"
   version = "v1.1.1"
 
 
 [[projects]]
 [[projects]]
-  digest = "1:b87714e57a511d88f307aba7d5b63522da12bed0a050889c81272fc50f71100e"
+  branch = "master"
+  digest = "1:205b3c069003f9d1458e4304427ab3652d8d7bac3bde1568a2d5486451e453bd"
+  name = "github.com/goji/httpauth"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "2da839ab0f4df05a6db5eb277995589dadbd4fb9"
+
+[[projects]]
+  digest = "1:bb81097a5b62634f3e9fec1014657855610c82d19b9a40c17612e32651e35dca"
   name = "github.com/jmespath/go-jmespath"
   name = "github.com/jmespath/go-jmespath"
   packages = ["."]
   packages = ["."]
   pruneopts = "UT"
   pruneopts = "UT"
-  revision = "3433f3ea46d9f8019119e7dd41274e112a2359a9"
-  version = "0.2.2"
+  revision = "c2b33e84"
 
 
 [[projects]]
 [[projects]]
   digest = "1:3e551bbb3a7c0ab2a2bf4660e7fcad16db089fdcfbb44b0199e62838038623ea"
   digest = "1:3e551bbb3a7c0ab2a2bf4660e7fcad16db089fdcfbb44b0199e62838038623ea"
@@ -94,6 +101,7 @@
   analyzer-version = 1
   analyzer-version = 1
   input-imports = [
   input-imports = [
     "github.com/aliyun/aliyun-oss-go-sdk/oss",
     "github.com/aliyun/aliyun-oss-go-sdk/oss",
+    "github.com/goji/httpauth",
     "github.com/jmespath/go-jmespath",
     "github.com/jmespath/go-jmespath",
     "github.com/json-iterator/go",
     "github.com/json-iterator/go",
     "github.com/satori/go.uuid",
     "github.com/satori/go.uuid",

+ 2 - 1
Gopkg.toml

@@ -32,7 +32,8 @@
 
 
 [[constraint]]
 [[constraint]]
   name = "github.com/jmespath/go-jmespath"
   name = "github.com/jmespath/go-jmespath"
-  version = "0.2.2"
+  revision = "c2b33e84"
+  #version = "0.2.2"
 
 
 [[constraint]]
 [[constraint]]
   name = "github.com/json-iterator/go"
   name = "github.com/json-iterator/go"

+ 1 - 1
go.mod

@@ -5,7 +5,7 @@ require (
 	github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
 	github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d
 	github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d
-	github.com/jmespath/go-jmespath v0.0.0-20151117175822-3433f3ea46d9
+	github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af
 	github.com/json-iterator/go v1.1.5
 	github.com/json-iterator/go v1.1.5
 	github.com/kr/pretty v0.1.0 // indirect
 	github.com/kr/pretty v0.1.0 // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect

+ 2 - 0
go.sum

@@ -11,6 +11,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGa
 github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
 github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
 github.com/jmespath/go-jmespath v0.0.0-20151117175822-3433f3ea46d9 h1:1SlajWtS+u/6x2Be5vrHyrbSxkeIf/+ISBu//kmjpnc=
 github.com/jmespath/go-jmespath v0.0.0-20151117175822-3433f3ea46d9 h1:1SlajWtS+u/6x2Be5vrHyrbSxkeIf/+ISBu//kmjpnc=
 github.com/jmespath/go-jmespath v0.0.0-20151117175822-3433f3ea46d9/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
 github.com/jmespath/go-jmespath v0.0.0-20151117175822-3433f3ea46d9/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
+github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
+github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
 github.com/json-iterator/go v1.1.5 h1:gL2yXlmiIo4+t+y32d4WGwOjKGYcGOuyrg46vadswDE=
 github.com/json-iterator/go v1.1.5 h1:gL2yXlmiIo4+t+y32d4WGwOjKGYcGOuyrg46vadswDE=
 github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
 github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
 github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
 github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=

+ 22 - 0
vendor/github.com/goji/httpauth/.travis.yml

@@ -0,0 +1,22 @@
+language: go
+sudo: false
+
+matrix:
+  include:
+    - go: 1.2
+    - go: 1.3
+    - go: 1.4
+    - go: 1.5
+    - go: 1.6
+    - go: tip
+  allow_failures:
+    - go: tip
+
+install:
+  - # skip
+
+script:
+  - go get -t -v ./...
+  - diff -u <(echo -n) <(gofmt -d .)
+  - go vet $(go list ./... | grep -v /vendor/)
+  - go test -v -race ./...

+ 1 - 1
vendor/github.com/jmespath/go-jmespath/.gitignore

@@ -1,4 +1,4 @@
-jpgo
+/jpgo
 jmespath-fuzz.zip
 jmespath-fuzz.zip
 cpu.out
 cpu.out
 go-jmespath.test
 go-jmespath.test

+ 1 - 1
vendor/github.com/jmespath/go-jmespath/Makefile

@@ -35,7 +35,7 @@ buildfuzz:
 	go-fuzz-build github.com/jmespath/go-jmespath/fuzz
 	go-fuzz-build github.com/jmespath/go-jmespath/fuzz
 
 
 fuzz: buildfuzz
 fuzz: buildfuzz
-	go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/corpus
+	go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/testdata
 
 
 bench:
 bench:
 	go test -bench . -cpuprofile cpu.out
 	go test -bench . -cpuprofile cpu.out

+ 37 - 0
vendor/github.com/jmespath/go-jmespath/api.go

@@ -1,5 +1,42 @@
 package jmespath
 package jmespath
 
 
+import "strconv"
+
+// JMESPath is the epresentation of a compiled JMES path query. A JMESPath is
+// safe for concurrent use by multiple goroutines.
+type JMESPath struct {
+	ast  ASTNode
+	intr *treeInterpreter
+}
+
+// Compile parses a JMESPath expression and returns, if successful, a JMESPath
+// object that can be used to match against data.
+func Compile(expression string) (*JMESPath, error) {
+	parser := NewParser()
+	ast, err := parser.Parse(expression)
+	if err != nil {
+		return nil, err
+	}
+	jmespath := &JMESPath{ast: ast, intr: newInterpreter()}
+	return jmespath, nil
+}
+
+// MustCompile is like Compile but panics if the expression cannot be parsed.
+// It simplifies safe initialization of global variables holding compiled
+// JMESPaths.
+func MustCompile(expression string) *JMESPath {
+	jmespath, err := Compile(expression)
+	if err != nil {
+		panic(`jmespath: Compile(` + strconv.Quote(expression) + `): ` + err.Error())
+	}
+	return jmespath
+}
+
+// Search evaluates a JMESPath expression against input data and returns the result.
+func (jp *JMESPath) Search(data interface{}) (interface{}, error) {
+	return jp.intr.Execute(jp.ast, data)
+}
+
 // Search evaluates a JMESPath expression against input data and returns the result.
 // Search evaluates a JMESPath expression against input data and returns the result.
 func Search(expression string, data interface{}) (interface{}, error) {
 func Search(expression string, data interface{}) (interface{}, error) {
 	intr := newInterpreter()
 	intr := newInterpreter()

+ 65 - 63
vendor/github.com/jmespath/go-jmespath/functions.go

@@ -5,6 +5,7 @@ import (
 	"errors"
 	"errors"
 	"fmt"
 	"fmt"
 	"math"
 	"math"
+	"reflect"
 	"sort"
 	"sort"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
@@ -124,197 +125,197 @@ type functionCaller struct {
 func newFunctionCaller() *functionCaller {
 func newFunctionCaller() *functionCaller {
 	caller := &functionCaller{}
 	caller := &functionCaller{}
 	caller.functionTable = map[string]functionEntry{
 	caller.functionTable = map[string]functionEntry{
-		"length": functionEntry{
+		"length": {
 			name: "length",
 			name: "length",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpString, jpArray, jpObject}},
+				{types: []jpType{jpString, jpArray, jpObject}},
 			},
 			},
 			handler: jpfLength,
 			handler: jpfLength,
 		},
 		},
-		"starts_with": functionEntry{
+		"starts_with": {
 			name: "starts_with",
 			name: "starts_with",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpString}},
-				argSpec{types: []jpType{jpString}},
+				{types: []jpType{jpString}},
+				{types: []jpType{jpString}},
 			},
 			},
 			handler: jpfStartsWith,
 			handler: jpfStartsWith,
 		},
 		},
-		"abs": functionEntry{
+		"abs": {
 			name: "abs",
 			name: "abs",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpNumber}},
+				{types: []jpType{jpNumber}},
 			},
 			},
 			handler: jpfAbs,
 			handler: jpfAbs,
 		},
 		},
-		"avg": functionEntry{
+		"avg": {
 			name: "avg",
 			name: "avg",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpArrayNumber}},
+				{types: []jpType{jpArrayNumber}},
 			},
 			},
 			handler: jpfAvg,
 			handler: jpfAvg,
 		},
 		},
-		"ceil": functionEntry{
+		"ceil": {
 			name: "ceil",
 			name: "ceil",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpNumber}},
+				{types: []jpType{jpNumber}},
 			},
 			},
 			handler: jpfCeil,
 			handler: jpfCeil,
 		},
 		},
-		"contains": functionEntry{
+		"contains": {
 			name: "contains",
 			name: "contains",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpArray, jpString}},
-				argSpec{types: []jpType{jpAny}},
+				{types: []jpType{jpArray, jpString}},
+				{types: []jpType{jpAny}},
 			},
 			},
 			handler: jpfContains,
 			handler: jpfContains,
 		},
 		},
-		"ends_with": functionEntry{
+		"ends_with": {
 			name: "ends_with",
 			name: "ends_with",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpString}},
-				argSpec{types: []jpType{jpString}},
+				{types: []jpType{jpString}},
+				{types: []jpType{jpString}},
 			},
 			},
 			handler: jpfEndsWith,
 			handler: jpfEndsWith,
 		},
 		},
-		"floor": functionEntry{
+		"floor": {
 			name: "floor",
 			name: "floor",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpNumber}},
+				{types: []jpType{jpNumber}},
 			},
 			},
 			handler: jpfFloor,
 			handler: jpfFloor,
 		},
 		},
-		"map": functionEntry{
+		"map": {
 			name: "amp",
 			name: "amp",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpExpref}},
-				argSpec{types: []jpType{jpArray}},
+				{types: []jpType{jpExpref}},
+				{types: []jpType{jpArray}},
 			},
 			},
 			handler:   jpfMap,
 			handler:   jpfMap,
 			hasExpRef: true,
 			hasExpRef: true,
 		},
 		},
-		"max": functionEntry{
+		"max": {
 			name: "max",
 			name: "max",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpArrayNumber, jpArrayString}},
+				{types: []jpType{jpArrayNumber, jpArrayString}},
 			},
 			},
 			handler: jpfMax,
 			handler: jpfMax,
 		},
 		},
-		"merge": functionEntry{
+		"merge": {
 			name: "merge",
 			name: "merge",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpObject}, variadic: true},
+				{types: []jpType{jpObject}, variadic: true},
 			},
 			},
 			handler: jpfMerge,
 			handler: jpfMerge,
 		},
 		},
-		"max_by": functionEntry{
+		"max_by": {
 			name: "max_by",
 			name: "max_by",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpArray}},
-				argSpec{types: []jpType{jpExpref}},
+				{types: []jpType{jpArray}},
+				{types: []jpType{jpExpref}},
 			},
 			},
 			handler:   jpfMaxBy,
 			handler:   jpfMaxBy,
 			hasExpRef: true,
 			hasExpRef: true,
 		},
 		},
-		"sum": functionEntry{
+		"sum": {
 			name: "sum",
 			name: "sum",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpArrayNumber}},
+				{types: []jpType{jpArrayNumber}},
 			},
 			},
 			handler: jpfSum,
 			handler: jpfSum,
 		},
 		},
-		"min": functionEntry{
+		"min": {
 			name: "min",
 			name: "min",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpArrayNumber, jpArrayString}},
+				{types: []jpType{jpArrayNumber, jpArrayString}},
 			},
 			},
 			handler: jpfMin,
 			handler: jpfMin,
 		},
 		},
-		"min_by": functionEntry{
+		"min_by": {
 			name: "min_by",
 			name: "min_by",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpArray}},
-				argSpec{types: []jpType{jpExpref}},
+				{types: []jpType{jpArray}},
+				{types: []jpType{jpExpref}},
 			},
 			},
 			handler:   jpfMinBy,
 			handler:   jpfMinBy,
 			hasExpRef: true,
 			hasExpRef: true,
 		},
 		},
-		"type": functionEntry{
+		"type": {
 			name: "type",
 			name: "type",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpAny}},
+				{types: []jpType{jpAny}},
 			},
 			},
 			handler: jpfType,
 			handler: jpfType,
 		},
 		},
-		"keys": functionEntry{
+		"keys": {
 			name: "keys",
 			name: "keys",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpObject}},
+				{types: []jpType{jpObject}},
 			},
 			},
 			handler: jpfKeys,
 			handler: jpfKeys,
 		},
 		},
-		"values": functionEntry{
+		"values": {
 			name: "values",
 			name: "values",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpObject}},
+				{types: []jpType{jpObject}},
 			},
 			},
 			handler: jpfValues,
 			handler: jpfValues,
 		},
 		},
-		"sort": functionEntry{
+		"sort": {
 			name: "sort",
 			name: "sort",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpArrayString, jpArrayNumber}},
+				{types: []jpType{jpArrayString, jpArrayNumber}},
 			},
 			},
 			handler: jpfSort,
 			handler: jpfSort,
 		},
 		},
-		"sort_by": functionEntry{
+		"sort_by": {
 			name: "sort_by",
 			name: "sort_by",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpArray}},
-				argSpec{types: []jpType{jpExpref}},
+				{types: []jpType{jpArray}},
+				{types: []jpType{jpExpref}},
 			},
 			},
 			handler:   jpfSortBy,
 			handler:   jpfSortBy,
 			hasExpRef: true,
 			hasExpRef: true,
 		},
 		},
-		"join": functionEntry{
+		"join": {
 			name: "join",
 			name: "join",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpString}},
-				argSpec{types: []jpType{jpArrayString}},
+				{types: []jpType{jpString}},
+				{types: []jpType{jpArrayString}},
 			},
 			},
 			handler: jpfJoin,
 			handler: jpfJoin,
 		},
 		},
-		"reverse": functionEntry{
+		"reverse": {
 			name: "reverse",
 			name: "reverse",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpArray, jpString}},
+				{types: []jpType{jpArray, jpString}},
 			},
 			},
 			handler: jpfReverse,
 			handler: jpfReverse,
 		},
 		},
-		"to_array": functionEntry{
+		"to_array": {
 			name: "to_array",
 			name: "to_array",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpAny}},
+				{types: []jpType{jpAny}},
 			},
 			},
 			handler: jpfToArray,
 			handler: jpfToArray,
 		},
 		},
-		"to_string": functionEntry{
+		"to_string": {
 			name: "to_string",
 			name: "to_string",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpAny}},
+				{types: []jpType{jpAny}},
 			},
 			},
 			handler: jpfToString,
 			handler: jpfToString,
 		},
 		},
-		"to_number": functionEntry{
+		"to_number": {
 			name: "to_number",
 			name: "to_number",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpAny}},
+				{types: []jpType{jpAny}},
 			},
 			},
 			handler: jpfToNumber,
 			handler: jpfToNumber,
 		},
 		},
-		"not_null": functionEntry{
+		"not_null": {
 			name: "not_null",
 			name: "not_null",
 			arguments: []argSpec{
 			arguments: []argSpec{
-				argSpec{types: []jpType{jpAny}, variadic: true},
+				{types: []jpType{jpAny}, variadic: true},
 			},
 			},
 			handler: jpfNotNull,
 			handler: jpfNotNull,
 		},
 		},
@@ -357,7 +358,7 @@ func (a *argSpec) typeCheck(arg interface{}) error {
 				return nil
 				return nil
 			}
 			}
 		case jpArray:
 		case jpArray:
-			if _, ok := arg.([]interface{}); ok {
+			if isSliceType(arg) {
 				return nil
 				return nil
 			}
 			}
 		case jpObject:
 		case jpObject:
@@ -409,8 +410,9 @@ func jpfLength(arguments []interface{}) (interface{}, error) {
 	arg := arguments[0]
 	arg := arguments[0]
 	if c, ok := arg.(string); ok {
 	if c, ok := arg.(string); ok {
 		return float64(utf8.RuneCountInString(c)), nil
 		return float64(utf8.RuneCountInString(c)), nil
-	} else if c, ok := arg.([]interface{}); ok {
-		return float64(len(c)), nil
+	} else if isSliceType(arg) {
+		v := reflect.ValueOf(arg)
+		return float64(v.Len()), nil
 	} else if c, ok := arg.(map[string]interface{}); ok {
 	} else if c, ok := arg.(map[string]interface{}); ok {
 		return float64(len(c)), nil
 		return float64(len(c)), nil
 	}
 	}

+ 2 - 2
vendor/github.com/jmespath/go-jmespath/parser.go

@@ -353,7 +353,7 @@ func (p *Parser) nud(token token) (ASTNode, error) {
 	case tFlatten:
 	case tFlatten:
 		left := ASTNode{
 		left := ASTNode{
 			nodeType: ASTFlatten,
 			nodeType: ASTFlatten,
-			children: []ASTNode{ASTNode{nodeType: ASTIdentity}},
+			children: []ASTNode{{nodeType: ASTIdentity}},
 		}
 		}
 		right, err := p.parseProjectionRHS(bindingPowers[tFlatten])
 		right, err := p.parseProjectionRHS(bindingPowers[tFlatten])
 		if err != nil {
 		if err != nil {
@@ -378,7 +378,7 @@ func (p *Parser) nud(token token) (ASTNode, error) {
 			}
 			}
 			return ASTNode{
 			return ASTNode{
 				nodeType: ASTProjection,
 				nodeType: ASTProjection,
-				children: []ASTNode{ASTNode{nodeType: ASTIdentity}, right},
+				children: []ASTNode{{nodeType: ASTIdentity}, right},
 			}, nil
 			}, nil
 		} else {
 		} else {
 			return p.parseMultiSelectList()
 			return p.parseMultiSelectList()

+ 0 - 0
vendor/github.com/modern-go/reflect2/test.sh