Merge pull request #20 from PaperMountainStudio/PR
Write "\n" to end of jsons
This commit is contained in:
commit
552710ac06
|
@ -5,7 +5,7 @@ A tiny JSON database in Golang
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
Install using `go get github.com/nanobox-io/golang-scribble`.
|
Install using `go get github.com/sdomino/scribble`.
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/sdomino/scribble"
|
||||||
scribble "github.com/nanobox-io/golang-scribble"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// a fish
|
// a fish
|
||||||
|
|
|
@ -114,6 +114,9 @@ func (d *Driver) Write(collection, resource string, v interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add newline to the end
|
||||||
|
b = append(b, byte('\n'))
|
||||||
|
|
||||||
// write marshaled data to the temp file
|
// write marshaled data to the temp file
|
||||||
if err := ioutil.WriteFile(tmpPath, b, 0644); err != nil {
|
if err := ioutil.WriteFile(tmpPath, b, 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue
Block a user