MCPcopy Create free account
hub / github.com/cogentcore/core / writeTempFile

Function writeTempFile

cmd/core/mobile/writer_test.go:143–154  ·  view source on GitHub ↗
(data string)

Source from the content-addressed store, hash-verified

141`
142
143func writeTempFile(data string) (string, error) {
144 f, err := ioutil.TempFile("", "gofmt")
145 if err != nil {
146 return "", err
147 }
148 _, err = io.WriteString(f, data)
149 errc := f.Close()
150 if err == nil {
151 return f.Name(), errc
152 }
153 return f.Name(), err
154}
155
156func diff(got, want string) (string, error) {
157 wantPath, err := writeTempFile(want)

Callers 1

diffFunction · 0.85

Calls 3

WriteStringMethod · 0.80
CloseMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected