Go: cmd/go/internal/renameio Index | Files

package renameio

import "cmd/go/internal/renameio"

Package renameio writes files atomically by renaming temporary files.

Index

Package Files

renameio.go

func Pattern Uses

func Pattern(filename string) string

Pattern returns a glob pattern that matches the unrenamed temporary files created when writing to filename.

func WriteFile Uses

func WriteFile(filename string, data []byte) (err error)

WriteFile is like ioutil.WriteFile, but first writes data to an arbitrary file in the same directory as filename, then renames it atomically to the final name.

That ensures that the final location, if it exists, is always a complete file.

func WriteToFile Uses

func WriteToFile(filename string, data io.Reader) (err error)

WriteToFile is a variant of WriteFile that accepts the data as an io.Reader instead of a slice.

Package renameio imports 5 packages (graph) and is imported by 6 packages. Updated 2019-06-13. Refresh now. Tools for package owners.