kyaml: rename annotations and fix linting

This commit is contained in:
Phillip Wittrock
2019-11-07 11:46:42 -08:00
parent e0b46acf2f
commit 3db1111f8e
22 changed files with 242 additions and 223 deletions

View File

@@ -24,10 +24,7 @@ func (l *Walker) walkAssociativeSequence() (*yaml.RNode, error) {
if err != nil {
return nil, err
}
values, err := l.elementValues(key)
if err != nil {
return nil, err
}
values := l.elementValues(key)
// recursively set the elements in the list
for _, value := range values {
@@ -90,7 +87,7 @@ func (l Walker) elementKey() (string, error) {
// from all sources.
// Return value slice is ordered using the original ordering from the elements, where
// elements missing from earlier sources appear later.
func (l Walker) elementValues(key string) ([]string, error) {
func (l Walker) elementValues(key string) []string {
// use slice to to keep elements in the original order
// dest node must be first
var returnValues []string
@@ -111,7 +108,7 @@ func (l Walker) elementValues(key string) ([]string, error) {
seen.Insert(s)
}
}
return returnValues, nil
return returnValues
}
// fieldValue returns a slice containing each source's value for fieldName

View File

@@ -1,16 +1,5 @@
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package walk
@@ -34,5 +23,5 @@ type Visitor interface {
VisitList(nodes Sources, kind ListKind) (*yaml.RNode, error)
}
// NoOp is returned if GrepFilter should do nothing after calling Set
var ClearNode *yaml.RNode = nil
// ClearNode is returned if GrepFilter should do nothing after calling Set
var ClearNode *yaml.RNode

View File

@@ -48,9 +48,9 @@ func (l Walker) Walk() (*yaml.RNode, error) {
}
if yaml.IsAssociative(l.Sources) {
return l.walkAssociativeSequence()
} else {
return l.walkNonAssociativeSequence()
}
return l.walkNonAssociativeSequence()
case yaml.ScalarNode:
if err := yaml.ErrorIfAnyInvalidAndNonNull(yaml.ScalarNode, l.Sources...); err != nil {
return nil, err