func Encode(w WriteSeekerTruncater, v interface{}) error {
	if _, err := w.Seek(0, io.SeekStart); err != nil {
		return err
	}

	if err := w.Truncate(0); err != nil {
		return err
	}

	return json.NewEncoder(w).Encode(v)
}
// Encode a JSON value to a writer. The encoding is tailored towards jump JSON
// file needs. Every write truncates the writable and seeks it to it's
// beginning, so you can safely decode and encode without manipulating the
// writable.
//
// Technically, the writable needs to implement WriterSeekerTruncater, but
// you'll most likely use an os.File.
Encode a JSON value to a writer. The encoding is tailored towards jump JSON
file needs. Every write truncates the writable and seeks it to it's
beginning, so you can safely decode and encode without manipulating the
writable.

Technically, the writable needs to implement WriterSeekerTruncater, but
you'll most likely use an os.File.
// Encode a JSON value to a writer . The encoding is tailored towards jump JSON // file needs . Every write truncates the writable and seeks it to it ' s // beginning so you can safely decode and encode without manipulating the // writable . // // Technically the writable needs to implement WriterSeekerTruncater but // you ' ll most likely use an os . File .
func Encode(w WriteSeekerTruncater, v interface{}) error {
	if _, err := w.Seek(0, io.SeekStart); err != nil {
		return err
	}
	if err := w.Truncate(0); err != nil {
		return err
	}
	return json.NewEncoder(w).Encode(v)
}
func Encode ( w WriteSeekerTruncater , v interface { } ) error { if _ , err := w . Seek ( 0 , io . SeekStart ) ; err != nil { return err } if err := w . Truncate ( 0 ) ; err != nil { return err } return json . NewEncoder ( w ) . Encode ( v ) }
Encode a JSON value to a writer.
Encode a JSON value to a writer .