Merge pull request #20 from PaperMountainStudio/PR

Write "\n" to end of jsons
This commit is contained in:
Steve Domino 2019-08-05 08:52:14 -06:00 committed by GitHub
commit 552710ac06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,7 @@ A tiny JSON database in Golang
### Installation
Install using `go get github.com/nanobox-io/golang-scribble`.
Install using `go get github.com/sdomino/scribble`.
### Usage

View File

@ -3,8 +3,7 @@ package main
import (
"encoding/json"
"fmt"
scribble "github.com/nanobox-io/golang-scribble"
"github.com/sdomino/scribble"
)
// a fish

View File

@ -114,6 +114,9 @@ func (d *Driver) Write(collection, resource string, v interface{}) error {
return err
}
// add newline to the end
b = append(b, byte('\n'))
// write marshaled data to the temp file
if err := ioutil.WriteFile(tmpPath, b, 0644); err != nil {
return err