MCPcopy Index your code
hub / github.com/jetify-com/devbox / Init

Function Init

internal/devconfig/init.go:13–35  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

11)
12
13func Init(dir string) (*Config, error) {
14 file, err := os.OpenFile(
15 filepath.Join(dir, configfile.DefaultName),
16 os.O_RDWR|os.O_CREATE|os.O_EXCL,
17 0o644,
18 )
19 if err != nil {
20 return nil, err
21 }
22 defer func() {
23 if err != nil {
24 os.Remove(file.Name())
25 }
26 }()
27
28 newConfig := DefaultConfig()
29 _, err = file.Write(newConfig.Root.Bytes())
30 defer file.Close()
31 if err != nil {
32 return nil, err
33 }
34 return newConfig, nil
35}

Callers 7

InitConfigFunction · 0.92
InitConfigFunction · 0.92
devboxForTestingFunction · 0.92
TestOpenFunction · 0.85
TestOpenErrorFunction · 0.85
TestFindFunction · 0.85
TestFindErrorFunction · 0.85

Calls 4

DefaultConfigFunction · 0.85
WriteMethod · 0.80
BytesMethod · 0.80
RemoveMethod · 0.45

Tested by 5

devboxForTestingFunction · 0.74
TestOpenFunction · 0.68
TestOpenErrorFunction · 0.68
TestFindFunction · 0.68
TestFindErrorFunction · 0.68