shad-go/lectures/06-http/simpleget/simpleget.go

16 lines
194 B
Go
Raw Normal View History

2020-04-02 11:42:31 +00:00
package main
import (
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://golang.org")
if err != nil {
panic(err)
}
2020-04-02 14:01:16 +00:00
defer resp.Body.Close()
2020-04-02 11:42:31 +00:00
fmt.Println(resp.StatusCode)
}