MCPcopy Create free account
hub / github.com/coder/envbuilder / WriteFile

Function WriteFile

testutil/gittest/gittest.go:274–282  ·  view source on GitHub ↗

WriteFile writes a file to the filesystem.

(t *testing.T, fs billy.Filesystem, path, content string)

Source from the content-addressed store, hash-verified

272
273// WriteFile writes a file to the filesystem.
274func WriteFile(t *testing.T, fs billy.Filesystem, path, content string) {
275 t.Helper()
276 file, err := fs.OpenFile(path, os.O_CREATE|os.O_RDWR, 0o644)
277 require.NoError(t, err)
278 _, err = file.Write([]byte(content))
279 require.NoError(t, err)
280 err = file.Close()
281 require.NoError(t, err)
282}

Callers 1

CommitFunction · 0.85

Calls 3

WriteMethod · 0.80
CloseMethod · 0.80
OpenFileMethod · 0.65

Tested by

no test coverage detected