{"id":4866,"date":"2020-07-04T20:37:33","date_gmt":"2020-07-04T11:37:33","guid":{"rendered":"https:\/\/greentown.tokyo\/?p=4866"},"modified":"2020-07-05T00:05:52","modified_gmt":"2020-07-04T15:05:52","slug":"programminglanguage-go2","status":"publish","type":"post","link":"https:\/\/greentown.tokyo\/?p=4866","title":{"rendered":"\u7b2c\uff12\u56de\u300c\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9eGo\u300d\u30aa\u30f3\u30e9\u30a4\u30f3\u8aad\u66f8\u4f1a"},"content":{"rendered":"<p>\u96e8\u3067\u3059\u306d\u3002\u4e5d\u5dde\u5730\u65b9\u306e\u304b\u305f\u5927\u4e08\u592b\u3067\u3057\u3087\u3046\u304b\u3002\u3002<\/p>\n<p>\u6628\u65e5\u3001IntelliJ IDEA\u3082\u3063\u3066\u3044\u308b\u304a\u53cb\u9054\u306b\u30ef\u30f3\u30c4\u30fc\u30de\u30f3\u3067Typescript\u306e\u30e9\u30a4\u30d6\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u3066\u3082\u3089\u3063\u305f\u3093\u3060\u3051\u3069\u3001\u30e9\u30a4\u30d6\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u7528\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3068\u304b\u3001\u65e5\u672c\u8a9e\u3092\u81ea\u52d5\u3067\u82f1\u8a9e\u306e\u5909\u6570\u306b\u5909\u63db\u3057\u3066\u304f\u308c\u308b\u30d7\u30e9\u30b0\u30a4\u30f3\u3068\u304b\u304c\u7d20\u6674\u3089\u3057\u3059\u304e\u3066\u3001GoLand\u671f\u9650\u304d\u308c\u3061\u3083\u3063\u305f\u3057\u306a\u30fc\uff08\u6700\u8fd1vs code\u3067\u66f8\u3044\u3066\u3044\u308b\uff09\u3001Flutter\u3082\u3067\u304d\u308b\u3057\u3001\u3069\u3046\u3057\u3088\u3046\u3001\u5168\u90e8\u3044\u308a\u8cb7\u3063\u3061\u3083\u304a\u3046\u304b\uff01\u3068\u3044\u3046\u6c17\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<p>\u672c\u65e5\u306f\u00a0<a href=\"https:\/\/gpl-reading.connpass.com\/event\/178951\/\">\u7b2c2\u56de\u300e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9eGo\u300f\u30aa\u30f3\u30e9\u30a4\u30f3\u8aad\u66f8\u4f1a<\/a>\u00a0\u3067\u3057\u305f\u3002<\/p>\n<ul>\n<li>\u898b\u77e5\u3063\u305f\u65b9\u304c\u4f55\u4eba\u304b&#x1f973;<\/li>\n<li>\u9069\u5f53\u3067\u3059\u304c\u3001\u30e1\u30e2\u3092\u3068\u3063\u305f\u3002<\/li>\n<\/ul>\n<p>\u6700\u521d\u306b<\/p>\n<ul>\n<li>\u81ea\u5df1\u7d39\u4ecb<\/li>\n<\/ul>\n<p>\u305d\u3057\u3066\u524d\u56de\u306e\u7d9a\u304d\u304b\u3089&#8230;\u3002\u8aad\u66f8\u4f1a\u5f8c\u306b\u81ea\u5206\u3067\u8abf\u3079\u305f\u3053\u3068\u3082\u66f8\u3044\u3066\u3042\u308b\u306e\u3067\u3001\u9593\u9055\u3063\u3066\u304b\u3044\u3066\u3042\u308b\u3068\u3053\u3042\u308a\u307e\u3057\u305f\u3089\u3054\u3081\u3093\u3055\u3044\u3002<\/p>\n<h2>\u7b2c\uff11\u7ae0\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/h2>\n<h3>1.6 URL\u304b\u3089\u306e\u4e26\u884c\u306a\u53d6\u5f97<\/h3>\n<h4>P.22\u3000gopl.io\/ch1\/server1<\/h4>\n<pre class=\"lang:go decode:true\">func main() {\r\n\thttp.HandleFunc(\"\/\", handler) \/\/ each request calls handler\r\n\tlog.Fatal(http.ListenAndServe(\"localhost:8000\", nil))\r\n}\r\n<\/pre>\n<ul>\n<li>ListenAndServe\u306f\u3001\u30a8\u30e9\u30fc\u4ee5\u5916\u8fd4\u3055\u306a\u3044\u3002<\/li>\n<li>\u306e\u3067\u3001Fatal\u306b\u3057\u3066\u308b\u3002<\/li>\n<\/ul>\n<h4>P.23\u3000gopl.io\/ch1\/server2<\/h4>\n<ul>\n<li>\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u30d6\u30e9\u30a6\u30b6\u30fc\u3067 Count 2 \u3063\u3066\u3067\u308b\u3002<\/li>\n<li>\u306a\u3093\u3067\u304b\u5206\u304b\u308b\u4eba\u30fc\uff1f<\/li>\n<\/ul>\n<pre class=\"lang:go decode:true\">func main() {\r\n\thttp.HandleFunc(\"\/\", handler)\r\n\thttp.HandleFunc(\"\/count\", counter)\r\n\tlog.Fatal(http.ListenAndServe(\"localhost:8000\", nil))\r\n}\r\nfunc handler(w http.ResponseWriter, r *http.Request) {\r\n\tmu.Lock()\r\n\tcount++\r\n\tmu.Unlock()\r\n\tfmt.Fprintf(w, \"URL.Path = %q\\n\", r.URL.Path)\r\n}\r\nfunc counter(w http.ResponseWriter, r *http.Request) {\r\n\tmu.Lock()\r\n\tfmt.Fprintf(w, \"Count %d\\n\", count)\r\n\tmu.Unlock()\r\n}\r\n<\/pre>\n<ul>\n<li>\u30d6\u30e9\u30a6\u30b6\u30fc\u306b\u3088\u3063\u3066\u3001favicon\u3092\u53d6\u308a\u306b\u884c\u304f\u306e\u304c\u3042\u308b\u3089\u3057\u3044\u3002<\/li>\n<li>\u3088\u3063\u3066\u30cf\u30f3\u30c9\u30e9\u30fc\u304c\u4f59\u5206\u306b\u547c\u3073\u51fa\u3055\u308c\u3066\u30ab\u30a6\u30f3\u30c8\u3057\u3061\u3083\u3046\u3002<\/li>\n<\/ul>\n<p>curl\u3067\u52d5\u304b\u3057\u3066\u3066\u6c17\u3065\u304b\u306a\u304b\u3063\u305f\u30fc\u3001\u3068\u30b3\u30e1\u30f3\u30c8\u3057\u3066\u3044\u308b\u4eba\u304c\u3044\u305f\u3002<\/p>\n<h3>P.27 \u578b\u5ba3\u8a00\u3068\u540d\u524d\u4ed8\u304d\u578b\u3063\u3066\u3044\u307e\u3044\u308f\u306a\u3044<\/h3>\n<ul>\n<li>defined type \u3063\u3066\u540d\u524d\u306b\u5909\u308f\u3063\u305f\u3002<\/li>\n<li>\u5b9a\u7fa9\u6e08\u306e\u578b\uff1f<\/li>\n<li>\u00a0\u30dd\u30a4\u30f3\u30bf\u3078\u306e\u6f14\u7b97\u306f\u306a\u3044\u3002<\/li>\n<\/ul>\n<h3>P.28 go doc \u306b \u30cf\u30a4\u30d5\u30f3src \u3092\u3064\u3051\u308b\u3068&#8230;<\/h3>\n<p>\u3053\u308c\u306f\u3059\u3054\u3044\u3001\u3054\u3044\u3059\u30fc<\/p>\n<pre class=\"lang:go decode:true \">&#x1f381; go doc -src http.ListenAndServe\r\npackage http \/\/ import \"net\/http\"\r\n\r\n\/\/ ListenAndServe listens on the TCP network address addr and then calls\r\n\/\/ Serve with handler to handle requests on incoming connections.\r\n\/\/ Accepted connections are configured to enable TCP keep-alives.\r\n\/\/\r\n\/\/ The handler is typically nil, in which case the DefaultServeMux is used.\r\n\/\/\r\n\/\/ ListenAndServe always returns a non-nil error.\r\nfunc ListenAndServe(addr string, handler Handler) error {\r\n\tserver := &amp;Server{Addr: addr, Handler: handler}\r\n\treturn server.ListenAndServe()\r\n}\r\n~ via C base \r\n&#x1f381;<\/pre>\n<p>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304c\u98db\u3073\u51fa\u3057\u3066\u304f\u308b&#8230;<\/p>\n<p>\u666e\u901a\u306b\u6253\u3064\u3068<\/p>\n<pre class=\"lang:go decode:true \">&#x1f381; go doc http.ListenAndServe\r\npackage http \/\/ import \"net\/http\"\r\n\r\nfunc ListenAndServe(addr string, handler Handler) error\r\n    ListenAndServe listens on the TCP network address addr and then calls Serve\r\n    with handler to handle requests on incoming connections. Accepted\r\n    connections are configured to enable TCP keep-alives.\r\n\r\n    The handler is typically nil, in which case the DefaultServeMux is used.\r\n\r\n    ListenAndServe always returns a non-nil error.\r\n\r\n~ via C base \r\n&#x1f381;<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u7b2c\uff12\u7ae0 \u30d7\u30ed\u30b0\u30e9\u30e0\u69cb\u9020<\/h2>\n<h3>int \u3068\u304b\u5909\u6570\u306b\u3067\u304d\u3061\u3083\u3046<\/h3>\n<ul>\n<li>\u3053\u308c\u306f\u3042\u304b\u3093<\/li>\n<li>int := false \u3068\u304b\u304b\u3051\u3061\u3083\u3046<\/li>\n<\/ul>\n<h3>\u53c2\u7167\u578b\u304c\u8a00\u8a9e\u4ed5\u69d8\u304b\u3089\u6d88\u3048\u305f<\/h3>\n<p>P.32<\/p>\n<p>\u300c\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3068\u53c2\u7167\u578b\uff08\u30b9\u30e9\u30a4\u30b9\u3001\u30dd\u30a4\u30f3\u30bf\u3001\u30fb\u30fb\u30fb\u300d\u3068\u3044\u3046\u8a18\u8ff0\u304c\u3042\u308b\u304c\u3001\u8a00\u8a9e\u4ed5\u69d8\u304c\u304b\u308f\u308a\u3001<span style=\"color: #ff00ff;\"><strong>\u53c2\u7167\u578b\u3068\u3044\u3046\u8868\u73fe\u306f\u306a\u304f\u306a\u3063\u305f<\/strong><\/span>\u3002<\/p>\n<p>go has no \u2019reference types\u2019<\/p>\n<ul>\n<li>2013\u5e74\u306b reference types \u304c\u8a00\u8a9e\u4ed5\u69d8\u304b\u3089\u6d88\u3048\u3066\u3044\u308b\u3002<\/li>\n<li>\u3058\u3083\u3042\u3001\u4eca\u306f\u306a\u3093\u3066\u3044\u3046\u306e\u3060\u308d\u3002<\/li>\n<\/ul>\n<p>make\u3067\u3064\u304f\u308b\u3082\u306e<\/p>\n<ul>\n<li>map<\/li>\n<li>slice<\/li>\n<li>\u30c1\u30e3\u30cd\u30eb<\/li>\n<\/ul>\n<p>meke\u3067\u4f5c\u308c\u308b\u3082\u306e\u304c\u53c2\u7167\u578b\u3063\u3066\u611f\u3058\u3060\u3063\u305f\u3093\u3060\u3051\u3069\u3001\u3068\u304b\u304a\u3063\u3057\u3083\u3089\u308c\u3066\u3044\u305f\u304b\u306a\u3002<\/p>\n<p>\u30c1\u30e3\u30cd\u30eb\u306f\u3001\u30c7\u30fc\u30bf\u304c\u7a7a\u306b\u306a\u3063\u305f\u6642\u70b9\u3067false\u306b\u306a\u308b\u306e\u3002\u30c1\u30e3\u30cd\u30eb\u306e\u8a71\u306f\u3075\u3093\u3075\u3093\u805e\u3044\u3066\u3044\u305f\u3051\u3069\u3001\u3088\u304f\u308f\u304b\u3089\u306a\u304b\u3063\u305f\u30fc\u3002<\/p>\n<p>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/p>\n<pre class=\"lang:go decode:true\">var b, f, s = true, 2.3, \"four\"\r\n<\/pre>\n<ul>\n<li>\u2191\u3053\u3046\u3044\u3046\u5ba3\u8a00\u306f\u666e\u901a\u3084\u3089\u306a\u3044<\/li>\n<li>\u578b\u304c\u305d\u308d\u3063\u3066\u3044\u306a\u3044\u304b\u3089\uff01<\/li>\n<\/ul>\n<h3>\u00a0:= \u3063\u3066\u5ba3\u8a00\u306a\u3093\u3060\u3088\u30fc<\/h3>\n<p>\u5ba3\u8a00\u3082\u3067\u304d\u3061\u3083\u3046\u4ee3\u5165\u3060\u3068\u601d\u3063\u3066\u3044\u305f\u3051\u3069\u3001\u672c\u306b\u306f\u300c:= \u5ba3\u8a00\u3067\u3042\u308a\u301c\u300d\u3063\u3066\u304b\u3044\u3066\u3042\u308b\u3002<\/p>\n<p>\u30ec\u30ad\u30b7\u30ab\u30eb\u30d6\u30ed\u30af\uff08\u5f8c\u8ff0\uff09\u5185<\/p>\n<pre class=\"lang:go decode:true \">in, err := os.Open(infile)\r\nout, err := osCreate(outfile)<\/pre>\n<p>\u21912\u884c\u76ee\u3002 out\u306f\u65b0\u3057\u304f\u5ba3\u8a00\u3055\u308c\u3066\u3044\u308b\u304b\u3089\u3001:= \u00a0\u3092\u4f7f\u3063\u3066\u3082\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044\u3002<\/p>\n<pre class=\"lang:go decode:true \">f, err := os.Open(infile)\r\nf, err := os.Create(outfile) \/\/ \u30a8\u30e9\u30fc<\/pre>\n<p>\u21912\u884c\u76ee\u306ef\u306f\u30011\u884c\u76ee\u306e := \u3067\u5ba3\u8a00\u3055\u308c\u3066\u3044\u308b\u304b\u3089\u30012\u884c\u76ee\u306ef\u3092 := \u3067\u5ba3\u8a00\u3059\u308b\u3068\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3002<\/p>\n<p>\u3068\u3066\u3082\u4e01\u5be7\u306b\u89e3\u8aac\u3044\u305f\u3060\u3044\u3066\u3001\u307c\u3093\u3084\u308a\u66f8\u3044\u3066\u3044\u305f\u3068\u3053\u308d\uff08\u305f\u307e\u306b\u30a8\u30e9\u308b\uff09\u304c\u3059\u3063\u304d\u308a&#x1f34e;\u3001\u89e3\u6c7a\u3002<\/p>\n<h3>\u30b9\u30bf\u30c3\u30af<\/h3>\n<ul>\n<li>\u30b3\u30f3\u30d1\u30a4\u30e9\u3084OS\u304c\u81ea\u52d5\u3067\u30e1\u30e2\u30ea\u5272\u308a\u5f53\u3066\u3084\u89e3\u653e\u306a\u3069\u3001\u304a\u305b\u308f\u3057\u3066\u304f\u308c\u308b\u9818\u57df<\/li>\n<li>\u30b3\u30f3\u30d1\u30a4\u30eb\u3084\u30ea\u30f3\u30ab\u30fc\u304c\u8d70\u3063\u305f\u6642\u70b9\u3067\u30b5\u30a4\u30ba\u304c\u6c7a\u307e\u308b<\/li>\n<\/ul>\n<h3>\u30d2\u30fc\u30d7<\/h3>\n<ul>\n<li>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u304c\u30e1\u30e2\u30ea\u304c\u5fc5\u8981\u306b\u306a\u3063\u305f\u3068\u304d\u306b\u4f7f\u3046\u9818\u57df<\/li>\n<li>\u3044\u3089\u306a\u304f\u306a\u3063\u305f\u3089\u89e3\u653e\u3059\u308b<\/li>\n<li>\u81ea\u524d\u3067\u3084\u308b\u5fc5\u8981\u304c\u3042\u308b<\/li>\n<\/ul>\n<h3>P.35 \u30ed\u30fc\u30ab\u30eb\u5909\u6570\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u8fd4\u3059\u3068\u304d<\/h3>\n<p>\u3053\u3093\u306a\u30b3\u30fc\u30c9<\/p>\n<pre class=\"lang:default decode:true \">var p = f()\r\n\r\nfunc f() *int {\r\n    v := 1\r\n    return &amp;v\r\n}<\/pre>\n<ul>\n<li>\u30ed\u30fc\u30ab\u30eb\u304c\u5909\u6570\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u8fd4\u3059\u95a2\u6570<\/li>\n<li>\u5b89\u5168\u3089\u3057\u3044<\/li>\n<li>\u30dd\u30a4\u30f3\u30bfp\u306f\u30ed\u30fc\u30ab\u30eb\u5909\u6570\u3092\u305a\u3063\u3068\u6307\u3059<\/li>\n<\/ul>\n<p>\u9055\u548c\u611f\u3002Go\u306fOK\u3089\u3057\u3044\u3002<\/p>\n<ul>\n<li>f \u547c\u3073\u51fa\u3059\u3054\u3068\u306b\u3001\u5225\u306e\u5024\u304c\u8fd4\u3055\u308c\u308b<\/li>\n<li>\u30ed\u30fc\u30ab\u30eb\u95a2\u6570\u304c\u5909\u6570\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u8fd4\u3059\u3068\u304d\u306f\u3001\u30b9\u30bf\u30c3\u30af\u306b\u3068\u3089\u305a\u3001\u30d2\u30fc\u30d7\u306b\u3068\u308b\uff08Java\u306f\u30b9\u30bf\u30c3\u30af\u306b\u3068\u308b\uff09<\/li>\n<\/ul>\n<p>\u6642\u9593\u3042\u3063\u305f\u3089\u8aad\u3093\u3067\u307f\u305f\u3044\u3000<a href=\"https:\/\/segment.com\/blog\/allocation-efficiency-in-high-performance-go-services\/\">https:\/\/segment.com\/blog\/allocation-efficiency-in-high-performance-go-services\/<\/a><\/p>\n<h3>P.37 new<\/h3>\n<ul>\n<li>\u3042\u307e\u308a\u4f7f\u308f\u306a\u3044\u3002<\/li>\n<li>\u7121\u5f62\u95a2\u6570\u306f\u69cb\u9020\u4f53\u3092\u3088\u304f\u4f7f\u3046\u304b\u3089\u3002<\/li>\n<li>\u69cb\u9020\u4f53\u30ea\u30c6\u30e9\u30eb\u69cb\u6587\u306e\u304c\u67d4\u8edf\u3060\u304b\u3089\u3002<\/li>\n<\/ul>\n<h3>P.38 \u5909\u6570\u306e\u751f\u5b58\u671f\u9593<\/h3>\n<p>\u3053\u306e\u30b3\u30fc\u30c9<\/p>\n<pre class=\"lang:go decode:true\">for t := 0.0; t &lt; cycles*2*math.Pi; t += res {\r\n    x := math.Sin(t)\r\n    y := math.Sin(t*freq + phase)\r\n\u3000\uff1a\r\n\u3000\uff1a\r\n}<\/pre>\n<ul>\n<li>\u5909\u6570 t\u306f\u3001for\u304c\u958b\u59cb\u3059\u308b\u3054\u3068\u306b\u751f\u6210\u3055\u308c\u308b\u3002<\/li>\n<li>x\u3001y\u306f\u30eb\u30fc\u30d7\u304c\u7e70\u308a\u8fd4\u3055\u308c\u308b\u305f\u3073\u306b\u751f\u6210\u3055\u308c\u308b\u3002<\/li>\n<li>GC\u306f\u30dd\u30a4\u30f3\u30bf\u3068\u4ed6\u306e\u7a2e\u985e\u306e\u53c2\u7167\u3092\u305f\u3069\u308b\u3053\u3068\u3067\u3001\u5bfe\u8c61\u3068\u306a\u308b\u5909\u6570\u3078\u5230\u9054\u3057\u3001\u30e1\u30e2\u30ea\u9818\u57df\u3092\u56de\u53ce\u3059\u308b\u3002<\/li>\n<li>\u30ed\u30fc\u30ab\u30eb\u5909\u6570\u306f\u5b58\u5728\u3057\u3066\u3044\u308c\u3070\u30eb\u30fc\u30c8\u306b\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u3002<\/li>\n<\/ul>\n<p>\u3046\u30fc\u3093\u3001\u306a\u308b\u307b\u3069\u308f\u304b\u3089\u3093\u3002<\/p>\n<ul>\n<li>\u30b3\u30f3\u30d1\u30a4\u30e9\u306f\u30ed\u30fc\u30ab\u30eb\u5909\u6570\u3092\u30b9\u30bf\u30c3\u30af\u304b\u30d2\u30fc\u30d7\u3069\u3061\u3089\u304b\u306b\u751f\u6210\u3059\u308b\u304b\u9078\u629e\u3067\u304d\u308b\u3002<\/li>\n<li>\u9078\u629e\u306f\u3001var\u3068\u304bnew\u306b\u3088\u3063\u3066\u6c7a\u307e\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u3002<\/li>\n<\/ul>\n<h3>P.40 \u4ee3\u5165<\/h3>\n<p>\u3053\u3093\u306a\u30b3\u30fc\u30c9<\/p>\n<pre class=\"lang:go decode:true \">count[x] *= scale<\/pre>\n<ul>\n<li>Go\u306e\u5834\u5408\u540c\u3058\u578b\u3058\u3083\u306a\u3044\u3068NG<\/li>\n<li>Java\u306e\u5834\u5408\u306f\u62e1\u5f35\u3055\u308c\u308b\uff08\u30ad\u30e3\u30b9\u30c8\u3057\u3061\u3083\u3046\uff09<\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">v++\r\nv--<\/pre>\n<ul>\n<li>\u5f0f\u3067\u306f\u306a\u3044\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>P. 47 \u30a4\u30f3\u30dd\u30fc\u30c8<\/h3>\n<pre class=\"lang:go decode:true \">import (\r\n  \"gopl.io\/ch2\/tempconv\"\r\n)<\/pre>\n<ul>\n<li>tempconv \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u3042\u3089\u308f\u3057\u3066\u3044\u308b\u3002<\/li>\n<li>\u3067\u3001\u305d\u306e\u4e0b\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u3042\u308b\u3068\u3046\u6163\u7fd2\u3002<\/li>\n<\/ul>\n<h3>P.49 \u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u521d\u671f\u5316<\/h3>\n<pre class=\"lang:go decode:true \">func init() { \/* --- *\/ }<\/pre>\n<ul>\n<li>init\u306f\u547c\u3073\u51fa\u3059\u3053\u3068\u3082\u53c2\u7167\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u306a\u3044\u3002\u305d\u308c\u4ee5\u5916\u306f\u666e\u901a\u306e\u95a2\u6570\u3002<\/li>\n<li>\uff11\u3064\u306e\u30bd\u30fc\u30b9\u306binit\u4f55\u500b\u66f8\u3044\u3066\u3082\u826f\u3044\u3002<\/li>\n<li>\u5ba3\u8a00\u3055\u308c\u3066\u3044\u308b\u9806\u306b\u5b9f\u884c\u3055\u308c\u308b\u3002<\/li>\n<li>\u521d\u671f\u5316\u306f\u4e0b\u4f4d\u304b\u3089\u4e0a\u4f4d\u3078\u304a\u3053\u306a\u308f\u308c\u308b\u3001\u3059\u306a\u308f\u3061main\u304c\u6700\u5f8c\u306b\u521d\u671f\u5316\u3055\u308c\u308b\u3002<\/li>\n<\/ul>\n<h3>\u30ec\u30ad\u30b7\u30ab\u30eb\u30d6\u30ed\u30c3\u30af\u30fb\u30ec\u30ad\u30b7\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7<\/h3>\n<ul>\n<li>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3067\u660e\u793a\u7684\u306b\u6ce2\u62ec\u5f27\u3067\u56f2\u307e\u308c\u3066\u3044\u306a\u3044\u5ba3\u8a00\u306e\u30b0\u30eb\u30fc\u30d7\u5316\u3082\u3053\u306e\u6982\u5ff5\u306b\u542b\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/li>\n<li>for, if, switch, switch\u306e\u306a\u304b\u306ecase\u305d\u308c\u305e\u308c\u306b\u30ec\u30ad\u30b7\u30ab\u30eb\u30d6\u30ed\u30c3\u30af\u304c\u5b58\u5728\u3059\u308b\u3002<\/li>\n<\/ul>\n<h3>\u30e6\u30cb\u30d0\u30fc\u30b5\u30eb\u30d6\u30ed\u30c3\u30af<\/h3>\n<ul>\n<li>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3001\u30d1\u30c3\u30b1\u30fc\u30b8<\/li>\n<\/ul>\n<h3>\u30b9\u30b3\u30fc\u30d7<\/h3>\n<p>\u3053\u3093\u306a\u30b1\u30fc\u30b9<\/p>\n<pre class=\"lang:go decode:true \">for i := 0; i &lt; len(x); i++ {\r\n    x := x[i]\r\n    if x != '!' { \r\n        x := x + 'A' - 'a'\r\n        :\r\n        :\r\n    }\r\n}<\/pre>\n<ul>\n<li>\uff13\u884c\u76ee\u306ex\u306f\uff12\u884c\u76ee\u306eX\u3092\u307f\u3066\u3066<\/li>\n<li>\uff14\u884c\u76ee\u306ex\u306f\u65b0\u3057\u3044x<\/li>\n<\/ul>\n<p>\u6b21<\/p>\n<pre class=\"lang:default decode:true\">if x := f(); x == 0 {\r\n    :\r\n} else if y := g(x); x == y {\r\n    :\r\n} else {\r\n    :\r\n}\u3000\u2190\u3000\u6700\u5f8c\u307e\u3067x\u306f\u751f\u304d\u3066\u308b\u3002\u629c\u3051\u308b\u3068\u6d88\u6ec5\u3002\r\n\r\nf.Start() \u2190f\u306f\u672a\u5b9a\u7fa9\u306e\u305f\u3081\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\r\nf.Close() \u2190\u30a8\u30e9\u30fc<\/pre>\n<p>\u3067\u3082f\u4f7f\u3044\u305f\u3044\u306a\u30fc\u3063\u3066\u3068\u304d<\/p>\n<pre class=\"lang:go decode:true\">if x := f(); x == 0 {\r\n    :\r\n} else if y := g(x); x == y {\r\n    :\r\n} else {\r\n    f.Stert()\u3000\u2190\u3000\u306a\u304b\u306b\u3044\u308c\u3061\u3083\u3046\u3002\r\n    f.Close()\r\n}<\/pre>\n<p>\u30b0\u30ed\u30fc\u30d0\u30eb\u3067\u5ba3\u8a00\u3059\u308b\u30d1\u30bf\u30fc\u30f3<\/p>\n<pre class=\"lang:go decode:true \">var cwd string\r\n\r\nfunc init() {\r\n    cwd, err := os.Getwd() \/\/ \u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\r\n    if err != nil{\r\n        log.Fatalf(\"err %v\", err)\r\n    }\r\n}<\/pre>\n<ul>\n<li>\u30b0\u30ed\u30fc\u30d0\u30eb\u3067cwd \u304c\u5ba3\u8a00\u3055\u308c\u3066\u3044\u308b\u3051\u3069<\/li>\n<li>cwd err := os.Getwd()\u306e\u7b87\u6240<\/li>\n<li>cwd\u306f\u65b0\u3057\u304f\u5ba3\u8a00\u3055\u308c\u305f\u3002\u4f7f\u308f\u308c\u3066\u3044\u306a\u3044\u304b\u3089\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3002<\/li>\n<\/ul>\n<p>\u3053\u3061\u3089\u306e\u30d1\u30bf\u30fc\u30f3<\/p>\n<pre class=\"lang:default decode:true\">var cwd string \/\/ \u521d\u671f\u5316\u3055\u308c\u306a\u3044\r\n\r\nfunc init() {\r\n    cwd, err := os.Getwd()\r\n    if err != nil{\r\n        log.Fatalf(\"err %v\", err)\r\n    }\r\n    log.Printf(\"hoge %s\", cwd) \/\/ \u4f7f\u308f\u308c\u308b\u306e\u3067\u3001\u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044\r\n}<\/pre>\n<ul>\n<li>log.Printf(&#8220;hoge %s&#8221;, cwd)\u3000\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u304b\u3089\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044\u3002<\/li>\n<li>\u3067\u3082\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u304c\u521d\u671f\u5316\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u30d0\u30b0\u3068\u306a\u308b<\/li>\n<\/ul>\n<p>:=\u3092\u4f7f\u308f\u306a\u3051\u308c\u3070\u826f\u3044\u3002<\/p>\n<pre class=\"lang:go decode:true \">var cwd string\r\n\r\nfunc init() {\r\n    var err error\r\n    cwd, err = os.Getwd()\r\n    if err != nil{\r\n        log.Fatalf(\"err %v\", err)\r\n    }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u305d\u306e\u307b\u304b<\/h3>\n<p>\u30d6\u30ed\u30b0\u304b\u304f\u306e\u306b\u529b\u5c3d\u304d\u305f\u306e\u3067\u7c21\u5358\u306b<\/p>\n<h4>alias declarations<\/h4>\n<ul>\n<li>\u65b0\u3057\u3044\u8a00\u8a9e\u4ed5\u69d8\u3001Polar = polar \u3069\u3061\u3089\u3082\u540c\u3058\u3067\u3059\u3088\u3068\u5ba3\u8a00\u3067\u304d\u308b<\/li>\n<li>\u65b0\u898f\u3067\u30b3\u30fc\u30c9\u66f8\u304f\u3068\u304d\u306b\u306f\u4f7f\u308f\u306a\u3044\u3051\u3069\u3001\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u306a\u3069\u306b\u4f7f\u3063\u305f\u308a\u3059\u308b\u3002<\/li>\n<li>\u307b\u304b\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u3082\u3046\u4e00\u5ea6\u5ba3\u8a00\u3057\u305f\u3044\u3068\u304d\u306b\u4f7f\u3046\u3053\u3068\u304c\u3042\u308b\u3002<\/li>\n<li>\u540c\u3058polar\u3068\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092Polar\u3068\u3044\u3046\u578b\u3092\u3082\u3046\u3044\u3061\u3069\u5ba3\u8a00\u3059\u308b\uff08\u5168\u304f\u540c\u3058\u65b9\u3092\u5ba3\u8a00\u3067\u304d\u308b\uff09Go\u306e1.9<\/li>\n<li>\u666e\u6bb5\u3064\u304b\u308f\u306a\u3044\u3051\u3069\u3001type aleas \u3067\u4f7f\u304a\u3046\u3063\u3066\u3068\u304d\u304c\u3042\u308b\u3002<\/li>\n<li>\u5faa\u74b0\u53c2\u7167\u306b\u306a\u3063\u3061\u3083\u3046\u3068\u304d\u306b\u5b9a\u7fa9\u3057\u306a\u304a\u3057\u305f\u308a\u3059\u308b\u3002<\/li>\n<\/ul>\n<h4>Go\u3067\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u66f8\u304f\u3068\u304d\u306e\u6ce8\u610f\u70b9<\/h4>\n<ul>\n<li>\u30b3\u30f3\u30d1\u30a4\u30e9\u30fc\u304c\u95a2\u6570\u547c\u3073\u51fa\u3057\u3092\u6d88\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u3001\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u304c\u6b63\u78ba\u306b\u51fa\u305b\u306a\u3044\u3053\u3068\u304c\u3042\u308b\u3002<\/li>\n<li>\u7121\u99c4\u306a\u8a08\u7b97\u3092\u3057\u306a\u3044\u3088\u3046\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u6700\u9069\u5316\u3055\u308c\u3066\u3057\u307e\u3046\u3002<\/li>\n<li>\u8a00\u8a9e\u4ed5\u69d8\u306b\u3088\u3063\u3066\u306fCPU\u306b\u8a72\u5f53\u3059\u308b\u547d\u4ee4\u304c\u3042\u308c\u3070\u3001\u305d\u3063\u3061\u4f7f\u3063\u3061\u3083\u3063\u305f\u308a\u3059\u308b\u304b\u3089\uff08Java\u306b\u3082\u3042\u308b\uff09<\/li>\n<\/ul>\n<p>\u3061\u3083\u3093\u3068\u52d5\u304f\u3088\u3046\u306b\u3059\u308b\u306b\u306f<\/p>\n<ul>\n<li>\u30ed\u30fc\u30ab\u30eb\u5909\u6570\u306b\u3061\u3083\u3093\u3068\u306b\u4fdd\u5b58<\/li>\n<li>\u30b0\u30eb\u30fc\u30d0\u30eb\u306a\u5909\u6570\u306b\u4fdd\u5b58\u3059\u308b<\/li>\n<li>\u95a2\u6570\u5185\u306b\u30ea\u30c6\u30e9\u30eb\u3092\u66f8\u304b\u306a\u3044<\/li>\n<li>bits\u30d1\u30c3\u30b1\u30fc\u30b8\uff1f\u3002\u6700\u9069\u5316\u3092\u3055\u3051\u308b\u305f\u3081\u306e\u30b3\u30fc\u30c9\u304c\u66f8\u304b\u308c\u3066\u3044\u308b\uff08\u306e\u3067\u307f\u3066\u307f\u308b\u3068\u3044\u3044\u304b\u3082\uff1f\uff1f\uff1f\uff09<\/li>\n<\/ul>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<ul>\n<li>\u8aad\u66f8\u4f1a\u304a\u308f\u3063\u3066\u304b\u3089\u3053\u306e\u8a18\u4e8b\u304b\u3044\u305f\u30023\u6642\u9593\u304b\u304b\u3063\u305f\u3002\u3061\u3087\u3063\u3068\u899a\u609f\u3057\u3066\u305f\u3051\u3069\u3001\u3042\u3068\u56de\u3057\u306b\u3059\u308b\u3068\u3084\u3089\u306a\u305d\u3046\u3060\u304b\u3089\u3002<\/li>\n<li>\u8aad\u66f8\u4f1a\u306a\u304b\u306a\u304b\u6fc3\u304b\u3063\u305f\u3002\u3059\u3070\u3089\u3057\u3044\u3002<\/li>\n<li>\u4e88\u7fd2\u305b\u305a\u306b\u53c2\u52a0\u3057\u3066\u3057\u307e\u3063\u305f\u3002\u6b21\u306f\u7df4\u7fd2\u554f\u984c\u8efd\u304f\u89e3\u3044\u3066\u304b\u3089\u53c2\u52a0\u3057\u305f\u3044\u306a\u30fc\u3002<\/li>\n<li>\u3044\u3063\u3057\u3087\u306b\u53c2\u52a0\u3057\u305f\u3001\u307f\u3063\u3061\u30fc\u3055\u3093\u3001\u30e1\u30e2\u5171\u6709\u3057\u3066\u304f\u308c\u305f\u3002\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u3046\u308c\u3057\u3044\u3002<\/li>\n<li>13\u301c17\u6642\u307e\u306710\u5206\u4f11\u61a9\u30922\u56de\u304f\u3089\u3044\u306f\u3055\u307f\u306a\u304c\u3089\u306e\u9577\u4e01\u5834\u3002\u524d\u56de\u3088\u308a\u3057\u3093\u3069\u304f\u306a\u304b\u3063\u305f\u3002\u30d6\u30ed\u30b0\u5165\u308c\u308b\u3068\uff18\u6642\u9593\u30fb\u30fb\u3057\u306c\u30fb\u30fb<\/li>\n<li>\u3067\u3082\u697d\u3057\u304b\u3063\u305f\u30fc &#x1f970;\uff73\uff8c\uff8c-<\/li>\n<\/ul>\n<p>\u67f4\u7530\u3055\u3093\u3061\u3087\u3063\u3068\u524d\u306b\u6551\u6025\u8eca\u306b\u904b\u3070\u308c\u305f\u3068\u304b\u3067\u5fc3\u914d\u3057\u307e\u3057\u305f\u304c\u3001\u672c\u65e5\u306f\u304a\u59ff\u304c\u307f\u308c\u3066\u5b89\u5fc3\u3057\u307e\u3057\u305f\u3002\u304a\u5927\u4e8b\u306b\u306a\u3055\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u96e8\u3067\u3059\u306d\u3002\u4e5d\u5dde\u5730\u65b9\u306e\u304b\u305f\u5927\u4e08\u592b\u3067\u3057\u3087\u3046\u304b\u3002\u3002 \u6628\u65e5\u3001IntelliJ IDEA\u3082\u3063\u3066\u3044\u308b\u304a\u53cb\u9054\u306b\u30ef\u30f3\u30c4\u30fc\u30de\u30f3\u3067Typescript\u306e\u30e9\u30a4\u30d6\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u3066\u3082\u3089\u3063\u305f\u3093\u3060\u3051\u3069\u3001\u30e9\u30a4\u30d6\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u7528\u306e\u30d7\u30e9\u30b0 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":4842,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[95],"tags":[],"class_list":["post-4866","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-golang"],"_links":{"self":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/4866"}],"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=4866"}],"version-history":[{"count":11,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/4866\/revisions"}],"predecessor-version":[{"id":4880,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/4866\/revisions\/4880"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/media\/4842"}],"wp:attachment":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}