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

Function WriteWithOrder

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

Source from the content-addressed store, hash-verified

41}
42
43func WriteWithOrder(envMap map[string]string, filename string, orders []string) error {
44 content, err := MarshalWithOrder(envMap, orders)
45 if err != nil {
46 return err
47 }
48 file, err := os.Create(filename)
49 if err != nil {
50 return err
51 }
52 defer file.Close()
53 _, err = file.WriteString(content + "\n")
54 if err != nil {
55 return err
56 }
57 return file.Sync()
58}
59
60func MarshalWithOrder(envMap map[string]string, orders []string) (string, error) {
61 lines := make([]string, 0, len(envMap))

Callers

nothing calls this directly

Calls 4

MarshalWithOrderFunction · 0.85
CreateMethod · 0.65
CloseMethod · 0.65
SyncMethod · 0.65

Tested by

no test coverage detected