github.com/hanwen/go-fuse@v1.0.0/benchmark/benchmark.go (about) 1 // Copyright 2016 the Go-FUSE Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package benchmark 6 7 // Routines for benchmarking fuse. 8 9 import ( 10 "bufio" 11 "log" 12 "os" 13 ) 14 15 func ReadLines(name string) []string { 16 f, err := os.Open(name) 17 if err != nil { 18 log.Fatal("ReadLines: ", err) 19 } 20 defer f.Close() 21 r := bufio.NewReader(f) 22 23 l := []string{} 24 for { 25 line, _, err := r.ReadLine() 26 if line == nil || err != nil { 27 break 28 } 29 30 fn := string(line) 31 l = append(l, fn) 32 } 33 if len(l) == 0 { 34 log.Fatal("no files added") 35 } 36 37 return l 38 }