{"id":3693,"date":"2019-02-23T00:47:48","date_gmt":"2019-02-22T15:47:48","guid":{"rendered":"https:\/\/greentown.tokyo\/?p=3693"},"modified":"2019-02-23T00:51:09","modified_gmt":"2019-02-22T15:51:09","slug":"10minutes-go12","status":"publish","type":"post","link":"https:\/\/greentown.tokyo\/?p=3693","title":{"rendered":"10\u5206GO 12\u65e5\u76ee"},"content":{"rendered":"<p>\u5fd9\u3057\u3044\u306e\u306b\u3088\u304f\u9811\u5f35\u3063\u3066\u3044\u307e\u3059\uff01<\/p>\n<p>\u81ea\u5206\u3092\u8912\u3081\u305f\u3044\uff01\uff01<\/p>\n<p>\u30d1\u30d1\u306b\u8a00\u3046\u3068\u3001\u307b\u3081\u3089\u308c\u308b\u304b\u3089\u3084\u308b\u3063\u3066\u3069\u3046\u304b\u3068\u601d\u3046\u30fb\u30fb\u3063\u3066\u3001\u3044\u3063\u3064\u3082\u8a00\u308f\u308c\u308b\u3093\u3067\u3059\u304c\u3001\u5973\u5fc3\u3092\u5168\u304f\u7406\u89e3\u3057\u3066\u3044\u307e\u305b\u3093\u306d\uff01<\/p>\n<p>\u79c1\u3082\u7121\u610f\u8b58\u306b\u5b50\u3069\u3082\u306b\u30c0\u30e1\u51fa\u3057\u3057\u3061\u3083\u3046\u6642\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u3044\u304b\u3093\u3044\u304b\u3093\uff01\u3068\u53cd\u7701\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u8912\u3081\u3089\u308c\u308c\u3066\u5b09\u3057\u304f\u306a\u3044\u4eba\u306a\u3093\u3066\u3001\u3042\u3093\u307e\u308a\u3044\u306a\u3044\u3068\u601d\u3046\u3088\uff01<\/p>\n<p>\u304b\u308f\u3044\u3044\u306d\uff01\uff08\u3053\u308c\u306f\u30d1\u30d1\u8a00\u3063\u3066\u304f\u308c\u307e\u3059\u304c\uff01\uff09\u3068\u304b\u3088\u308a\u3001\u9811\u5f35\u308a\u3092\u8912\u3081\u3066\u6b32\u3057\u3044\u306e\u306d\u3093&#x2728;<\/p>\n<p>\u627f\u8a8d\u8981\u6c42\u306e\u5f37\u3044\u306e\u306b\u30d1\u30d1\u306f\u305d\u3053\u306f\u8912\u3081\u3066\u304f\u308c\u306a\u3044\u306e\u3067\uff08\u3084\u308a\u305f\u3044\u304b\u3089\u3001\u3084\u3063\u3066\u3093\u3067\u3057\u3087\uff1f\u9811\u5f35\u3063\u3066\u308b\u3063\u3066\u306a\u306b\uff1f\u3068\u304b\u8a00\u308f\u308c\u308b\u304b\u3089\u8a00\u308f\u306a\u3044\u3088\u3046\u306b\u3059\u308b\uff08\u3053\u308c\u81ea\u4f53\u8d85\u30b9\u30c8\u30ec\u30b9\uff01\uff01\uff09\u4eca\u65e5\u3082\u30d4\u30a2\u30ce\u3068GO\u3060\u3051\u306f\u3084\u3063\u305f\u3088\u3002\u826f\u304f\u3084\u3063\u305f\u301c\u81ea\u5206\uff01<\/p>\n<p>\u30d4\u30a2\u30ce\u306e\u5148\u751f\u306f\u8d85\u8912\u3081\u4e0a\u624b\u3060\u3088\uff1f\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u5b09\u3057\u3044\u2192\u8912\u3081\u3089\u308c\u308b\u3057\u5b09\u3057\u3044\u2192\u307e\u305f\u9811\u5f35\u308c\u308b\u2192\u307e\u305f\u4e0a\u624b\u306b\u306a\u308b\u3002\u30cf\u30c3\u30d4\u30fc\u30b9\u30d1\u30a4\u30e9\u30eb\u3060\u3088\uff01\uff1f<\/p>\n<p>\u4e16\u306e\u4e2d\u306e\u30d1\u30d1\u3055\u3093\u9054\uff08\u5965\u3055\u3093\u3092\u597d\u304d\u306a\u3089\u3001\u3082\u3057\u304f\u306f\u7a4f\u4fbf\u306b\u5bb6\u5ead\u5186\u6e80\u306b\u3057\u305f\u3044\u306a\u3089\uff09\u5965\u3055\u3093\u3092\u3044\u3063\u3071\u3044\u8912\u3081\u307e\u3057\u3087\u3046\uff01<\/p>\n<h2>\u672c\u65e5\u306eGO<\/h2>\n<p>\u30b3\u30fc\u30c9\u66f8\u3044\u305f\u3002<\/p>\n<pre class=\"lang:go decode:true\">package main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"log\"\r\n\t\"net\/http\"\r\n\t\"strings\"\r\n)\r\n\r\nfunc myhandle(w http.ResponseWriter, r *http.Request) {\r\n\t\/\/ \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u89e3\u6790\u3059\u308b\r\n\tr.ParseForm()\r\n\t\/\/ \u89e3\u6790\u3057\u305f\u60c5\u5831\u3092\u51fa\u529b\u3059\u308b\r\n\tfmt.Println(r.Form)\r\n\tfmt.Println(\"Path\", r.URL.Path)\r\n\tfmt.Println(\"scheme\", r.URL.Scheme)\r\n\tfmt.Println(r.Form[\"url_log\"])\r\n\tfor k, v := range r.Form {\r\n\t\tfmt.Println(\"key: \", k)\r\n\t\tfmt.Println(\"val: \", strings.Join(v, \" \"))\r\n\t}\r\n\tfmt.Fprintf(w, \"Hello world!!\")\r\n\r\n\t\/\/ http:\/\/localhost:9090\/?url_long=111&amp;url_long=222 \u3067\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u308b\r\n}\r\n\r\nfunc main()  {\r\n\t\/\/ \u30a2\u30af\u30bb\u30b9\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a2d\u5b9a\r\n\thttp.HandleFunc(\"\/\", myhandle)\r\n\t\/\/ \u76e3\u8996\u30dd\u30fc\u30c8\u8a2d\u5b9a\r\n\terr := http.ListenAndServe(\":9090\", nil)\r\n\tif err != nil {\r\n\t\tlog.Fatal(\"ListenAndServer: \", err)\r\n\t}\r\n}\r\n<\/pre>\n<p>http:\/\/localhost:9090\/?url_long=111&#038;url_long=222<\/p>\n<p>\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068<\/p>\n<p>Hello world!!<\/p>\n<p>\u304c\u30d6\u30e9\u30a6\u30b6\u306b\u51fa\u3066<\/p>\n<p>\u30b3\u30f3\u30bd\u30fc\u30eb\u306f\u2193\u3053\u3061\u3089<\/p>\n<pre class=\"theme:dark-terminal lang:vim decode:true \">map[url_long:[111 222]]\r\nPath \/\r\nscheme \r\n[]\r\nkey:  url_long\r\nval:  111 222<\/pre>\n<p>GoLand\u4fbf\u5229\u3059\u304e\u308b\u3002<\/p>\n<p>GO\u53cbB\u3061\u3083\u3093\u306f\u3001VisualStudio\u3067\u3084\u3063\u3066\u308b\u3063\u3066\u8a00\u3063\u3066\u305f\u30f3\u30b4\u3002\u3067\u304d\u308b\u3093\u3060\u3002\u3069\u3063\u3061\u304c\u4fbf\u5229\u306a\u3093\u3060\u308d&#x1f914;&#x1f914;&#x1f914;<\/p>\n<h2>\u30d4\u30a2\u30ce<\/h2>\n<p>\u4eca\u65e5\u306f\u30bd\u30ed\u66f2\u3068\u30a2\u30f3\u30b5\u30f3\u30d6\u30eb\u66f2\u306e\u30ab\u30f3\u30cb\u30f3\u30b0\u30da\u30fc\u30d1\u30fc\u3092\u305b\u3063\u3066\u3068\u4f5c\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u7df4\u7fd2\u3082\u3044\u3063\u3071\u3044\u3057\u305f\uff01<\/p>\n<p>\u660e\u65e5\u3001\u30a2\u30f3\u30b5\u30f3\u30d6\u30eb\u521d\u5408\u308f\u305b\u3067\u3059\u3002\u8ff7\u60d1\u304b\u3051\u306a\u3044\u3088\u3046\u306b\u9811\u5f35\u308b\u301c<\/p>\n<p>&nbsp;<\/p>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>\u4eca\u65e5\u3001\u5e02\u306e\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u30fc\u30b9\u30da\u30fc\u30b9\u3067\u3072\u3068\u308a\u3082\u304f\u3082\u304f\u3057\u3066\u3044\u305f\u3089\u3001\u540c\u3058\u30c6\u30fc\u30d6\u30eb\u306b\u5ea7\u3063\u3066\u3044\u305f\u4eba\u304c\u3001\u30de\u30a4\u30af\u30ed\u30d3\u30c3\u30c8\u3092\u52d5\u304b\u3057\u3066\u3044\u307e\u3057\u305f\uff01\uff08\u30de\u30a4\u30af\u30ed\u30d3\u30c3\u30c8\u307f\u305f\u3044\u306a\u306e\u3063\u3066\u8a00\u3063\u3066\u305f\u304b\u306a\u30fb\u30fb\u30de\u30a4\u30af\u30ed\u30d3\u30c3\u30c8\u3068\u306a\u306b\u304c\u9055\u3046\u3093\u3060\u308d\uff09<\/p>\n<p>\u3064\u3044\u8a71\u3057\u304b\u3051\u3066\u3057\u307e\u3063\u305f\u3002twitter\u3092\u6559\u3048\u3066\u304f\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u30de\u30a4\u30af\u30ed\u30d3\u30c3\u30c8\u304b\u308f\u3044\u3044\u3088\u306d\u301c\u3002<\/p>\n<p>\u5b50\u3069\u3082\u3068\u304b\u306b\u826f\u3055\u305d\u3046\u3068\u304b\u601d\u3046\u3093\u3060\u3051\u3069\uff08\u5b50\u3069\u3082\u5411\u3051\u306e\u7d50\u69cb\u3067\u3066\u308b\u3057\uff09\u3046\u3061\u306e\u59c9\u59b9\u30ba\u606f\u5b50\u3063\u3061\u306f\u3001\u8208\u5473\u793a\u3055\u306a\u305d\u3046\u30fb\u30fb\u30fb<\/p>\n<p>\u3067\u306f\u660e\u65e5\u3082\u5f15\u304d\u7d9a\u304d\u52c9\u5b66\u306b\u52b1\u307f\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5fd9\u3057\u3044\u306e\u306b\u3088\u304f\u9811\u5f35\u3063\u3066\u3044\u307e\u3059\uff01 \u81ea\u5206\u3092\u8912\u3081\u305f\u3044\uff01\uff01 \u30d1\u30d1\u306b\u8a00\u3046\u3068\u3001\u307b\u3081\u3089\u308c\u308b\u304b\u3089\u3084\u308b\u3063\u3066\u3069\u3046\u304b\u3068\u601d\u3046\u30fb\u30fb\u3063\u3066\u3001\u3044\u3063\u3064\u3082\u8a00\u308f\u308c\u308b\u3093\u3067\u3059\u304c\u3001\u5973\u5fc3\u3092\u5168\u304f\u7406\u89e3\u3057\u3066\u3044\u307e\u305b\u3093\u306d\uff01 \u79c1\u3082\u7121\u610f\u8b58\u306b\u5b50\u3069\u3082\u306b\u30c0\u30e1\u51fa\u3057\u3057\u3061 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":3514,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[95,44],"tags":[],"class_list":["post-3693","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-golang","category-piano"],"_links":{"self":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3693"}],"collection":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3693"}],"version-history":[{"count":4,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3693\/revisions"}],"predecessor-version":[{"id":3697,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3693\/revisions\/3697"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/media\/3514"}],"wp:attachment":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}