Merge pull request #56746 from xuri/patch

Automatic merge from submit-queue (batch tested with PRs 56639, 56746, 56715, 56673, 56726). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Simple code and typo fixed.

**What this PR does / why we need it**:
Simple code and typo fixed.
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
none
**Special notes for your reviewer**:
none
**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-12-16 06:39:42 -08:00 committed by GitHub
commit 0e8683e173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -747,7 +747,7 @@ func (s *ServiceController) syncService(key string) error {
var cachedService *cachedService var cachedService *cachedService
var retryDelay time.Duration var retryDelay time.Duration
defer func() { defer func() {
glog.V(4).Infof("Finished syncing service %q (%v)", key, time.Now().Sub(startTime)) glog.V(4).Infof("Finished syncing service %q (%v)", key, time.Since(startTime))
}() }()
namespace, name, err := cache.SplitMetaNamespaceKey(key) namespace, name, err := cache.SplitMetaNamespaceKey(key)

View File

@ -105,10 +105,10 @@ func wrapString(str string, wrap int) []string {
l := line{wrap: wrap} l := line{wrap: wrap}
for _, word := range words { for _, word := range words {
if l.Add(word) == false { if !l.Add(word) {
wrapped = append(wrapped, l.String()) wrapped = append(wrapped, l.String())
l = line{wrap: wrap} l = line{wrap: wrap}
if l.Add(word) == false { if !l.Add(word) {
panic("Couldn't add to empty line.") panic("Couldn't add to empty line.")
} }
} }

View File

@ -65,7 +65,7 @@ func (p Plugin) Validate() error {
if len(p.Name) == 0 || len(p.ShortDesc) == 0 || (len(p.Command) == 0 && len(p.Tree) == 0) { if len(p.Name) == 0 || len(p.ShortDesc) == 0 || (len(p.Command) == 0 && len(p.Tree) == 0) {
return ErrIncompletePlugin return ErrIncompletePlugin
} }
if strings.Index(p.Name, " ") > -1 { if strings.Contains(p.Name, " ") {
return ErrInvalidPluginName return ErrInvalidPluginName
} }
for _, flag := range p.Flags { for _, flag := range p.Flags {
@ -102,7 +102,7 @@ func (f Flag) Validate() error {
if len(f.Name) == 0 || len(f.Desc) == 0 { if len(f.Name) == 0 || len(f.Desc) == 0 {
return ErrIncompleteFlag return ErrIncompleteFlag
} }
if strings.Index(f.Name, " ") > -1 { if strings.Contains(f.Name, " ") {
return ErrInvalidFlagName return ErrInvalidFlagName
} }
return f.ValidateShorthand() return f.ValidateShorthand()