Skip to content

Commit 4f1aebe

Browse files
committed
chore: Adjust for Go1.17
- update actions to use Go1.17 - add test file with build tag for Go1.17 due to csv.ParseError.Column being now 1-indexed
1 parent 1726944 commit 4f1aebe

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
test:
1212
strategy:
1313
matrix:
14-
go-version: [1.15, 1.16]
14+
go-version: [1.16, 1.17]
1515
os: [ubuntu-latest, macos-latest, windows-latest]
1616

1717
runs-on: ${{ matrix.os }}

csvutil_go110_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// +build go1.10
1+
//go:build !go1.17 && go1.10
2+
// +build !go1.17,go1.10
23

34
package csvutil
45

csvutil_go117_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//go:build go1.17
2+
// +build go1.17
3+
4+
package csvutil
5+
6+
import (
7+
"encoding/csv"
8+
"reflect"
9+
)
10+
11+
// In Go1.17 csv.ParseError.Column became 1-indexed instead of 0-indexed.
12+
// so we need this file for Go 1.17+.
13+
14+
var testUnmarshalInvalidFirstLineErr = &csv.ParseError{
15+
StartLine: 1,
16+
Line: 1,
17+
Column: 2,
18+
Err: csv.ErrQuote,
19+
}
20+
21+
var testUnmarshalInvalidSecondLineErr = &csv.ParseError{
22+
StartLine: 2,
23+
Line: 2,
24+
Column: 2,
25+
Err: csv.ErrQuote,
26+
}
27+
28+
var ptrUnexportedEmbeddedDecodeErr = errPtrUnexportedStruct(reflect.TypeOf(new(embedded)))

0 commit comments

Comments
 (0)