diff options
Diffstat (limited to 'bench/bench.go')
-rw-r--r-- | bench/bench.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/bench/bench.go b/bench/bench.go new file mode 100644 index 0000000..3bdd43a --- /dev/null +++ b/bench/bench.go @@ -0,0 +1,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 +} |