Bumping k8s dependencies to 1.13

This commit is contained in:
Cheng Xing
2018-11-16 14:08:25 -08:00
parent 305407125c
commit b4c0b68ec7
8002 changed files with 884099 additions and 276228 deletions

View File

@@ -88,7 +88,15 @@ func ensureSorted() {
initialisms = commonInitialisms.sorted()
}
// JoinByFormat joins a string array by a known format:
const (
//collectionFormatComma = "csv"
collectionFormatSpace = "ssv"
collectionFormatTab = "tsv"
collectionFormatPipe = "pipes"
collectionFormatMulti = "multi"
)
// JoinByFormat joins a string array by a known format (e.g. swagger's collectionFormat attribute):
// ssv: space separated value
// tsv: tab separated value
// pipes: pipe (|) separated value
@@ -99,13 +107,13 @@ func JoinByFormat(data []string, format string) []string {
}
var sep string
switch format {
case "ssv":
case collectionFormatSpace:
sep = " "
case "tsv":
case collectionFormatTab:
sep = "\t"
case "pipes":
case collectionFormatPipe:
sep = "|"
case "multi":
case collectionFormatMulti:
return data
default:
sep = ","
@@ -118,19 +126,20 @@ func JoinByFormat(data []string, format string) []string {
// tsv: tab separated value
// pipes: pipe (|) separated value
// csv: comma separated value (default)
//
func SplitByFormat(data, format string) []string {
if data == "" {
return nil
}
var sep string
switch format {
case "ssv":
case collectionFormatSpace:
sep = " "
case "tsv":
case collectionFormatTab:
sep = "\t"
case "pipes":
case collectionFormatPipe:
sep = "|"
case "multi":
case collectionFormatMulti:
return nil
default:
sep = ","
@@ -157,7 +166,7 @@ func (s byLength) Less(i, j int) bool {
}
// Prepares strings by splitting by caps, spaces, dashes, and underscore
func split(str string) (words []string) {
func split(str string) []string {
repl := strings.NewReplacer(
"@", "At ",
"&", "And ",
@@ -185,9 +194,8 @@ func split(str string) (words []string) {
str = strings.Replace(str, rex1.ReplaceAllString(k, " $1"), " "+k, -1)
}
// Get the final list of words
words = rex2.FindAllString(str, -1)
return
//words = rex2.FindAllString(str, -1)
return rex2.FindAllString(str, -1)
}
// Removes leading whitespaces
@@ -219,9 +227,10 @@ func Camelize(word string) (camelized string) {
// ToFileName lowercases and underscores a go type name
func ToFileName(name string) string {
var out []string
in := split(name)
out := make([]string, 0, len(in))
for _, w := range split(name) {
for _, w := range in {
out = append(out, lower(w))
}
@@ -230,8 +239,10 @@ func ToFileName(name string) string {
// ToCommandName lowercases and underscores a go type name
func ToCommandName(name string) string {
var out []string
for _, w := range split(name) {
in := split(name)
out := make([]string, 0, len(in))
for _, w := range in {
out = append(out, lower(w))
}
return strings.Join(out, "-")
@@ -239,8 +250,10 @@ func ToCommandName(name string) string {
// ToHumanNameLower represents a code name as a human series of words
func ToHumanNameLower(name string) string {
var out []string
for _, w := range split(name) {
in := split(name)
out := make([]string, 0, len(in))
for _, w := range in {
if !isInitialism(upper(w)) {
out = append(out, lower(w))
} else {
@@ -252,8 +265,10 @@ func ToHumanNameLower(name string) string {
// ToHumanNameTitle represents a code name as a human series of words with the first letters titleized
func ToHumanNameTitle(name string) string {
var out []string
for _, w := range split(name) {
in := split(name)
out := make([]string, 0, len(in))
for _, w := range in {
uw := upper(w)
if !isInitialism(uw) {
out = append(out, upper(w[:1])+lower(w[1:]))
@@ -266,8 +281,10 @@ func ToHumanNameTitle(name string) string {
// ToJSONName camelcases a name which can be underscored or pascal cased
func ToJSONName(name string) string {
var out []string
for i, w := range split(name) {
in := split(name)
out := make([]string, 0, len(in))
for i, w := range in {
if i == 0 {
out = append(out, lower(w))
continue
@@ -291,8 +308,10 @@ func ToVarName(name string) string {
// ToGoName translates a swagger name which can be underscored or camel cased to a name that golint likes
func ToGoName(name string) string {
var out []string
for _, w := range split(name) {
in := split(name)
out := make([]string, 0, len(in))
for _, w := range in {
uw := upper(w)
mod := int(math.Min(float64(len(uw)), 2))
if !isInitialism(uw) && !isInitialism(uw[:len(uw)-mod]) {
@@ -314,6 +333,16 @@ func ToGoName(name string) string {
return result
}
// ContainsStrings searches a slice of strings for a case-sensitive match
func ContainsStrings(coll []string, item string) bool {
for _, a := range coll {
if a == item {
return true
}
}
return false
}
// ContainsStringsCI searches a slice of strings for a case-insensitive match
func ContainsStringsCI(coll []string, item string) bool {
for _, a := range coll {