Go Tricks - unpack slice to struct fields
Use reflect, in this example, we only show to unpack an int slice to a struct whose fields are all int type.
package main
import (
"errors"
"fmt"
"reflect"
)
type Location struct {
X int
Y int
Z int
}
func (loc Location) St...
hn.0xbf.me1 min read