Skip to content

Commit 96d7e44

Browse files
author
Michael Sh
committed
Slice of tests initialized with no length
1 parent 98a45ae commit 96d7e44

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

igrf/igrf_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ func produceTestsDataFromFile(file_descr *os.File) []testsData {
222222
scanner := bufio.NewScanner(file_descr)
223223
split_regex := regexp.MustCompile(`\s+`)
224224
var lat, lon, alt float64
225-
tests := make([]testsData, 125)
226-
for num, i := 0, 0; scanner.Scan(); num++ {
225+
var tests []testsData
226+
for num := 0; scanner.Scan(); num++ {
227227
line := scanner.Text()
228228
if num == 1 {
229229
// this is just a column names
@@ -244,8 +244,7 @@ func produceTestsDataFromFile(file_descr *os.File) []testsData {
244244
want: igrf_res,
245245
wantErr: false,
246246
}
247-
tests[i] = current_test
248-
i++
247+
tests = append(tests, current_test)
249248
}
250249
return tests
251250
}

0 commit comments

Comments
 (0)