1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-24 04:30:37 +00:00

k8s vendor to 1.10.5

This commit is contained in:
Alena Prokharchyk
2018-07-11 16:42:39 -07:00
parent 26d279bce1
commit 57e8282a33
1261 changed files with 72487 additions and 71790 deletions

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

@@ -27,6 +27,7 @@ import (
"os"
"os/exec"
"path/filepath"
"sort"
"strings"
"github.com/golang/glog"
@@ -425,13 +426,20 @@ func (b *Builder) typeCheckPackage(pkgPath importPathString) (*tc.Package, error
// FindPackages fetches a list of the user-imported packages.
// Note that you need to call b.FindTypes() first.
func (b *Builder) FindPackages() []string {
// Iterate packages in a predictable order.
pkgPaths := []string{}
for k := range b.typeCheckedPackages {
pkgPaths = append(pkgPaths, string(k))
}
sort.Strings(pkgPaths)
result := []string{}
for pkgPath := range b.typeCheckedPackages {
if b.userRequested[pkgPath] {
for _, pkgPath := range pkgPaths {
if b.userRequested[importPathString(pkgPath)] {
// Since walkType is recursive, all types that are in packages that
// were directly mentioned will be included. We don't need to
// include all types in all transitive packages, though.
result = append(result, string(pkgPath))
result = append(result, pkgPath)
}
}
return result
@@ -440,16 +448,17 @@ func (b *Builder) FindPackages() []string {
// FindTypes finalizes the package imports, and searches through all the
// packages for types.
func (b *Builder) FindTypes() (types.Universe, error) {
u := types.Universe{}
// Take a snapshot of pkgs to iterate, since this will recursively mutate
// b.parsed.
keys := []importPathString{}
// b.parsed. Iterate in a predictable order.
pkgPaths := []string{}
for pkgPath := range b.parsed {
keys = append(keys, pkgPath)
pkgPaths = append(pkgPaths, string(pkgPath))
}
for _, pkgPath := range keys {
if err := b.findTypesIn(pkgPath, &u); err != nil {
sort.Strings(pkgPaths)
u := types.Universe{}
for _, pkgPath := range pkgPaths {
if err := b.findTypesIn(importPathString(pkgPath), &u); err != nil {
return nil, err
}
}
@@ -526,7 +535,13 @@ func (b *Builder) findTypesIn(pkgPath importPathString, u *types.Universe) error
b.addVariable(*u, nil, tv)
}
}
for p := range b.importGraph[pkgPath] {
importedPkgs := []string{}
for k := range b.importGraph[pkgPath] {
importedPkgs = append(importedPkgs, string(k))
}
sort.Strings(importedPkgs)
for _, p := range importedPkgs {
u.AddImports(string(pkgPath), p)
}
return nil
@@ -563,7 +578,7 @@ func splitLines(str string) []string {
}
func tcFuncNameToName(in string) types.Name {
name := strings.TrimLeft(in, "func ")
name := strings.TrimPrefix(in, "func ")
nameParts := strings.Split(name, "(")
return tcNameToName(nameParts[0])
}