Simple code and typo fixed.

Signed-off-by: Ri Xu <xuri.me@gmail.com>
This commit is contained in:
Ri Xu 2017-12-02 21:12:39 +08:00
parent 8c1ee761d2
commit 4b71941082
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
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 retryDelay time.Duration
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)

View File

@ -105,10 +105,10 @@ func wrapString(str string, wrap int) []string {
l := line{wrap: wrap}
for _, word := range words {
if l.Add(word) == false {
if !l.Add(word) {
wrapped = append(wrapped, l.String())
l = line{wrap: wrap}
if l.Add(word) == false {
if !l.Add(word) {
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) {
return ErrIncompletePlugin
}
if strings.Index(p.Name, " ") > -1 {
if strings.Contains(p.Name, " ") {
return ErrInvalidPluginName
}
for _, flag := range p.Flags {
@ -102,7 +102,7 @@ func (f Flag) Validate() error {
if len(f.Name) == 0 || len(f.Desc) == 0 {
return ErrIncompleteFlag
}
if strings.Index(f.Name, " ") > -1 {
if strings.Contains(f.Name, " ") {
return ErrInvalidFlagName
}
return f.ValidateShorthand()