MCPcopy Create free account
hub / github.com/cloudwan/gohan / TempFile

Function TempFile

util/util.go:198–205  ·  view source on GitHub ↗

TempFile creates a temporary file with the specified prefix and suffix

(dir string, prefix string, suffix string)

Source from the content-addressed store, hash-verified

196
197// TempFile creates a temporary file with the specified prefix and suffix
198func TempFile(dir string, prefix string, suffix string) (*os.File, error) {
199 if dir == "" {
200 dir = os.TempDir()
201 }
202
203 name := filepath.Join(dir, fmt.Sprint(prefix, time.Now().UnixNano(), suffix))
204 return os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
205}
206
207// ExitFatal ...
208func ExitFatal(a ...interface{}) {

Callers 1

util_test.goFile · 0.85

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected