massive: move a lot of things

This commit is contained in:
Inanc Gumus
2019-04-26 21:32:20 +03:00
parent da30b109f8
commit 0547b1e320
105 changed files with 2624 additions and 192 deletions

View File

@ -0,0 +1,35 @@
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"strings"
)
// Wizard is one of the greatest of people
type Wizard struct {
// name won't be marshalled (should be exported)
Name string `json:name`
Lastname string `json:"-"`
Nick string `json:"nick"`
}
func main() {
file, err := ioutil.ReadFile("../marshal/wizards.json")
if err != nil {
panic(err)
}
wizards := make([]Wizard, 10)
if json.Unmarshal(file, &wizards) != nil {
panic(err)
}
fmt.Printf("%-15s %-15s\n%s",
"Name", "Nick", strings.Repeat("=", 25))
for _, w := range wizards {
fmt.Printf("%-15s %-15s\n", w.Name, w.Nick)
}
}