https://github.com/gokits/gotools
tools for golang
https://github.com/gokits/gotools
Last synced: 6 months ago
JSON representation
tools for golang
- Host: GitHub
- URL: https://github.com/gokits/gotools
- Owner: gokits
- Created: 2016-09-08T15:39:47.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-02T12:27:52.000Z (almost 5 years ago)
- Last Synced: 2024-08-03T09:07:07.373Z (over 1 year ago)
- Language: Go
- Size: 11.7 KB
- Stars: 15
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-star - gotools
README
# gotools
tools for golang
## StructCopy
Copy fields which have same name and types between different types of struct. Note that unexported fields are ignored.
```go
type Src struct {
A int
B string
c byte
}
type Dst struct {
A int
B byte
c byte
}
func main(){
src := &Src{3, "hello", '2'}
var dst Dst
gotools.StructCopy(&dst, src)
fmt.Println(dst)
}
/* output
{3 0 0}
*/
```