MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / Write

Function Write

agent/utils/env/env.go:12–27  ·  view source on GitHub ↗
(envMap map[string]string, filename string)

Source from the content-addressed store, hash-verified

10)
11
12func Write(envMap map[string]string, filename string) error {
13 content, err := Marshal(envMap)
14 if err != nil {
15 return err
16 }
17 file, err := os.Create(filename)
18 if err != nil {
19 return err
20 }
21 defer file.Close()
22 _, err = file.WriteString(content + "\n")
23 if err != nil {
24 return err
25 }
26 return file.Sync()
27}
28
29func Marshal(envMap map[string]string) (string, error) {
30 lines := make([]string, 0, len(envMap))

Callers

nothing calls this directly

Calls 4

MarshalFunction · 0.85
CreateMethod · 0.65
CloseMethod · 0.65
SyncMethod · 0.65

Tested by

no test coverage detected