Skip to content

Commit

Permalink
Fix copier on v1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Dec 1, 2021
1 parent d380b4d commit 5de5170
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
ci:
strategy:
matrix:
go: ['1.15', '1.14', '1.13']
go: ['1.16', '1.17']
platform: [ubuntu-latest, macos-latest] # can not run in windows OS
runs-on: ${{ matrix.platform }}

Expand Down
5 changes: 4 additions & 1 deletion copier.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ func deepFields(reflectType reflect.Type) []reflect.StructField {

for i := 0; i < reflectType.NumField(); i++ {
v := reflectType.Field(i)
if v.IsExported() {
// PkgPath is the package path that qualifies a lower case (unexported)
// field name. It is empty for upper case (exported) field names.
// See https://golang.org/ref/spec#Uniqueness_of_identifiers
if v.PkgPath == "" {
if v.Anonymous {
fields = append(fields, deepFields(v.Type)...)
} else {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/jinzhu/copier

go 1.15
go 1.13

0 comments on commit 5de5170

Please sign in to comment.