1
2
3
4
5 package b
6
7 import (
8 "io/ioutil"
9
10 "./a"
11 )
12
13 var G int
14
15
16
17
18 func ReadValues(data []byte) (vals map[string]interface{}, err error) {
19 err = a.Unmarshal(data, &vals)
20 if len(vals) == 0 {
21 vals = map[string]interface{}{}
22 }
23 return
24 }
25
26
27
28 func CallReadValues(filename string) (map[string]interface{}, error) {
29 defer func() { G++ }()
30 data, err := ioutil.ReadFile(filename)
31 if err != nil {
32 return map[string]interface{}{}, err
33 }
34 return ReadValues(data)
35 }
36
View as plain text