MCPcopy Index your code
hub / github.com/coder/coder / open

Function open

cli/config/file.go:109–116  ·  view source on GitHub ↗

open opens a file in the configuration directory, creating all intermediate directories.

(path string, flag int, mode os.FileMode)

Source from the content-addressed store, hash-verified

107// open opens a file in the configuration directory,
108// creating all intermediate directories.
109func open(path string, flag int, mode os.FileMode) (*os.File, error) {
110 err := os.MkdirAll(filepath.Dir(path), 0o750)
111 if err != nil {
112 return nil, err
113 }
114
115 return os.OpenFile(path, flag, mode)
116}
117
118func write(path string, mode os.FileMode, dat []byte) error {
119 fi, err := open(path, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, mode)

Callers 2

writeFunction · 0.70
readFunction · 0.70

Calls 1

MkdirAllMethod · 0.80

Tested by

no test coverage detected