1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package main
- import (
- "encoding/json"
- "fmt"
- "os"
- )
- func main() {
- p := Parser{DebugJSON: "_debug.json"}
- root, err := p.Load("Test Dummy.txt")
- if err != nil {
- fmt.Println("Parser.Load", err)
- return
- }
- profile := Profile{}
- err = profile.Parse(root)
- if err != nil {
- fmt.Println("Profile.Parse", err)
- return
- }
- pay, err := json.MarshalIndent(profile, "", " ")
- if err != nil {
- fmt.Println("Marshal (Profile)", err)
- return
- }
- err = os.WriteFile("_debug1.json", pay, 0660)
- if err != nil {
- fmt.Println("WriteFile", err)
- return
- }
- fmt.Println(profile.Pilot)
- fmt.Println(profile.Date.String())
- fmt.Println(profile.Location.String())
- fmt.Println(profile.Travel.String())
- /*profile.Travel.Path = append(profile.Travel.Path, "Someplace")
- profile.Travel.Destination = "Someplace Safe"
- err = profile.Update()
- if err != nil {
- fmt.Println("Profile.Update", err)
- return
- }*/
- pay, err = json.MarshalIndent(root, "", " ")
- if err != nil {
- fmt.Println("Marshal (Root)", err)
- return
- }
- err = os.WriteFile("_debug2.json", pay, 0660)
- if err != nil {
- fmt.Println("WriteFile", err)
- return
- }
- }
|