Extract scanning ASCII files into a util package
This commit is contained in:
@@ -3,6 +3,8 @@ package data
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
|
||||
"ur.gs/chaos-gate/internal/util/asciiscan"
|
||||
)
|
||||
|
||||
// Comments are `//`, start of line only, for accounting
|
||||
@@ -13,11 +15,14 @@ var (
|
||||
type Accounting map[string]string
|
||||
|
||||
func LoadAccounting(filename string) (Accounting, error) {
|
||||
scanLines, err := fileToScanner(filename)
|
||||
s, err := asciiscan.New(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer s.Close()
|
||||
scanLines := s.Bufio()
|
||||
|
||||
out := make(Accounting)
|
||||
|
||||
for scanLines.Scan() {
|
||||
|
Reference in New Issue
Block a user