blob: 3bdd43a08f0db991c490b1b6d634b5441e5ce39d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package bench
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
)
type bucketItems map[string]string
type buckets map[string]bucketItems
type Benchmark struct {
buckets buckets
}
func New(filePath string) (*Benchmark, error) {
data := readFromFile(filePath)
}
func readFromFile(filePath string) (*Benchmark, error) {
if _, err := os.Stat(filePath); os.IsNotExist(err) {
return nil, err
}
file, err := ioutil.ReadFile(filePath)
if err != nil {
return nil, err
}
b := new(Benchmark)
if err := json.Unmarshal(file, &b.buckets); err != nil {
return nil, err
}
return b, nil
}
func (b *Benchmark) Run() error {
fmt.Println("Do things, run benchmarks, tell people...")
return nil
}
|