You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change updates the jsonutil package to add functions related to saving and
loading JSON content to and from disk. It also adjusts the existing funcions
to accomodate the new functions.
The following are added:
* `UnmarshalFromReaderInto`: This function provides functionality that was
previously `UnmarshalFromReader`.
* `LoadAs`: This function reads the given path from the filesystem and
unmarshals it into a new instance of the given type.
* `LoadWith`: This function calls the given read function and unmarshals the
returned content into a new instance of the given type.
* `Save`: This function unmarshals the given instance and writes it to the
specified path in the filesystem.
* `SaveWith`: this funcion unmarshals the given instance and passes the
content, specified path, and specified mode to the specified write function.
The following have been updated:
* `PrintJSONOn`: This funtion no longer includes a trailing newline in content
written to the provided io.Writer. It has been updated to take a type
parameter.
* `ToJSON`: This function no longer includes a trainling newlint in the
returned string. It has been updated to take a type parameter.
* `UnmarshalFromReader`: This function has been updated to return a new
instance of the type being unmarshaled. The previous behavior of updating a
instance allocated by the caller is now provided by `UnmarshalFromReaderInto`
Signed-off-by: m-d-key <[email protected]>
Co-authored-by: m-d-key <[email protected]>
0 commit comments