Line | |
---|
1 | package main
|
---|
2 |
|
---|
3 | import (
|
---|
4 | "fmt"
|
---|
5 | "io"
|
---|
6 | "net/http"
|
---|
7 | )
|
---|
8 |
|
---|
9 | // Print the current phase of the Moon in standard output
|
---|
10 | // Optional arguments: format
|
---|
11 | func ShowMoonPhases(format string, lang string) {
|
---|
12 | query := "https://wttr.in/" + "moon" + "?" + format + "&lang=" + lang
|
---|
13 | resp, err := http.Get(query)
|
---|
14 | sanityCheck(err)
|
---|
15 | defer resp.Body.Close()
|
---|
16 | body, err := io.ReadAll(resp.Body)
|
---|
17 | sanityCheck(err)
|
---|
18 | fmt.Printf("%s\n", body)
|
---|
19 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.