Skip to content

Commit

Permalink
Merge pull request helm#3988 from kubernetes/revert-3837-toYaml-pr
Browse files Browse the repository at this point in the history
Revert "toYaml - Fix helm#3470 and helm#3410's trailing \n issues"
  • Loading branch information
Matthew Fisher authored Apr 30, 2018
2 parents 6871486 + f7f686f commit b353681
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/chartutil/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func ToYaml(v interface{}) string {
// Swallow errors inside of a template.
return ""
}
return strings.TrimSuffix(string(data), "\n")
return string(data)
}

// FromYaml converts a YAML document into a map[string]interface{}.
Expand Down
8 changes: 4 additions & 4 deletions pkg/chartutil/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ func TestToConfig(t *testing.T) {

f := NewFiles(getTestFiles())
out := f.Glob("**/captain.txt").AsConfig()
as.Equal("captain.txt: The Captain", out)
as.Equal("captain.txt: The Captain\n", out)

out = f.Glob("ship/**").AsConfig()
as.Equal("captain.txt: The Captain\nstowaway.txt: Legatt", out)
as.Equal("captain.txt: The Captain\nstowaway.txt: Legatt\n", out)
}

func TestToSecret(t *testing.T) {
Expand All @@ -84,7 +84,7 @@ func TestToSecret(t *testing.T) {
f := NewFiles(getTestFiles())

out := f.Glob("ship/**").AsSecrets()
as.Equal("captain.txt: VGhlIENhcHRhaW4=\nstowaway.txt: TGVnYXR0", out)
as.Equal("captain.txt: VGhlIENhcHRhaW4=\nstowaway.txt: TGVnYXR0\n", out)
}

func TestLines(t *testing.T) {
Expand All @@ -99,7 +99,7 @@ func TestLines(t *testing.T) {
}

func TestToYaml(t *testing.T) {
expect := "foo: bar"
expect := "foo: bar\n"
v := struct {
Foo string `json:"foo"`
}{
Expand Down
2 changes: 1 addition & 1 deletion pkg/strvals/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ToYAML(s string) (string, error) {
return "", err
}
d, err := yaml.Marshal(m)
return strings.TrimSuffix(string(d), "\n"), err
return string(d), err
}

// Parse parses a set line.
Expand Down
2 changes: 1 addition & 1 deletion pkg/strvals/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func TestToYAML(t *testing.T) {
if err != nil {
t.Fatal(err)
}
expect := "name: value"
expect := "name: value\n"
if o != expect {
t.Errorf("Expected %q, got %q", expect, o)
}
Expand Down

0 comments on commit b353681

Please sign in to comment.