Skip to content

Commit 9de0c49

Browse files
authored
Restore 1.16 compatibility (#22)
1 parent 8a691f6 commit 9de0c49

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Go
1717
uses: actions/setup-go@v4
1818
with:
19-
go-version: '1.20'
19+
go-version: '1.16'
2020

2121
- name: Test
2222
run: go test -v ./...

addtional_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestTime(t *testing.T) {
2626

2727
err = flagset.Parse([]string{"-t", "2016-Dec-13==16:03:02"})
2828
require.NoError(t, err)
29-
expeted, _ := time.Parse(time.DateTime, "2016-12-13 16:03:02")
29+
expeted, _ := time.Parse("2006-01-02 15:04:05", "2016-12-13 16:03:02")
3030
assert.Equal(t, expeted, config.T)
3131
}
3232

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/itzg/go-flagsfiller
22

3-
go 1.20
3+
go 1.16
44

55
require (
66
github.com/iancoleman/strcase v0.2.0

time.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ func init() {
1212
}
1313

1414
// DefaultTimeLayout is the default layout string to parse time, following golang time.Parse() format,
15-
// could be overriden by struct field tag "layout"
16-
var DefaultTimeLayout = time.DateTime
15+
// can be overridden per field by field tag "layout". Default value is "2006-01-02 15:04:05", which is
16+
// the same as time.DateTime in Go 1.20
17+
var DefaultTimeLayout = "2006-01-02 15:04:05"
1718

1819
type timeValue struct {
1920
t *time.Time

0 commit comments

Comments
 (0)