mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-06-10 10:15:57 +00:00
vendor: revendor
This commit is contained in:
parent
269295a414
commit
9f0440be0f
669 changed files with 58447 additions and 20021 deletions
2
vendor/k8s.io/gengo/examples/set-gen/sets/byte.go
generated
vendored
2
vendor/k8s.io/gengo/examples/set-gen/sets/byte.go
generated
vendored
|
|
@ -28,7 +28,7 @@ type Byte map[byte]Empty
|
|||
|
||||
// NewByte creates a Byte from a list of values.
|
||||
func NewByte(items ...byte) Byte {
|
||||
ss := Byte{}
|
||||
ss := make(Byte, len(items))
|
||||
ss.Insert(items...)
|
||||
return ss
|
||||
}
|
||||
|
|
|
|||
2
vendor/k8s.io/gengo/examples/set-gen/sets/int.go
generated
vendored
2
vendor/k8s.io/gengo/examples/set-gen/sets/int.go
generated
vendored
|
|
@ -28,7 +28,7 @@ type Int map[int]Empty
|
|||
|
||||
// NewInt creates a Int from a list of values.
|
||||
func NewInt(items ...int) Int {
|
||||
ss := Int{}
|
||||
ss := make(Int, len(items))
|
||||
ss.Insert(items...)
|
||||
return ss
|
||||
}
|
||||
|
|
|
|||
2
vendor/k8s.io/gengo/examples/set-gen/sets/int64.go
generated
vendored
2
vendor/k8s.io/gengo/examples/set-gen/sets/int64.go
generated
vendored
|
|
@ -28,7 +28,7 @@ type Int64 map[int64]Empty
|
|||
|
||||
// NewInt64 creates a Int64 from a list of values.
|
||||
func NewInt64(items ...int64) Int64 {
|
||||
ss := Int64{}
|
||||
ss := make(Int64, len(items))
|
||||
ss.Insert(items...)
|
||||
return ss
|
||||
}
|
||||
|
|
|
|||
2
vendor/k8s.io/gengo/examples/set-gen/sets/string.go
generated
vendored
2
vendor/k8s.io/gengo/examples/set-gen/sets/string.go
generated
vendored
|
|
@ -28,7 +28,7 @@ type String map[string]Empty
|
|||
|
||||
// NewString creates a String from a list of values.
|
||||
func NewString(items ...string) String {
|
||||
ss := String{}
|
||||
ss := make(String, len(items))
|
||||
ss.Insert(items...)
|
||||
return ss
|
||||
}
|
||||
|
|
|
|||
2
vendor/k8s.io/gengo/generator/snippet_writer.go
generated
vendored
2
vendor/k8s.io/gengo/generator/snippet_writer.go
generated
vendored
|
|
@ -57,7 +57,7 @@ func NewSnippetWriter(w io.Writer, c *Context, left, right string) *SnippetWrite
|
|||
|
||||
// Do parses format and runs args through it. You can have arbitrary logic in
|
||||
// the format (see the text/template documentation), but consider running many
|
||||
// short templaces, with ordinary go logic in between--this may be more
|
||||
// short templates with ordinary go logic in between--this may be more
|
||||
// readable. Do is chainable. Any error causes every other call to do to be
|
||||
// ignored, and the error will be returned by Error(). So you can check it just
|
||||
// once, at the end of your function.
|
||||
|
|
|
|||
20
vendor/k8s.io/gengo/parser/parse.go
generated
vendored
20
vendor/k8s.io/gengo/parser/parse.go
generated
vendored
|
|
@ -20,6 +20,7 @@ import (
|
|||
"fmt"
|
||||
"go/ast"
|
||||
"go/build"
|
||||
"go/constant"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
tc "go/types"
|
||||
|
|
@ -335,7 +336,8 @@ func (b *Builder) addDir(dir string, userRequested bool) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var regexErrPackageNotFound = regexp.MustCompile(`^unable to import ".*?": cannot find package ".*?" in any of:`)
|
||||
// regexErrPackageNotFound helps test the expected error for not finding a package.
|
||||
var regexErrPackageNotFound = regexp.MustCompile(`^unable to import ".*?":.*`)
|
||||
|
||||
func isErrPackageNotFound(err error) bool {
|
||||
return regexErrPackageNotFound.MatchString(err.Error())
|
||||
|
|
@ -847,6 +849,22 @@ func (b *Builder) addConstant(u types.Universe, useName *types.Name, in *tc.Cons
|
|||
out := u.Constant(name)
|
||||
out.Kind = types.DeclarationOf
|
||||
out.Underlying = b.walkType(u, nil, in.Type())
|
||||
|
||||
var constval string
|
||||
|
||||
// For strings, we use `StringVal()` to get the un-truncated,
|
||||
// un-quoted string. For other values, `.String()` is preferable to
|
||||
// get something relatively human readable (especially since for
|
||||
// floating point types, `ExactString()` will generate numeric
|
||||
// expressions using `big.(*Float).Text()`.
|
||||
switch in.Val().Kind() {
|
||||
case constant.String:
|
||||
constval = constant.StringVal(in.Val())
|
||||
default:
|
||||
constval = in.Val().String()
|
||||
}
|
||||
|
||||
out.ConstValue = &constval
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
|
|||
7
vendor/k8s.io/gengo/types/types.go
generated
vendored
7
vendor/k8s.io/gengo/types/types.go
generated
vendored
|
|
@ -341,6 +341,13 @@ type Type struct {
|
|||
// If Kind == func, this is the signature of the function.
|
||||
Signature *Signature
|
||||
|
||||
// ConstValue contains a stringified constant value if
|
||||
// Kind == DeclarationOf and this is a constant value
|
||||
// declaration. For string constants, this field contains
|
||||
// the entire, un-quoted value. For other types, it contains
|
||||
// a human-readable literal.
|
||||
ConstValue *string
|
||||
|
||||
// TODO: Add:
|
||||
// * channel direction
|
||||
// * array length
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue