2021-08-14から1日間の記事一覧

Golang for loop

よく使ってるやつ for index, value := range []string{"a", "b", "c"} { fmt.Println(index, value) } map を回すとき for key, value := range map[string]string{"a": "a1", "b": "b1", "c": "c1"} { fmt.Println(key, value) } あとは continue, break …

Golang gzip response → struct

gzip圧縮されたresponseをhoge struct にいれるまで import ( "net/http" "compress/gzip" "bytes" "encoding/json" ) func main() { // どこかへGetRequest req, err := http.NewRequest(http.MethodGet, "https://hogehoge/foo/bar.jp", nil) if err != ni…