MCPcopy
hub / github.com/coder/websocket / tempJSONFile

Function tempJSONFile

autobahn_test.go:282–302  ·  view source on GitHub ↗
(v any)

Source from the content-addressed store, hash-verified

280}
281
282func tempJSONFile(v any) (string, error) {
283 f, err := os.CreateTemp("", "temp.json")
284 if err != nil {
285 return "", fmt.Errorf("temp file: %w", err)
286 }
287 defer f.Close()
288
289 e := json.NewEncoder(f)
290 e.SetIndent("", "\t")
291 err = e.Encode(v)
292 if err != nil {
293 return "", fmt.Errorf("json encode: %w", err)
294 }
295
296 err = f.Close()
297 if err != nil {
298 return "", fmt.Errorf("close temp file: %w", err)
299 }
300
301 return f.Name(), nil
302}

Callers 1

wstestServerFunction · 0.85

Calls 1

CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…