Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

Latest commit

 

History

History
29 lines (24 loc) · 820 Bytes

README.md

File metadata and controls

29 lines (24 loc) · 820 Bytes

Go Report Card go-doc

tempfile

An implementation of ioutil.TempFile, but also with an additional parameter for a deterministic suffix.

This is a workaround for golang/go#4896.

Example

import "github.com/tink-ab/tempfile"

myFile, err := tempfile.TempFile("", "my-prefix", "my-suffix")
if err != nil {
    handleError(err)
}
defer myFile.Close()
defer func() {
    if err := os.Remove(myFile.Name()); err != nil {
        handleRemovalError(err)
    }
}()

doSomethingWith(myFile)