use istio client-go library instead of knative (#1661)

use istio client-go library instead of knative
bump kubernetes dependency version
change code coverage to codecov
This commit is contained in:
zryfish
2019-12-13 11:26:18 +08:00
committed by GitHub
parent f249a6e081
commit ea88c8803d
2071 changed files with 354531 additions and 108336 deletions

49
vendor/k8s.io/gengo/parser/parse.go generated vendored
View File

@@ -43,6 +43,9 @@ type importPathString string
type Builder struct {
context *build.Context
// If true, include *_test.go
IncludeTestFiles bool
// Map of package names to more canonical information about the package.
// This might hold the same value for multiple names, e.g. if someone
// referenced ./pkg/name or in the case of vendoring, which canonicalizes
@@ -224,12 +227,16 @@ func (b *Builder) AddDirRecursive(dir string) error {
klog.Warningf("Ignoring directory %v: %v", dir, err)
}
// filepath.Walk includes the root dir, but we already did that, so we'll
// remove that prefix and rebuild a package import path.
prefix := b.buildPackages[dir].Dir
// filepath.Walk does not follow symlinks. We therefore evaluate symlinks and use that with
// filepath.Walk.
realPath, err := filepath.EvalSymlinks(b.buildPackages[dir].Dir)
if err != nil {
return err
}
fn := func(filePath string, info os.FileInfo, err error) error {
if info != nil && info.IsDir() {
rel := filepath.ToSlash(strings.TrimPrefix(filePath, prefix))
rel := filepath.ToSlash(strings.TrimPrefix(filePath, realPath))
if rel != "" {
// Make a pkg path.
pkg := path.Join(string(canonicalizeImportPath(b.buildPackages[dir].ImportPath)), rel)
@@ -242,7 +249,7 @@ func (b *Builder) AddDirRecursive(dir string) error {
}
return nil
}
if err := filepath.Walk(b.buildPackages[dir].Dir, fn); err != nil {
if err := filepath.Walk(realPath, fn); err != nil {
return err
}
return nil
@@ -304,11 +311,17 @@ func (b *Builder) addDir(dir string, userRequested bool) error {
b.absPaths[pkgPath] = buildPkg.Dir
}
for _, n := range buildPkg.GoFiles {
if !strings.HasSuffix(n, ".go") {
files := []string{}
files = append(files, buildPkg.GoFiles...)
if b.IncludeTestFiles {
files = append(files, buildPkg.TestGoFiles...)
}
for _, file := range files {
if !strings.HasSuffix(file, ".go") {
continue
}
absPath := filepath.Join(buildPkg.Dir, n)
absPath := filepath.Join(buildPkg.Dir, file)
data, err := ioutil.ReadFile(absPath)
if err != nil {
return fmt.Errorf("while loading %q: %v", absPath, err)
@@ -535,6 +548,10 @@ func (b *Builder) findTypesIn(pkgPath importPathString, u *types.Universe) error
if ok && !tv.IsField() {
b.addVariable(*u, nil, tv)
}
tconst, ok := obj.(*tc.Const)
if ok {
b.addConstant(*u, nil, tconst)
}
}
importedPkgs := []string{}
@@ -765,7 +782,10 @@ func (b *Builder) walkType(u types.Universe, useName *types.Name, in tc.Type) *t
if out.Methods == nil {
out.Methods = map[string]*types.Type{}
}
out.Methods[t.Method(i).Name()] = b.walkType(u, nil, t.Method(i).Type())
method := t.Method(i)
mt := b.walkType(u, nil, method.Type())
mt.CommentLines = splitLines(b.priorCommentLines(method.Pos(), 1).Text())
out.Methods[method.Name()] = mt
}
}
return out
@@ -802,6 +822,17 @@ func (b *Builder) addVariable(u types.Universe, useName *types.Name, in *tc.Var)
return out
}
func (b *Builder) addConstant(u types.Universe, useName *types.Name, in *tc.Const) *types.Type {
name := tcVarNameToName(in.String())
if useName != nil {
name = *useName
}
out := u.Constant(name)
out.Kind = types.DeclarationOf
out.Underlying = b.walkType(u, nil, in.Type())
return out
}
// canonicalizeImportPath takes an import path and returns the actual package.
// It doesn't support nested vendoring.
func canonicalizeImportPath(importPath string) importPathString {