diff options
author | Ben Burwell <ben@benburwell.com> | 2020-02-05 23:47:44 -0500 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2020-02-05 23:47:44 -0500 |
commit | e8a58306f21ec14582b0b19cf34065c5aa4c6351 (patch) | |
tree | 9b34fbac46210ef179f7ef8bf3a8032db1690a9f /main.go |
initial commit
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -0,0 +1,26 @@ +package main + +import ( + "context" + "fmt" + "strings" + + "bnbl.io/wx/metar" +) + +func main() { + var mc metar.Client + req := metar.NewRequest( + metar.StationString("KBOS KBED KOWD KORH"), + metar.HoursBeforeNow(4.0), + metar.MostRecentForEachStation(metar.MostRecentConstraint), + ) + res, err := mc.GetMETARs(context.Background(), req) + if err != nil { + fmt.Printf("could not get metar: %v\n", err) + return + } + for _, m := range res.Data.METARs { + fmt.Printf("%s\n", strings.TrimSpace(m.RawText)) + } +} |