Documentation ¶
Overview ¶
Package backup is a simple library for backing up a config file and restoring it using a temporary file.
Example usage:
tmp, err := backup.Save(someFile) if err != nil { return fmt.Errorf("backing up %q: %v", somePath, err) } defer tmp.Release() // ... do real work ... tmp.Restore()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
A File records the locations of an original file and a backup copy of that file. The Restore method replaces the contents of the original with the backup, overwriting any changes that were made since the backup was created.
func New ¶
New creates a backup copy of the specified file, located in the same directory. The caller should ensure the Release method is called when the backup is no longer needed, to clean up.
func (*File) GetDiff ¶ added in v0.0.49
GetDiff compares the modified file against the original and returns a diff.
Click to show internal directories.
Click to hide internal directories.