Skip to content

Commit

Permalink
outputs: add trailing \n at the end of files
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastien Duthil <[email protected]>
  • Loading branch information
duthils committed Mar 31, 2024
1 parent d8e8809 commit bc396bb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion functional-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,8 @@ bar: |-
r#"{
"foo": "bar",
"bar": "baz\nbam"
}"#
}
"#
);
}
}
1 change: 1 addition & 0 deletions stores/dotenv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func (store *Store) EmitPlainFile(in sops.TreeBranches) ([]byte, error) {
}
buffer.WriteString(line)
}
buffer.WriteByte('\n')
return buffer.Bytes(), nil
}

Expand Down
2 changes: 2 additions & 0 deletions stores/ini/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ func (store *Store) EmitEncryptedFile(in sops.Tree) ([]byte, error) {
if err != nil {
return nil, fmt.Errorf("Error marshaling to ini: %s", err)
}
out = append(out, '\n')
return out, nil
}

Expand Down Expand Up @@ -249,6 +250,7 @@ func (store *Store) EmitPlainFile(in sops.TreeBranches) ([]byte, error) {
if err != nil {
return nil, fmt.Errorf("Error marshaling to ini: %s", err)
}
out = append(out, '\n')
return out, nil
}

Expand Down
2 changes: 2 additions & 0 deletions stores/json/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ func (store *Store) EmitEncryptedFile(in sops.Tree) ([]byte, error) {
if err != nil {
return nil, fmt.Errorf("Error marshaling to json: %s", err)
}
out = append(out, '\n')
return out, nil
}

Expand All @@ -336,6 +337,7 @@ func (store *Store) EmitPlainFile(in sops.TreeBranches) ([]byte, error) {
if err != nil {
return nil, fmt.Errorf("Error marshaling to json: %s", err)
}
out = append(out, '\n')
return out, nil
}

Expand Down
2 changes: 2 additions & 0 deletions stores/yaml/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ func (store *Store) EmitEncryptedFile(in sops.Tree) ([]byte, error) {
}
}
e.Close()
b.WriteByte('\n')
return b.Bytes(), nil
}

Expand Down Expand Up @@ -399,6 +400,7 @@ func (store *Store) EmitPlainFile(branches sops.TreeBranches) ([]byte, error) {
}
}
e.Close()
b.WriteByte('\n')
return b.Bytes(), nil
}

Expand Down

0 comments on commit bc396bb

Please sign in to comment.