Last active
July 15, 2016 05:59
-
-
Save lysu/c13fec4ea21840956d0149b9c54a5b3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type TempData struct { | |
F1 string | |
F2 string | |
} | |
type TranData struct { | |
T1 *string | |
T2 *string | |
} | |
func main() { | |
ts := []TempData{ | |
TempData { | |
F1: "aaa", | |
F2: "AAA", | |
}, | |
TempData { | |
F1: "bbb", | |
F2: "BBB", | |
}, | |
} | |
trans := []TranData{} | |
for _, t := range ts { | |
d := TranData{} | |
d.T1 = &t.F1 | |
d.T2 = &t.F2 | |
trans = append(trans, d) | |
} | |
for _, tt := range trans { | |
fmt.Println(*tt.T1, *tt.T2) | |
} | |
} |
carbin-gun
commented
Jul 15, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment