From d4fa006ccb97ae75030a2a0ddf0c5b89d6405829 Mon Sep 17 00:00:00 2001 From: Arthur Mello Date: Thu, 5 Dec 2019 23:27:01 -0300 Subject: [PATCH] Remove leading/trailing newlines following whitespace linter recommendation --- kyaml/copyutil/copyutil_test.go | 1 - kyaml/kio/byteio_reader.go | 2 -- kyaml/kio/byteio_reader_test.go | 1 - kyaml/kio/byteio_writer.go | 1 - kyaml/kio/filters/fmtr_test.go | 2 -- kyaml/kio/pkgio_reader_test.go | 2 -- kyaml/yaml/example_test.go | 1 - kyaml/yaml/fns.go | 1 - kyaml/yaml/match.go | 1 - kyaml/yaml/merge3/visitor.go | 1 - 10 files changed, 13 deletions(-) diff --git a/kyaml/copyutil/copyutil_test.go b/kyaml/copyutil/copyutil_test.go index b2025018c..59a25635c 100644 --- a/kyaml/copyutil/copyutil_test.go +++ b/kyaml/copyutil/copyutil_test.go @@ -79,7 +79,6 @@ func TestDiff_additionalDestFiles(t *testing.T) { diff, err := Diff(s, d) assert.NoError(t, err) assert.ElementsMatch(t, diff.List(), []string{"a2"}) - } // TestDiff_srcDestContentsDiffer verifies if the file contents diff --git a/kyaml/kio/byteio_reader.go b/kyaml/kio/byteio_reader.go index 80e52ef87..f7b627c7d 100644 --- a/kyaml/kio/byteio_reader.go +++ b/kyaml/kio/byteio_reader.go @@ -138,7 +138,6 @@ func (r *ByteReader) Read() ([]*yaml.RNode, error) { len(values) == 1 && // Only unwrap if there is only 1 value (meta.Kind == ResourceListKind || meta.Kind == "List") && node.Field("items") != nil { - r.WrappingKind = meta.Kind r.WrappingAPIVersion = meta.APIVersion @@ -154,7 +153,6 @@ func (r *ByteReader) Read() ([]*yaml.RNode, error) { // add items output = append(output, yaml.NewRNode(items.Value.Content()[i])) } - } continue } diff --git a/kyaml/kio/byteio_reader_test.go b/kyaml/kio/byteio_reader_test.go index 7723ec94f..4e0f237d8 100644 --- a/kyaml/kio/byteio_reader_test.go +++ b/kyaml/kio/byteio_reader_test.go @@ -87,7 +87,6 @@ elems: assert.Equal(t, ResourceListKind, r.WrappingKind) assert.Equal(t, ResourceListAPIVersion, r.WrappingAPIVersion) - } func TestByteReader_Read_wrappedList(t *testing.T) { diff --git a/kyaml/kio/byteio_writer.go b/kyaml/kio/byteio_writer.go index 2a5498519..9b56e4e56 100644 --- a/kyaml/kio/byteio_writer.go +++ b/kyaml/kio/byteio_writer.go @@ -54,7 +54,6 @@ func (w ByteWriter) Write(nodes []*yaml.RNode) error { encoder := yaml.NewEncoder(w.Writer) defer encoder.Close() for i := range nodes { - // clean resources by removing annotations set by the Reader if !w.KeepReaderAnnotations { _, err := nodes[i].Pipe(yaml.ClearAnnotation(kioutil.IndexAnnotation)) diff --git a/kyaml/kio/filters/fmtr_test.go b/kyaml/kio/filters/fmtr_test.go index 2521a7ab5..a60aa23a4 100644 --- a/kyaml/kio/filters/fmtr_test.go +++ b/kyaml/kio/filters/fmtr_test.go @@ -145,7 +145,6 @@ spec: // TestFormatInput_service verifies a Service yaml is formatted correctly func TestFormatInput_service(t *testing.T) { - y := ` apiVersion: v1 kind: Service @@ -178,7 +177,6 @@ spec: // TestFormatInput_service verifies a Service yaml is formatted correctly func TestFormatInput_validatingWebhookConfiguration(t *testing.T) { - y := ` apiVersion: admissionregistration.k8s.io/v1beta1 kind: ValidatingWebhookConfiguration diff --git a/kyaml/kio/pkgio_reader_test.go b/kyaml/kio/pkgio_reader_test.go index 64ad089cc..8a446a601 100644 --- a/kyaml/kio/pkgio_reader_test.go +++ b/kyaml/kio/pkgio_reader_test.go @@ -79,7 +79,6 @@ func TestLocalPackageReader_Read_empty(t *testing.T) { assert.Contains(t, err.Error(), "must specify package path") } assert.Nil(t, nodes) - } func TestLocalPackageReader_Read_pkg(t *testing.T) { @@ -207,7 +206,6 @@ func TestLocalPackageReader_Read_pkgOmitAnnotations(t *testing.T) { {path: s.root}, } for _, p := range paths { - // empty path rfr := LocalPackageReader{PackagePath: p.path, OmitReaderAnnotations: true} nodes, err := rfr.Read() diff --git a/kyaml/yaml/example_test.go b/kyaml/yaml/example_test.go index 5d4b28de3..d2a1999e9 100644 --- a/kyaml/yaml/example_test.go +++ b/kyaml/yaml/example_test.go @@ -872,7 +872,6 @@ func ExampleRNode_Elements() { // Element: 2 // name: baz // args: ['run.sh'] - } func ExampleRNode_ElementValues() { diff --git a/kyaml/yaml/fns.go b/kyaml/yaml/fns.go index 1fc2eae83..d2f6218e4 100644 --- a/kyaml/yaml/fns.go +++ b/kyaml/yaml/fns.go @@ -129,7 +129,6 @@ func (c FieldClearer) Filter(rn *RNode) (*RNode, error) { } for i := 0; i < len(rn.Content()); i += 2 { - // if name matches, remove these 2 elements from the list because // they are treated as a fieldName/fieldValue pair. if rn.Content()[i].Value == c.Name { diff --git a/kyaml/yaml/match.go b/kyaml/yaml/match.go index a92203c2d..149716063 100644 --- a/kyaml/yaml/match.go +++ b/kyaml/yaml/match.go @@ -104,7 +104,6 @@ func (p *PathMatcher) doField(rn *RNode) (*RNode, error) { // doSeq iterates over a sequence and appends elements matching the path regex to p.Val func (p *PathMatcher) doSeq(rn *RNode) (*RNode, error) { - // parse the field + match pair var err error p.field, p.matchRegex, err = SplitIndexNameValue(p.Path[0]) diff --git a/kyaml/yaml/merge3/visitor.go b/kyaml/yaml/merge3/visitor.go index ab39cdc8a..7e2f12cc8 100644 --- a/kyaml/yaml/merge3/visitor.go +++ b/kyaml/yaml/merge3/visitor.go @@ -135,7 +135,6 @@ func (m Visitor) getStrValues(nodes walk.Sources) (strValues, error) { if err != nil { return strValues{}, err } - } if nodes.Dest() != nil && nodes.Dest().YNode() != nil { s := nodes.Dest().YNode().Style