MCPcopy
hub / github.com/hashicorp/packer / Set

Method Set

command/flag-kv/flag_json.go:20–37  ·  view source on GitHub ↗
(raw string)

Source from the content-addressed store, hash-verified

18}
19
20func (v *FlagJSON) Set(raw string) error {
21 f, err := os.Open(raw)
22 if err != nil {
23 return err
24 }
25 defer f.Close()
26
27 if *v == nil {
28 *v = make(map[string]string)
29 }
30
31 if err := json.NewDecoder(f).Decode(v); err != nil {
32 return fmt.Errorf(
33 "Error reading variables in '%s': %s", raw, err)
34 }
35
36 return nil
37}

Callers 1

CoreMethod · 0.95

Calls 2

CloseMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected