Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
m-szalik committed Jul 24, 2024
1 parent 43e6163 commit 70b918e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions reflect_copy.go → reflect_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ func CopyStruct(src interface{}, dst interface{}, acceptFunc AcceptFunc) error {
if reflect.TypeOf(dst).Kind() != reflect.Pointer {
return fmt.Errorf("dst must be a pointer")
}
source := dereference(src)
destination := dereference(dst)
source := elemValue(src)
destination := elemValue(dst)
if source.Type() != destination.Type() {
return fmt.Errorf("source and destination must be of the same type but %T and %T had been given", source, destination)
}
Expand Down Expand Up @@ -55,7 +55,7 @@ func CopyStructAllExcept(src interface{}, dst interface{}, excludedFilePaths ...
})
}

func dereference(val interface{}) reflect.Value {
func elemValue(val interface{}) reflect.Value {
v := reflect.ValueOf(val)
if v.Kind() == reflect.Pointer {
return v.Elem()
Expand Down
File renamed without changes.

0 comments on commit 70b918e

Please sign in to comment.