{"id":10904,"date":"2025-09-13T14:41:51","date_gmt":"2025-09-13T05:41:51","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=10904"},"modified":"2025-10-17T12:07:56","modified_gmt":"2025-10-17T03:07:56","slug":"c-%ea%b0%9c%eb%b0%9c%ec%9e%90%eb%a5%bc-%ec%9c%84%ed%95%9c-go-%ec%96%b8%ec%96%b4-%ea%b0%95%ec%a2%8c","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=10904","title":{"rendered":"C \uac1c\ubc1c\uc790\ub97c \uc704\ud55c Go \uc5b8\uc5b4 \uac15\uc88c"},"content":{"rendered":"<h1>C \uac1c\ubc1c\uc790\ub97c \uc704\ud55c Go \uc5b8\uc5b4 \uac15\uc88c<\/h1>\n<h2>1\ubd80: \uc2dc\uc791\ud558\uae30<\/h2>\n<h3>1\uc7a5. Go \uc5b8\uc5b4 \uc18c\uac1c<\/h3>\n<h4>C\uc640 Go\uc758 \ucca0\ud559\uc801 \ucc28\uc774<\/h4>\n<p><strong>C\uc758 \ucca0\ud559:<\/strong><\/p>\n<ul>\n<li>\ud504\ub85c\uadf8\ub798\uba38\uc5d0\uac8c \ucd5c\ub300\ud55c\uc758 \uc81c\uc5b4\uad8c\uc744 \uc900\ub2e4<\/li>\n<li>\ud558\ub4dc\uc6e8\uc5b4\uc5d0 \uac00\uae5d\uac8c, \ucd5c\uc18c\ud55c\uc758 \ucd94\uc0c1\ud654<\/li>\n<li>&quot;\ud504\ub85c\uadf8\ub798\uba38\uac00 \ubb34\uc5c7\uc744 \ud558\ub294\uc9c0 \uc548\ub2e4&quot;\uace0 \uac00\uc815<\/li>\n<li>\uc791\uace0 \ub2e8\uc21c\ud55c \uc5b8\uc5b4<\/li>\n<\/ul>\n<p><strong>Go\uc758 \ucca0\ud559:<\/strong><\/p>\n<ul>\n<li>\ub2e8\uc21c\uc131\uacfc \uac00\ub3c5\uc131\uc744 \ucd5c\uc6b0\uc120\uc73c\ub85c<\/li>\n<li>\ud55c \uac00\uc9c0 \uc77c\uc744 \ud558\ub294 \ud55c \uac00\uc9c0 \ubc29\ubc95<\/li>\n<li>\uba85\ud655\ud568\uc774 \uc601\ub9ac\ud568\ubcf4\ub2e4 \ub0ab\ub2e4<\/li>\n<li>\ud300 \ud611\uc5c5\uacfc \ub300\uaddc\ubaa8 \uc18c\ud504\ud2b8\uc6e8\uc5b4\uc5d0 \ucd5c\uc801\ud654<\/li>\n<li>\ub0b4\uc7a5\ub41c \ub3d9\uc2dc\uc131 \uc9c0\uc6d0<\/li>\n<\/ul>\n<p>Go\ub294 C\uc758 \ub2e8\uc21c\uc131\uc744 \uacc4\uc2b9\ud558\uba74\uc11c\ub3c4, \ud604\ub300\uc801\uc778 \uc18c\ud504\ud2b8\uc6e8\uc5b4 \uac1c\ubc1c\uc758 \uc694\uad6c\uc0ac\ud56d\uc744 \ubc18\uc601\ud588\uc2b5\ub2c8\ub2e4.<\/p>\n<h4>Go\uc758 \uc8fc\uc694 \ud2b9\uc9d5\uacfc \uc7a5\uc810<\/h4>\n<p><strong>C \uac1c\ubc1c\uc790 \uad00\uc810\uc5d0\uc11c \ubcf8 Go\uc758 \ud2b9\uc9d5:<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\ube60\ub978 \ucef4\ud30c\uc77c<\/strong><\/p>\n<ul>\n<li>C\ubcf4\ub2e4 \ud6e8\uc52c \ube60\ub978 \ucef4\ud30c\uc77c \uc18d\ub3c4<\/li>\n<li>\uc758\uc874\uc131 \uad00\ub9ac\uac00 \uba85\ud655\ud574\uc11c \ubd88\ud544\uc694\ud55c \uc7ac\ucef4\ud30c\uc77c \uc5c6\uc74c<\/li>\n<li>\ub300\uaddc\ubaa8 \ud504\ub85c\uc81d\ud2b8\ub3c4 \uba87 \ucd08 \uc548\uc5d0 \ube4c\ub4dc<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\uac00\ube44\uc9c0 \uceec\ub809\uc158<\/strong><\/p>\n<ul>\n<li>malloc\/free \ubd88\ud544\uc694<\/li>\n<li>\uba54\ubaa8\ub9ac \ub204\uc218\uc640 \uc774\uc911 \ud574\uc81c \uac71\uc815 \uc5c6\uc74c<\/li>\n<li>\ud558\uc9c0\ub9cc C\ub9cc\ud07c\uc758 \uc138\ubc00\ud55c \uc81c\uc5b4\ub294 \ud3ec\uae30<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\ub0b4\uc7a5 \ub3d9\uc2dc\uc131<\/strong><\/p>\n<ul>\n<li>\uace0\ub8e8\ud2f4: \uacbd\ub7c9 \uc2a4\ub808\ub4dc (\uc2a4\ud0dd \ud06c\uae30 ~2KB)<\/li>\n<li>\ucc44\ub110: \uc548\uc804\ud55c \ud1b5\uc2e0 \uba54\ucee4\ub2c8\uc998<\/li>\n<li>pthread\ubcf4\ub2e4 \ud6e8\uc52c \uc0ac\uc6a9\ud558\uae30 \uc26c\uc6c0<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\uc815\uc801 \ud0c0\uc785 + \ud0c0\uc785 \ucd94\ub860<\/strong><\/p>\n<ul>\n<li>C\ucc98\ub7fc \uc815\uc801 \ud0c0\uc785\uc758 \uc548\uc815\uc131<\/li>\n<li>\ud0c0\uc785 \ucd94\ub860\uc73c\ub85c \uac04\uacb0\ud55c \ucf54\ub4dc<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\ud45c\uc900 \ub77c\uc774\ube0c\ub7ec\ub9ac<\/strong><\/p>\n<ul>\n<li>HTTP \uc11c\ubc84, JSON \ud30c\uc2f1, \uc554\ud638\ud654 \ub4f1 \ub0b4\uc7a5<\/li>\n<li>C\ub294 \uc678\ubd80 \ub77c\uc774\ube0c\ub7ec\ub9ac \ud544\uc694\ud55c \uac83\ub4e4<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\ub2e8\uc77c \ubc14\uc774\ub108\ub9ac \ubc30\ud3ec<\/strong><\/p>\n<ul>\n<li>\uc815\uc801 \ub9c1\ud06c\uac00 \uae30\ubcf8<\/li>\n<li>\uc758\uc874\uc131 \uc9c0\uc625 \uc5c6\uc74c<\/li>\n<li>\ud06c\ub85c\uc2a4 \ucef4\ud30c\uc77c \uac04\ud3b8<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>\ud3ec\uae30\ud574\uc57c \ud558\ub294 \uac83\ub4e4:<\/strong><\/p>\n<ul>\n<li>\ub9e4\ud06c\ub85c (#define)<\/li>\n<li>\ud3ec\uc778\ud130 \uc0b0\uc220 \uc5f0\uc0b0<\/li>\n<li>\uc218\ub3d9 \uba54\ubaa8\ub9ac \uad00\ub9ac\uc758 \uc644\uc804\ud55c \uc81c\uc5b4<\/li>\n<li>\ud5e4\ub354 \ud30c\uc77c<\/li>\n<li>\uc804\ucc98\ub9ac\uae30<\/li>\n<\/ul>\n<h4>\uac1c\ubc1c \ud658\uacbd \uc124\uc815<\/h4>\n<p><strong>1. Go \uc124\uce58<\/strong><\/p>\n<p><strong>Linux\/macOS:<\/strong><\/p>\n<pre><code class=\"language-bash\"># \uacf5\uc2dd \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub2e4\uc6b4\ub85c\ub4dc\nwget https:\/\/go.dev\/dl\/go1.25.3.linux-amd64.tar.gz\nsudo tar -C \/usr\/local -xzf go1.25.3.linux-amd64.tar.gz\n\n# PATH \uc124\uc815 (~\/.bashrc \ub610\ub294 ~\/.zshrc\uc5d0 \ucd94\uac00)\nexport PATH=$PATH:\/usr\/local\/go\/bin\nexport GOPATH=$HOME\/go\nexport PATH=$PATH:$GOPATH\/bin<\/code><\/pre>\n<p><strong>Windows<\/strong><\/p>\n<p>\uac00\ub2a5\ud558\uae30\ub294 \ud558\uc9c0\ub9cc \ub9e4\uc6b0 \ubd88\ud3b8\ud558\ub2e4.<\/p>\n<p><a href=\"https:\/\/go.dev\/\">https:\/\/go.dev\/<\/a> \uc5d0\uc11c \ub2e4\uc6b4\ub85c\ub4dc<\/p>\n<p><a href=\"https:\/\/learn.microsoft.com\/ko-kr\/azure\/developer\/go\/configure-visual-studio-code\">\ucd94\uac00\uc124\uc815<\/a><\/p>\n<p>cgo \ub97c \uc704\ud55c gcc \uc124\uce58<\/p>\n<p><a href=\"https:\/\/winlibs.com\/\">https:\/\/winlibs.com\/<\/a> \uc5d0\uc11c UCRT runtime \uc911 \ucd5c\uc2e0\ubc84\uc804\uc744 \ub2e4\uc6b4\ubc1b\uc544 \uc801\ub2f9\ud55c \ud3f4\ub354\uc5d0 \uc555\ucd95\uc744 \ud480\uace0 \ud658\uacbd\ubcc0\uc218 PATH \uc5d0 bin \ub514\ub809\ud1a0\ub9ac\ub97c \ucd94\uac00\ud574 \uc90d\ub2c8\ub2e4.<\/p>\n<p><strong>\ud655\uc778:<\/strong><\/p>\n<pre><code class=\"language-bash\">go version\n# go version go1.21.5 linux\/amd64<\/code><\/pre>\n<pre><code class=\"language-bash\">go version\n# go version go1.25.2 windows\/amd64<\/code><\/pre>\n<p><strong>2. \uccab \ud504\ub85c\uc81d\ud2b8 \ub9cc\ub4e4\uae30<\/strong><\/p>\n<pre><code class=\"language-bash\"># \ud504\ub85c\uc81d\ud2b8 \ub514\ub809\ud1a0\ub9ac \uc0dd\uc131\nmkdir hello\ncd hello\n\n# \ubaa8\ub4c8 \ucd08\uae30\ud654 (C\uc758 \ud504\ub85c\uc81d\ud2b8 \uc0dd\uc131\uacfc \uc720\uc0ac)\ngo mod init example.com\/hello\n\n# main.go \ud30c\uc77c \uc0dd\uc131<\/code><\/pre>\n<p>C \ud504\ub85c\uc81d\ud2b8\uc640 \ub2e4\ub978 \uc810:<\/p>\n<ul>\n<li>Makefile \ub300\uc2e0 <code>go build<\/code> \uc0ac\uc6a9<\/li>\n<li>\ud5e4\ub354 \ud30c\uc77c \uc5c6\uc74c<\/li>\n<li>\uc758\uc874\uc131\uc740 go.mod \ud30c\uc77c\ub85c \uad00\ub9ac<\/li>\n<\/ul>\n<p><strong>3. \uc5d0\ub514\ud130 \uc124\uc815<\/strong><\/p>\n<p>\ucd94\ucc9c \uc5d0\ub514\ud130\uc640 \ud50c\ub7ec\uadf8\uc778:<\/p>\n<ul>\n<li><strong>VS Code<\/strong>: Go (Go Team at Google)<\/li>\n<\/ul>\n<p>\ud544\uc218 \ub3c4\uad6c\ub4e4:<\/p>\n<pre><code class=\"language-bash\"># \ucf54\ub4dc \ud3ec\ub9f7\ud130\ngo install golang.org\/x\/tools\/cmd\/goimports@latest\n\n# \ub9b0\ud130\ngo install github.com\/golangci\/golangci-lint\/cmd\/golangci-lint@latest<\/code><\/pre>\n<p>Go\ub294 \ucf54\ub4dc \ud3ec\ub9f7\ud305 \uc2a4\ud0c0\uc77c\uc744 \uac15\uc81c\ud569\ub2c8\ub2e4. C\ucc98\ub7fc \uc2a4\ud0c0\uc77c \ub17c\uc7c1\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.<\/p>\n<h3>2\uc7a5. \uccab Go \ud504\ub85c\uadf8\ub7a8<\/h3>\n<h4>Hello World<\/h4>\n<p>main.go<\/p>\n<pre><code class=\"language-go\">package main\n\nimport &quot;fmt&quot;\n\nfunc main() {\n    fmt.Println(&quot;Hello, World!&quot;)\n}<\/code><\/pre>\n<h4>\ube4c\ub4dc\uc640 \uc2e4\ud589<\/h4>\n<pre><code class=\"language-bash\"># \ube4c\ub4dc (\ucef4\ud30c\uc77c + \ub9c1\ud06c \ud55c\ubc88\uc5d0)\ngo build\n\n# \uc2e4\ud589\n.\/hello\n\n# \ub610\ub294 \ube4c\ub4dc\ud558\uc9c0 \uc54a\uace0 \ubc14\ub85c \uc2e4\ud589\ngo run main.go<\/code><\/pre>\n<h2>2\ubd80: \uae30\ubcf8 \ubb38\ubc95<\/h2>\n<h3>3\uc7a5. \ubcc0\uc218\uc640 \ud0c0\uc785<\/h3>\n<ul>\n<li>\ubcc0\uc218 \uc120\uc5b8<\/li>\n<\/ul>\n<pre><code class=\"language-go\">var x int = 10\nvar name string = &quot;John&quot;\nvar pi float64 = 3.14\n\n\/\/ \ub610\ub294 \ud0c0\uc785 \ucd94\ub860 \uc0ac\uc6a9\nvar x = 10        \/\/ int\ub85c \ucd94\ub860\nvar name = &quot;John&quot; \/\/ string\uc73c\ub85c \ucd94\ub860\nvar pi = 3.14     \/\/ float64\ub85c \ucd94\ub860<\/code><\/pre>\n<ul>\n<li>\uc804\uc5ed\ubcc0\uc218\uc640 \uc9c0\uc5ed\ubcc0\uc218<\/li>\n<\/ul>\n<pre><code class=\"language-go\">\/\/ \uc804\uc5ed\ubcc0\uc218 (\ud328\ud0a4\uc9c0 \uc678\ubd80\uc5d0\uc11c\ub3c4 \uc811\uadfc\uac00\ub2a5)\nvar GlobalCounter int = 0\n\n\/\/ \uc804\uc5ed\ubcc0\uc218 (\ud328\ud0a4\uc9c0 \ub808\ubca8)\nvar globalName string = &quot;Global&quot;\n\n\/\/ \uc5ec\ub7ec \ubcc0\uc218 \ub3d9\uc2dc \uc120\uc5b8\nvar (\n    MaxConnections int = 100\n    DefaultTimeout int = 30\n    ServerName string = &quot;MyServer&quot;\n)\n\nfunc main() {\n    \/\/ \uc9c0\uc5ed\ubcc0\uc218 (\ud568\uc218 \ub0b4\ubd80)\n    localVar := 10  \/\/ := \ub294 \ud568\uc218 \ub0b4\ubd80\uc5d0\uc11c\ub9cc \uc0ac\uc6a9 \uac00\ub2a5\n\n    \/\/ \uc804\uc5ed\ubcc0\uc218\ub294 := \ub85c \uc120\uc5b8 \ubd88\uac00\n    \/\/ GlobalCounter := 100  \/\/ \ucef4\ud30c\uc77c \uc5d0\ub7ec!\n\n    GlobalCounter = 100  \/\/ OK: \uc804\uc5ed\ubcc0\uc218 \uac12 \ubcc0\uacbd\n}\n\n\/\/ \ub300\ubb38\uc790\ub85c \uc2dc\uc791\ud558\uba74 \ub2e4\ub978 \ud328\ud0a4\uc9c0\uc5d0\uc11c\ub3c4 \uc811\uadfc \uac00\ub2a5 (exported)\nvar ExportedVar int = 10  \/\/ public\uacfc \uc720\uc0ac\n\n\/\/ \uc18c\ubb38\uc790\ub85c \uc2dc\uc791\ud558\uba74 \uac19\uc740 \ud328\ud0a4\uc9c0 \ub0b4\uc5d0\uc11c\ub9cc \uc811\uadfc \uac00\ub2a5\nvar privateVar int = 10   \/\/ private\uacfc \uc720\uc0ac<\/code><\/pre>\n<ul>\n<li>\uae30\ubcf8 \ud0c0\uc785 \ube44\uad50<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>C \ud0c0\uc785<\/th>\n<th>Go \ud0c0\uc785<\/th>\n<th>\uc124\uba85<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>char<\/td>\n<td>byte (\ub610\ub294 uint8)<\/td>\n<td>8\ube44\ud2b8 \ubd80\ud638 \uc5c6\ub294 \uc815\uc218<\/td>\n<\/tr>\n<tr>\n<td>int<\/td>\n<td>int<\/td>\n<td>\ud50c\ub7ab\ud3fc \uc758\uc874\uc801 (32 \ub610\ub294 64\ube44\ud2b8)<\/td>\n<\/tr>\n<tr>\n<td>long<\/td>\n<td>int64<\/td>\n<td>64\ube44\ud2b8 \uc815\uc218<\/td>\n<\/tr>\n<tr>\n<td>float<\/td>\n<td>float32<\/td>\n<td>32\ube44\ud2b8 \ubd80\ub3d9\uc18c\uc218\uc810<\/td>\n<\/tr>\n<tr>\n<td>double<\/td>\n<td>float64<\/td>\n<td>64\ube44\ud2b8 \ubd80\ub3d9\uc18c\uc218\uc810<\/td>\n<\/tr>\n<tr>\n<td>char*<\/td>\n<td>string<\/td>\n<td>\ubd88\ubcc0 \ubb38\uc790\uc5f4 (\uc911\uc694!)<\/td>\n<\/tr>\n<tr>\n<td>&#8211;<\/td>\n<td>rune<\/td>\n<td>UTF-8 \ubb38\uc790 (int32\uc758 \ubcc4\uce6d)<\/td>\n<\/tr>\n<tr>\n<td>&#8211;<\/td>\n<td>bool<\/td>\n<td>true\/false<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>\ud0c0\uc785 \ucd94\ub860\uacfc := \uc5f0\uc0b0\uc790<\/li>\n<\/ul>\n<pre><code class=\"language-go\">\/\/ \uc804\ud1b5\uc801\uc778 \ubc29\uc2dd\nvar x int = 10\nvar name string = &quot;John&quot;\n\n\/\/ \ud0c0\uc785 \ucd94\ub860\nvar x = 10\nvar name = &quot;John&quot;\n\n\/\/ \uc9e7\uc740 \uc120\uc5b8 (\ud568\uc218 \ub0b4\ubd80\uc5d0\uc11c\ub9cc \uc0ac\uc6a9 \uac00\ub2a5, \uc0c8\ub85c\uc6b4 \ubcc0\uc218\ub97c \uc120\uc5b8\ud560 \ub54c\ub9cc)\nx := 10\nname := &quot;John&quot;\npi := 3.14<\/code><\/pre>\n<ul>\n<li>\ud3ec\uc778\ud130: C\uc640\uc758 \uc720\uc0ac\uc810\uacfc \ucc28\uc774\uc810<\/li>\n<\/ul>\n<pre><code class=\"language-go\">\/\/ \uc720\uc0ac\uc810\nx := 10\np := &amp;x\n*p = 20  \/\/ x\uac00 20\uc73c\ub85c \ubcc0\uacbd\ub428\n\n\/\/ \ucc28\uc774\uc810\narr := [5]int{1, 2, 3, 4, 5}\np := &amp;arr[0]\n\/\/ p++     \/\/ \ucef4\ud30c\uc77c \uc5d0\ub7ec!\n\/\/ p += 2  \/\/ \ucef4\ud30c\uc77c \uc5d0\ub7ec!\n\n\/\/ NULL \ub300\uc2e0 nil\nvar p *int = nil<\/code><\/pre>\n<pre><code class=\"language-go\">type Person struct {\n    Name string\n    Age  int\n}\np := &amp;Person{}\np.Age = 30  \/\/ \uc790\ub3d9\uc73c\ub85c \uc5ed\ucc38\uc870\ub428 (*p).Age\uc640 \uac19\uc74c<\/code><\/pre>\n<pre><code class=\"language-go\">p := new(int)    \/\/ *int \ud0c0\uc785, 0\uc73c\ub85c \ucd08\uae30\ud654\ub428\n*p = 10\n\/\/ \uc790\ub3d9\uc73c\ub85c \uba54\ubaa8\ub9ac \ud574\uc81c<\/code><\/pre>\n<ul>\n<li>\ud0c0\uc785 \ubcc0\ud658<\/li>\n<\/ul>\n<pre><code class=\"language-go\">var x int = 10\nvar y float64 = float64(x)  \/\/ \uba85\uc2dc\uc801 \ubcc0\ud658 \ud544\uc694<\/code><\/pre>\n<h3>4\uc7a5. \ud568\uc218<\/h3>\n<ul>\n<li>\ud568\uc218 \uc120\uc5b8\uacfc \ud638\ucd9c<\/li>\n<\/ul>\n<pre><code class=\"language-go\">func add(a int, b int) int {\n    return a + b\n}\n\n\/\/ \uac19\uc740 \ud0c0\uc785 \ud30c\ub77c\ubbf8\ud130\ub294 \ud55c \ubc88\ub9cc \uba85\uc2dc \uac00\ub2a5\nfunc add(a, b int) int {\n    return a + b\n}\n\nfunc printHello() {\n    fmt.Println(&quot;Hello&quot;)\n}\n\nfunc main() {\n    result := add(3, 5)\n    printHello()\n    \/\/ return \ubb38 \ubd88\ud544\uc694 (main\uc5d0\uc11c)\n}<\/code><\/pre>\n<ul>\n<li>\ub2e4\uc911 \ubc18\ud658\uac12 (C\uc5d0\ub294 \uc5c6\ub294 \uae30\ub2a5)<\/li>\n<\/ul>\n<pre><code class=\"language-go\">func divide(a, b int) (int, int) {\n    quotient := a \/ b\n    remainder := a % b\n    return quotient, remainder\n}\n\nfunc main() {\n    q, r := divide(10, 3)\n    fmt.Printf(&quot;Quotient: %d, Remainder: %d\\n&quot;, q, r)\n    \/\/ \ucd9c\ub825: Quotient: 3, Remainder: 1\n}<\/code><\/pre>\n<ul>\n<li>Named return values<\/li>\n<\/ul>\n<pre><code class=\"language-go\">\/\/ \uba85\uba85\ub41c \ubc18\ud658\uac12 \uc0ac\uc6a9\nfunc divide(a, b int) (quotient, remainder int) {\n    quotient = a \/ b\n    remainder = a % b\n    return  \/\/ naked return (\uac12 \uba85\uc2dc \ubd88\ud544\uc694)\n}<\/code><\/pre>\n<ul>\n<li>\uac00\ubcc0 \uc778\uc790 \ud568\uc218<\/li>\n<\/ul>\n<pre><code class=\"language-go\">func sum(numbers ...int) int {\n    total := 0\n    for _, num := range numbers {\n        total += num\n    }\n    return total\n}\n\n\/\/ \uc0ac\uc6a9\nresult := sum(10, 20, 30)\nresult2 := sum(1, 2, 3, 4, 5)\nresult3 := sum()  \/\/ \uc778\uc790 \uc5c6\uc774\ub3c4 \ud638\ucd9c \uac00\ub2a5<\/code><\/pre>\n<ul>\n<li>\ud568\uc218\ub97c \uac12\uc73c\ub85c \ub2e4\ub8e8\uae30<\/li>\n<\/ul>\n<p>Go\uc5d0\uc11c \ud568\uc218\ub294 <strong>\uc77c\uae09 \uac1d\uccb4(first-class citizen)<\/strong>\uc785\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">\/\/ \ud568\uc218 \ud0c0\uc785 \uc815\uc758\ntype operation func(int, int) int\n\nfunc add(a, b int) int { return a + b }\nfunc subtract(a, b int) int { return a - b }\n\nfunc calculate(a, b int, op operation) int {\n    return op(a, b)\n}\n\nfunc main() {\n    result := calculate(10, 5, add)\n    result = calculate(10, 5, subtract)\n}<\/code><\/pre>\n<h3>5\uc7a5. \uc81c\uc5b4 \uad6c\uc870<\/h3>\n<ul>\n<li>if\ubb38 (\uc120\uc5b8\ubb38 \ud3ec\ud568 \uac00\ub2a5)<\/li>\n<\/ul>\n<p>Go\uc758 if\ubb38\uc740 C\uc640 \ube44\uc2b7\ud558\uc9c0\ub9cc \uc870\uac74\uc2dd\uc744 \uad04\ud638\ub85c \uac10\uc2f8\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ub300\uc2e0 \uc911\uad04\ud638\ub294 \ud544\uc218\uc785\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">if x &gt; 10 {\n    fmt.Println(&quot;\ud06c\ub2e4&quot;)\n}<\/code><\/pre>\n<p>\uc870\uac74\uc2dd \uc548\uc5d0\uc11c \ubcc0\uc218 \uc0dd\uc131\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">package main\n\nimport (\n    &quot;fmt&quot;\n)\n\nfunc getValue() int {\n    return 0\n}\n\nfunc main() {\n    if val := getValue(); val &gt; 0 {\n        fmt.Println(&quot;\uc591\uc218:&quot;, val)\n    } else {\n        fmt.Println(&quot;\uc74c\uc218 \ub610\ub294 0:&quot;, val) \/\/ val\uc740 \uc5ec\uc804\ud788 \uc720\ud6a8\n    }\n}<\/code><\/pre>\n<ul>\n<li>for\ubb38 (Go\uc758 \uc720\uc77c\ud55c \ubc18\ubcf5\ubb38)<\/li>\n<\/ul>\n<p>Go\uc5d0\ub294 for\ubb38\ub9cc \uc874\uc7ac\ud569\ub2c8\ub2e4. while\uc774\ub098 do-while\uc740 \uc5c6\uc2b5\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">\/\/ C\uc640 \uac70\uc758 \ub3d9\uc77c\ud558\uc9c0\ub9cc \uad04\ud638\uac00 \uc5c6\uc74c\nfor i := 0; i &lt; 10; i++ {\n    fmt.Println(i)\n}\n\nfor {\n    \/\/ \ubb34\ud55c \ubc18\ubcf5\n    if shouldStop {\n        break\n    }\n}<\/code><\/pre>\n<p>range \ud0a4\uc6cc\ub4dc<\/p>\n<pre><code class=\"language-go\">\/\/ \ubc30\uc5f4\/\uc2ac\ub77c\uc774\uc2a4 \uc21c\ud68c\nnumbers := []int{10, 20, 30, 40, 50}\nfor index, value := range numbers {\n    fmt.Printf(&quot;numbers[%d] = %d\\n&quot;, index, value)\n}\n\n\/\/ \uc778\ub371\uc2a4\ub9cc \ud544\uc694\ud55c \uacbd\uc6b0\nfor i := range numbers {\n    fmt.Println(i)\n}\n\n\/\/ \uac12\ub9cc \ud544\uc694\ud55c \uacbd\uc6b0 (\uc778\ub371\uc2a4 \ubb34\uc2dc)\nfor _, value := range numbers {\n    fmt.Println(value)\n}<\/code><\/pre>\n<ul>\n<li>switch\ubb38 (break \ubd88\ud544\uc694, fallthrough)<\/li>\n<li>defer \ubb38 (C\uc5d0\ub294 \uc5c6\ub294 \uae30\ub2a5)<\/li>\n<\/ul>\n<p>\ud568\uc218\uac00 \uc885\ub8cc\ub418\uae30 \uc9c1\uc804\uc5d0 \ud2b9\uc815 \ucf54\ub4dc\ub97c \uc2e4\ud589\ud558\ub3c4\ub85d \uc608\uc57d\ud558\ub294 \uae30\ub2a5.<br \/>\n\uc5ec\ub7ec \uac1c\uc758 defer \ubb38\uc774 \uc788\uc73c\uba74 LIFO(Last In First Out) \uc21c\uc11c\ub85c \uc2e4\ud589.<\/p>\n<pre><code class=\"language-go\">func example() {\n    defer fmt.Println(&quot;\ub9c8\uc9c0\ub9c9&quot;)\n    defer fmt.Println(&quot;\ub450 \ubc88\uc9f8&quot;)\n    fmt.Println(&quot;\uccab \ubc88\uc9f8&quot;)\n}\n\/\/ \ucd9c\ub825:\n\/\/ \uccab \ubc88\uc9f8\n\/\/ \ub450 \ubc88\uc9f8\n\/\/ \ub9c8\uc9c0\ub9c9<\/code><\/pre>\n<h2>3\ubd80: \uba54\ubaa8\ub9ac\uc640 \ub370\uc774\ud130 \uad6c\uc870<\/h2>\n<h3>6\uc7a5. \ud3ec\uc778\ud130 \uc2ec\ud654<\/h3>\n<ul>\n<li>C \ud3ec\uc778\ud130\uc640 Go \ud3ec\uc778\ud130\uc758 \ucc28\uc774<\/li>\n<li>\ud3ec\uc778\ud130 \uc0b0\uc220 \uc5f0\uc0b0\uc774 \uc5c6\ub294 \uc774\uc720<\/li>\n<li>nil\uacfc NULL<\/li>\n<li>\ud3ec\uc778\ud130\ub97c \uc0ac\uc6a9\ud558\ub294 \uc2dc\uae30<\/li>\n<\/ul>\n<h3>7\uc7a5. \ubc30\uc5f4\uacfc \uc2ac\ub77c\uc774\uc2a4<\/h3>\n<ul>\n<li>\n<p>\ubc30\uc5f4\uacfc \uc2ac\ub77c\uc774\uc2a4<\/p>\n<p>\ubc30\uc5f4\uc740 \ud06c\uae30\uac00 \uace0\uc815\uc774\ub2e4. \uc18d\ub3c4\uac00 \ube60\ub974\ub2e4. \ud568\uc218 \uc804\ub2ec\uc2dc \ud3ec\uc778\ud130\ub97c \uc804\ub2ec\ud574\uc57c \ud55c\ub2e4.<\/p>\n<p>\uc2ac\ub77c\uc774\uc2a4\ub294 \ud06c\uae30\ub97c \ubcc0\uacbd\ud560 \uc218 \uc788\ub2e4. \ucc38\uc870 \ud0c0\uc785\uc774\uae30\uc5d0 \ud568\uc218\uc5d0 \uadf8\ub300\ub85c \uc804\ub2ec \uac00\ub2a5\ud558\ub2e4.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"language-go\">\/\/ \ubc30\uc5f4 - \uac70\uc758 \uc0ac\uc6a9\ud558\uc9c0 \uc54a\uc74c\nvar arr [5]int = [5]int{1, 2, 3, 4, 5}\n\n\/\/ \uc2ac\ub77c\uc774\uc2a4 - \uc77c\ubc18\uc801\uc73c\ub85c \uc0ac\uc6a9\nslice := []int{1, 2, 3, 4, 5}\nslice = append(slice, 6)  \/\/ \ub3d9\uc801\uc73c\ub85c \ud655\uc7a5 \uac00\ub2a5\n\n\/\/ \uc2ac\ub77c\uc774\uc2a4 \uc0dd\uc131 \ubc29\ubc95\ub4e4\ns1 := make([]int, 5)        \/\/ \uae38\uc774 5\ns2 := make([]int, 0, 10)    \/\/ \uae38\uc774 0, \uc6a9\ub7c9 10\ns3 := []string{&quot;a&quot;, &quot;b&quot;, &quot;c&quot;}<\/code><\/pre>\n<ul>\n<li>\uc2ac\ub77c\uc774\uc2a4 \ub0b4\ubd80 \uad6c\uc870 \uc774\ud574<\/li>\n<\/ul>\n<pre><code class=\"language-go\">s1 := make([]int, 5)        \/\/ \uae38\uc774 5\ns2 := make([]int, 0, 10)    \/\/ \uae38\uc774 0, \uc6a9\ub7c9 10<\/code><\/pre>\n<p>\uc6a9\ub7c9\uc744 \uc9c0\uc815\ud558\uc9c0 \uc54a\ub294 \uacbd\uc6b0, \uc6a9\ub7c9\uc774 \ubd80\uc871\ud558\uba74 2\ubc30 \ud06c\uae30\uc758 \uc2ac\ub77c\uc774\uc2a4\ub97c \uc0c8\ub85c\uc0dd\uc131\ud558\uace0 \uac12\uc744 \ubcf5\uc0ac\ud55c\ub2e4.<\/p>\n<ul>\n<li>make\uc640 new\uc758 \ucc28\uc774<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>\uad6c\ubd84<\/th>\n<th>new<\/th>\n<th>make<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\uc801\uc6a9 \ub300\uc0c1<\/td>\n<td>\ubaa8\ub4e0 \ud0c0\uc785<\/td>\n<td>slice, map, channel\ub9cc<\/td>\n<\/tr>\n<tr>\n<td>\ubc18\ud658 \ud0c0\uc785<\/td>\n<td>\ud3ec\uc778\ud130 (<code>*T<\/code>)<\/td>\n<td>\ucc38\uc870 \ud0c0\uc785 (<code>T<\/code>)<\/td>\n<\/tr>\n<tr>\n<td>\ucd08\uae30\ud654<\/td>\n<td>\uc81c\ub85c\uac12\uc73c\ub85c \ucd08\uae30\ud654<\/td>\n<td>\uc0ac\uc6a9 \uac00\ub2a5\ud55c \uc0c1\ud0dc\ub85c \ucd08\uae30\ud654<\/td>\n<\/tr>\n<tr>\n<td>\uba54\ubaa8\ub9ac \ud560\ub2f9<\/td>\n<td>\uba54\ubaa8\ub9ac\ub9cc \ud560\ub2f9<\/td>\n<td>\ub0b4\ubd80 \uad6c\uc870\uae4c\uc9c0 \ucd08\uae30\ud654<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code class=\"language-go\">p := new(Person)  \/\/ &amp;Person{} \uc640 \ub3d9\uc77c<\/code><\/pre>\n<p>\ucc38\uc870\ud0c0\uc785\uc744 \ubc18\ud658\ud558\uba70, \ud568\uc218 \ud30c\ub77c\ubbf8\ud130\ub85c \uc804\ub2ec\ub420 \ub54c\uc5d0\ub3c4 \ubcf5\uc0ac\uac00 \uc544\ub2cc \ucc38\uc870\uac00 \uc804\ub2ec\ub41c\ub2e4.<\/p>\n<pre><code class=\"language-go\">s := make([]int, 0, 10)\nm := make(map[string]int)\nch := make(chan int)<\/code><\/pre>\n<ul>\n<li>append\uc640 copy<\/li>\n<\/ul>\n<h3>8\uc7a5. \ub9f5\uacfc \uad6c\uc870\uccb4<\/h3>\n<ul>\n<li>\uad6c\uc870\uccb4<\/li>\n<\/ul>\n<pre><code class=\"language-go\">type Person struct {\n    Name   string\n    Age    int\n    Height float64\n}\n\n\/\/ \ub9ac\ud130\ub7f4\ub85c \ucd08\uae30\ud654\np := Person{\n    Name:   &quot;Alice&quot;,\n    Age:    30,\n    Height: 165.5,\n}\n\n\/\/ \ud544\ub4dc\ub9cc \uc9c0\uc815 (\uc21c\uc11c \ubb34\uad00)\np2 := Person{Age: 25, Name: &quot;Bob&quot;}\n\n\/\/ \ud3ec\uc778\ud130\ub85c \uc811\uadfc (-&gt; \uc5f0\uc0b0\uc790 \ubd88\ud544\uc694!)\nptr := &amp;p\nptr.Age = 31  \/\/ Go\ub294 \uc790\ub3d9\uc73c\ub85c \uc5ed\ucc38\uc870<\/code><\/pre>\n<pre><code class=\"language-go\">\/\/ \ud0c0\uc785 \uc774\ub984 \uc5c6\uc774 \ubc14\ub85c \uc0ac\uc6a9\nconfig := struct {\n    Host string\n    Port int\n}{\n    Host: &quot;localhost&quot;,\n    Port: 8080,\n}\n\nfmt.Println(config.Host)  \/\/ localhost<\/code><\/pre>\n<ul>\n<li>\uba54\uc11c\ub4dc \ucd94\uac00\ud558\uae30<\/li>\n<\/ul>\n<pre><code class=\"language-go\">type Rectangle struct {\n    Width  int\n    Height int\n}\n\n\/\/ \uac12 \ub9ac\uc2dc\ubc84 (\ubcf5\uc0ac\ubcf5\uc744 \uc2e4\ud589)\nfunc (r Rectangle) Area() int {\n    return r.Width * r.Height\n}\n\n\/\/ \ud3ec\uc778\ud130 \ub9ac\uc2dc\ubc84 (\uc2e4\uc81c \uac12\uc744 \ubcc0\uacbd)\nfunc (r *Rectangle) Scale(factor int) {\n    r.Width *= factor\n    r.Height *= factor\n}\n\n\/\/ \uc0ac\uc6a9\nrect := Rectangle{Width: 10, Height: 5}\nfmt.Println(rect.Area())  \/\/ 50\n\nrect.Scale(2)\nfmt.Println(rect.Area())  \/\/ 200<\/code><\/pre>\n<ul>\n<li>\ub9f5(Map): \ub0b4\uc7a5 \ud574\uc2dc\ud14c\uc774\ube14<\/li>\n<\/ul>\n<pre><code class=\"language-go\">\/\/ \uc120\uc5b8\uacfc \ucd08\uae30\ud654\nages := map[string]int{\n    &quot;Alice&quot;: 30,\n    &quot;Bob&quot;:   25,\n    &quot;Carol&quot;: 35,\n}\n\n\/\/ \ucd94\uac00\/\uc218\uc815\nages[&quot;Dave&quot;] = 40\n\n\/\/ \uc870\ud68c\nage := ages[&quot;Alice&quot;]\nfmt.Println(age)  \/\/ 30\n\n\/\/ \uc0ad\uc81c\ndelete(ages, &quot;Bob&quot;)\n\n\/\/ \uc874\uc7ac \ud655\uc778\nage, exists := ages[&quot;Eve&quot;]\nif exists {\n    fmt.Println(&quot;Eve&#039;s age:&quot;, age)\n} else {\n    fmt.Println(&quot;Eve not found&quot;)\n}<\/code><\/pre>\n<h2>4\ubd80: \uba54\ubaa8\ub9ac \uad00\ub9ac<\/h2>\n<h3>9\uc7a5. \uac00\ube44\uc9c0 \uceec\ub809\uc158<\/h3>\n<ul>\n<li>malloc\/free\uc5d0\uc11c GC\ub85c<\/li>\n<\/ul>\n<pre><code class=\"language-go\">type Person struct {\n    Name string\n    Age  int\n}\n\nfunc createPerson(name string, age int) *Person {\n    p := &amp;Person{\n        Name: name,\n        Age:  age,\n    }\n    return p\n    \/\/ free() \ud638\ucd9c \ubd88\ud544\uc694! GC\uac00 \uc790\ub3d9\uc73c\ub85c \ucc98\ub9ac\n}\n\nfunc main() {\n    p := createPerson(&quot;Alice&quot;, 30)\n    \/\/ p\ub97c \uc0ac\uc6a9\n    \/\/ \ub354 \uc774\uc0c1 \ucc38\uc870\ub418\uc9c0 \uc54a\uc73c\uba74 GC\uac00 \uc790\ub3d9\uc73c\ub85c \uba54\ubaa8\ub9ac \ud68c\uc218\n}<\/code><\/pre>\n<ul>\n<li>\uc2a4\ud0dd vs \ud799 \ud560\ub2f9<\/li>\n<\/ul>\n<p>go \ucef4\ud30c\uc77c\ub7ec\uac00 \uc2a4\ud0dd(\uc784\uc2dc\uba54\ubaa8\ub9ac) \uc5d0 \uc800\uc7a5\ud560\uc9c0 \ud799\uc5d0 \uc800\uc7a5\ud560\uc9c0\ub97c \uc790\ub3d9\uc73c\ub85c \uc120\ud0dd\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">func stackAllocation() *int {\n    x := 42\n    return &amp;x  \/\/ C\uc5d0\uc11c\ub294 \uc704\ud5d8! Go\uc5d0\uc11c\ub294 \uc548\uc804\n}\n\nfunc heapAllocation() *int {\n    x := 42\n    return &amp;x  \/\/ \ucef4\ud30c\uc77c\ub7ec\uac00 x\ub97c \ud799\uc5d0 \ud560\ub2f9\n}\n\nfunc localOnly() {\n    x := 42\n    println(x)  \/\/ x\ub294 \uc2a4\ud0dd\uc5d0 \ud560\ub2f9 (\ud568\uc218 \ubc16\uc73c\ub85c \ub098\uac00\uc9c0 \uc54a\uc74c)\n}<\/code><\/pre>\n<h3>10\uc7a5. \uba54\ubaa8\ub9ac \uc548\uc804\uc131<\/h3>\n<ul>\n<li>\n<p>\ubc84\ud37c \uc624\ubc84\ud50c\ub85c\uc6b0 \ubc29\uc9c0<\/p>\n<p>\uc5b8\uc5b4\ub808\ubca8\uc5d0\uc11c \uc624\ubc84\ud50c\ub85c\uc6b0\ub97c \ucc28\ub2e8\ud569\ub2c8\ub2e4.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"language-go\">arr := [5]int{1, 2, 3, 4, 5}\nfmt.Println(arr[4])  \/\/ OK\n\/\/ fmt.Println(arr[5])  \/\/ panic: runtime error: index out of range [5] with length 5\n\n\/\/ \uc2ac\ub77c\uc774\uc2a4\ub3c4 \ub9c8\ucc2c\uac00\uc9c0\nslice := []int{1, 2, 3}\n\/\/ value := slice[10]  \/\/ panic: runtime error: index out of range [10] with length 3<\/code><\/pre>\n<ul>\n<li>\ub315\uae00\ub9c1 \ud3ec\uc778\ud130 \ubb38\uc81c \ud574\uacb0<\/li>\n<\/ul>\n<pre><code class=\"language-go\">func noMoreDangling() *int {\n    local := 42\n    return &amp;local  \/\/ Go \ucef4\ud30c\uc77c\ub7ec\uac00 \uc790\ub3d9\uc73c\ub85c \ud799\uc5d0 \ud560\ub2f9\n}\n\nfunc main() {\n    ptr := noMoreDangling()\n    fmt.Println(*ptr)  \/\/ 42 - \uc644\uc804\ud788 \uc548\uc804\ud568!\n}<\/code><\/pre>\n<ul>\n<li>\uba54\ubaa8\ub9ac \ub204\uc218 \ubc29\uc9c0<\/li>\n<\/ul>\n<pre><code class=\"language-go\">\/\/ \ubb38\uc81c\uac00 \uc788\ub294 \ucf54\ub4dc\nfunc processData(data []byte) []byte {\n    \/\/ \ud070 \uc2ac\ub77c\uc774\uc2a4\uc5d0\uc11c \uc791\uc740 \ubd80\ubd84\ub9cc \ud544\uc694\ud55c \uacbd\uc6b0\n    result := data[0:10]  \/\/ \uc804\uccb4 \ubc30\uc5f4\uc744 \ucc38\uc870\ud558\uace0 \uc788\uc74c!\n    return result\n}\n\n\/\/ \uc62c\ubc14\ub978 \ubc29\ubc95\nfunc processDataCorrectly(data []byte) []byte {\n    result := make([]byte, 10)\n    copy(result, data[0:10])  \/\/ \ud544\uc694\ud55c \ubd80\ubd84\ub9cc \ubcf5\uc0ac\n    return result\n}<\/code><\/pre>\n<ul>\n<li>\n<p>unsafe \ud328\ud0a4\uc9c0 (\uc8fc\uc758\ud574\uc11c \uc0ac\uc6a9\ud558\uae30)<\/p>\n<p>\uc704\uc640 \uac19\uc740 \uc5b8\uc5b4\ub808\ubca8 \uccb4\ud06c\ub97c \ubc30\uc81c\ud558\uae30 \uc704\ud574 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<br \/>\n\uc131\ub2a5\uc774 \uadf9\ub3c4\ub85c \uc911\uc694\ud55c \ubd80\ubd84\uc5d0 \uc81c\ud55c\uc801\uc73c\ub85c \uc0ac\uc6a9\ub418\uc5b4\uc57c \ud569\ub2c8\ub2e4.<\/p>\n<\/li>\n<\/ul>\n<h2>5\ubd80: \ub3d9\uc2dc\uc131<\/h2>\n<h3>11\uc7a5. \uace0\ub8e8\ud2f4<\/h3>\n<p>\uc5b8\uc5b4\ub808\ubca8\uc5d0\uc11c \uc2a4\ub808\ub4dc\ub97c \uc9c0\uc6d0\ud569\ub2c8\ub2e4.<br \/>\n<code>go<\/code> \ud0a4\uc6cc\ub4dc\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc73c\ub85c \uc2a4\ub808\ub4dc\uac00 \uc0dd\uc131\ub429\ub2c8\ub2e4.<br \/>\n\uba54\uc778 \ud568\uc218\uac00 \uc885\ub8cc\ub428\uacfc \ub3d9\uc2dc\uc5d0 \uc2a4\ub808\ub4dc\ub3c4 \uc885\ub8cc\ub418\ubbc0\ub85c \uc801\uc808\ud55c \ub3d9\uae30\ud654\ub97c \ud574\uc8fc\uc5b4\uc57c \ud569\ub2c8\ub2e4.<br \/>\n(\ucc44\ub110 \ucc55\ud130 \ucc38\uc870)<\/p>\n<pre><code class=\"language-go\">package main\n\nimport (\n    &quot;fmt&quot;\n    &quot;time&quot;\n)\n\nfunc worker(id int) {\n    fmt.Printf(&quot;Worker %d\\n&quot;, id)\n}\n\nfunc main() {\n    for i := 0; i &lt; 10; i++ {\n        go worker(i)  \/\/ \uace0\ub8e8\ud2f4 \uc0dd\uc131\uc740 \ub2e8 \ud55c \uc904!\n    }\n\n    time.Sleep(3 * time.Second)  \/\/ \uace0\ub8e8\ud2f4\uc774 \ub05d\ub098\uae38 \uae30\ub2e4\ub9bc (\uc784\uc2dc \ubc29\ud3b8)\n}<\/code><\/pre>\n<h3>12\uc7a5. \ucc44\ub110<\/h3>\n<blockquote>\n<p>&quot;\uba54\ubaa8\ub9ac\ub97c \uacf5\uc720\ud574\uc11c \ud1b5\uc2e0\ud558\uc9c0 \ub9d0\uace0, \ud1b5\uc2e0\ud574\uc11c \uba54\ubaa8\ub9ac\ub97c \uacf5\uc720\ud558\ub77c&quot;<br \/>\n(Don&#8217;t communicate by sharing memory; share memory by communicating)<\/p>\n<\/blockquote>\n<ul>\n<li>\ucc44\ub110\uc758 \uac1c\ub150\uacfc \uc0ac\uc6a9\ubc95<\/li>\n<\/ul>\n<p>\ucc44\ub110\uc744 \uc774\uc694\ud574 \uac12\uc744 \uc804\ub2ec\ud558\uace0 \uc218\uc2e0\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">package main\n\nimport &quot;fmt&quot;\n\nfunc main() {\n    \/\/ \ucc44\ub110 \uc0dd\uc131\n    ch := make(chan int)\n\n    \/\/ \uace0\ub8e8\ud2f4\uc5d0\uc11c \ucc44\ub110\ub85c \ub370\uc774\ud130 \uc804\uc1a1\n    go func() {\n        ch &lt;- 42  \/\/ \ucc44\ub110\uc5d0 \uac12 \ubcf4\ub0b4\uae30\n    }()\n\n    \/\/ \uba54\uc778 \uace0\ub8e8\ud2f4\uc5d0\uc11c \ub370\uc774\ud130 \uc218\uc2e0\n    value := &lt;-ch  \/\/ \ucc44\ub110\uc5d0\uc11c \uac12 \ubc1b\uae30\n    fmt.Println(value)\n}<\/code><\/pre>\n<ul>\n<li>\ubc84\ud37c\ub4dc \ucc44\ub110 vs \uc5b8\ubc84\ud37c\ub4dc \ucc44\ub110<\/li>\n<\/ul>\n<p><strong>\uc5b8\ubc84\ud37c\ub4dc \ucc44\ub110<\/strong> &#8211; \ub3d9\uae30 \ubc29\uc2dd<\/p>\n<pre><code class=\"language-go\">package main\n\nimport &quot;fmt&quot;\n\nfunc main() {\n    ch := make(chan int)  \/\/ \ubc84\ud37c \uc5c6\uc74c\n\n    go func() {\n        fmt.Println(&quot;\uace0\ub8e8\ud2f4: \ub370\uc774\ud130 \uc804\uc1a1 \uc2dc\uc791&quot;)\n        ch &lt;- 42  \/\/ \ub204\uad70\uac00 \ubc1b\uc744 \ub54c\uae4c\uc9c0 \ube14\ub85d\ub428\n        fmt.Println(&quot;\uace0\ub8e8\ud2f4: \ub370\uc774\ud130 \uc804\uc1a1 \uc644\ub8cc&quot;)\n    }()\n\n    fmt.Println(&quot;\uba54\uc778: \ub370\uc774\ud130 \uc218\uc2e0 \ub300\uae30&quot;)\n    value := &lt;-ch  \/\/ \ub204\uad70\uac00 \ubcf4\ub0bc \ub54c\uae4c\uc9c0 \ube14\ub85d\ub428\n    fmt.Printf(&quot;\uba54\uc778: \uc218\uc2e0\ud55c \uac12 = %d\\n&quot;, value)\n}<\/code><\/pre>\n<p><strong>\ubc84\ud37c\ub4dc \ucc44\ub110<\/strong> &#8211; \ube44\ub3d9\uae30 \ubc29\uc2dd<\/p>\n<pre><code class=\"language-go\">package main\n\nimport (\n    &quot;fmt&quot;\n    &quot;time&quot;\n)\n\nfunc main() {\n    ch := make(chan int, 3)  \/\/ \ubc84\ud37c \ud06c\uae30 3\n\n    \/\/ \ubc84\ud37c\uac00 \uac00\ub4dd \ucc30 \ub54c\uae4c\uc9c0 \ube14\ub85d\ub418\uc9c0 \uc54a\uc74c\n    ch &lt;- 1\n    ch &lt;- 2\n    ch &lt;- 3\n    fmt.Println(&quot;3\uac1c\uc758 \uac12\uc744 \uc804\uc1a1\ud568&quot;)\n\n    \/\/ \uc774 \uc2dc\uc810\uc5d0\uc11c ch &lt;- 4\ub97c \ud558\uba74 \ube14\ub85d\ub428\n\n    go func() {\n        time.Sleep(time.Second)\n        fmt.Println(&lt;-ch)  \/\/ 1\n        fmt.Println(&lt;-ch)  \/\/ 2\n        fmt.Println(&lt;-ch)  \/\/ 3\n    }()\n\n    time.Sleep(2 * time.Second)\n}<\/code><\/pre>\n<ul>\n<li>select \ubb38<\/li>\n<\/ul>\n<p><code>select<\/code>\ub294 \uc5ec\ub7ec \ucc44\ub110 \uc791\uc5c5\uc744 \ub3d9\uc2dc\uc5d0 \ub300\uae30\ud560 \uc218 \uc788\uac8c \ud574\uc90d\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">package main\n\nimport (\n    &quot;fmt&quot;\n    &quot;time&quot;\n)\n\nfunc main() {\n    ch1 := make(chan string)\n    ch2 := make(chan string)\n\n    go func() {\n        time.Sleep(1 * time.Second)\n        ch1 &lt;- &quot;one&quot;\n    }()\n\n    go func() {\n        time.Sleep(2 * time.Second)\n        ch2 &lt;- &quot;two&quot;\n    }()\n\n    \/\/ \ub450 \ucc44\ub110 \uc911 \uba3c\uc800 \uc900\ube44\ub41c \uac83\uc744 \ucc98\ub9ac\n    for i := 0; i &lt; 2; i++ {\n        select {\n        case msg1 := &lt;-ch1:\n            fmt.Println(&quot;received&quot;, msg1)\n        case msg2 := &lt;-ch2:\n            fmt.Println(&quot;received&quot;, msg2)\n        }\n    }\n}<\/code><\/pre>\n<h3>13\uc7a5. \ub3d9\uc2dc\uc131 \ud328\ud134<\/h3>\n<ul>\n<li>Worker Pool \ud328\ud134<\/li>\n<li>Pipeline \ud328\ud134<\/li>\n<li>Fan-out, Fan-in<\/li>\n<li>Context\ub97c \uc774\uc6a9\ud55c \ucde8\uc18c \ucc98\ub9ac<\/li>\n<li>sync \ud328\ud0a4\uc9c0 (Mutex, WaitGroup \ub4f1)<\/li>\n<\/ul>\n<h2>6\ubd80: \uc2e4\uc804 Go<\/h2>\n<h3>14\uc7a5. \uc5d0\ub7ec \ucc98\ub9ac<\/h3>\n<ul>\n<li>errno\uc5d0\uc11c error \uc778\ud130\ud398\uc774\uc2a4\ub85c<\/li>\n<\/ul>\n<p>Go\uc5d0\uc11c \uc5d0\ub7ec\ub294 \ub0b4\uc7a5\ub41c error \uc778\ud130\ud398\uc774\uc2a4\ub85c \ud45c\ud604\ub429\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">type error interface {\n    Error() string\n}<\/code><\/pre>\n<ul>\n<li>\ub2e4\uc911 \ubc18\ud658\uac12\uc744 \uc774\uc6a9\ud55c \uc5d0\ub7ec \ucc98\ub9ac<\/li>\n<\/ul>\n<p>\uc624\ub958\uac00 \ubc1c\uc0dd\ud558\uba74 \ubc1c\uc0dd\ud55c \uc624\ub958\ub97c \ud568\uc218\ub97c \ud638\ucd9c\ud55c \uacf3\uc73c\ub85c \uc804\ub2ec\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">package main\n\nimport (\n    &quot;fmt&quot;\n    &quot;os&quot;\n)\n\nfunc main() {\n    \/\/ \ud30c\uc77c \uc5f4\uae30\n    file, err := os.Open(&quot;data.txt&quot;)\n    if err != nil {\n        fmt.Fprintf(os.Stderr, &quot;\ud30c\uc77c \uc5f4\uae30 \uc2e4\ud328: %v\\n&quot;, err)\n        os.Exit(1)\n    }\n    defer file.Close()\n\n    \/\/ \ud30c\uc77c \uc791\uc5c5 \uc218\ud589\n    fmt.Println(&quot;\ud30c\uc77c\uc744 \uc131\uacf5\uc801\uc73c\ub85c \uc5f4\uc5c8\uc2b5\ub2c8\ub2e4&quot;)\n}<\/code><\/pre>\n<ul>\n<li>\uc624\ub958 \uc0dd\uc131<\/li>\n<\/ul>\n<pre><code class=\"language-go\">package main\n\nimport (\n    &quot;errors&quot;\n    &quot;fmt&quot;\n)\n\nfunc example1() error {\n    \/\/ 1. errors.New() - \uac04\ub2e8\ud55c \uc5d0\ub7ec \uba54\uc2dc\uc9c0\n    return errors.New(&quot;\ubb54\uac00 \uc798\ubabb\ub418\uc5c8\uc2b5\ub2c8\ub2e4&quot;)\n}\n\nfunc example2(code int) error {\n    \/\/ 2. fmt.Errorf() - \ud3ec\ub9f7\ud305\ub41c \uc5d0\ub7ec \uba54\uc2dc\uc9c0\n    return fmt.Errorf(&quot;\uc798\ubabb\ub41c \ucf54\ub4dc: %d&quot;, code)\n}\n\nfunc example3(filename string) error {\n    \/\/ 3. \uc870\uac74\ubd80 \uc5d0\ub7ec \ubc18\ud658\n    if filename == &quot;&quot; {\n        return errors.New(&quot;\ud30c\uc77c\uba85\uc774 \ube44\uc5b4\uc788\uc2b5\ub2c8\ub2e4&quot;)\n    }\n    return nil  \/\/ \uc5d0\ub7ec \uc5c6\uc74c\n}<\/code><\/pre>\n<ul>\n<li>panic\uacfc recover<\/li>\n<\/ul>\n<p>\uc77c\ubc18\uc801\uc73c\ub85c panic\uacfc recover \ub294 \uac70\uc758 \uc0ac\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<\/p>\n<p>panic \uc740 \ubcf5\uad6c \ubd88\uac00\ub2a5\ud55c \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc744 \ub54c \uc0ac\uc6a9\ub418\uba70, \uc624\ub958 \ucd9c\ub825 \ud6c4 \ud504\ub85c\uadf8\ub7a8\uc744 \uc885\ub8cc\uc2dc\ud0b5\ub2c8\ub2e4.<\/p>\n<ul>\n<li>\uc5d0\ub7ec \ub798\ud551\uacfc \uc5b8\ub798\ud551<\/li>\n<li>\ucee4\uc2a4\ud140 \uc5d0\ub7ec \ud0c0\uc785<\/li>\n<\/ul>\n<h3>15\uc7a5. \uc778\ud130\ud398\uc774\uc2a4<\/h3>\n<ul>\n<li>C\uc5d0\ub294 \uc5c6\ub294 Go\uc758 \uc778\ud130\ud398\uc774\uc2a4<\/li>\n<\/ul>\n<pre><code class=\"language-go\">package main\n\nimport (\n    &quot;fmt&quot;\n    &quot;math&quot;\n)\n\ntype Shape interface {\n    Draw()\n    Area() float64\n}\n\ntype Circle struct {\n    Radius float64\n}\n\n\/\/ \uba54\uc11c\ub4dc\ub9cc \uad6c\ud604\ud558\uba74 \uc790\ub3d9\uc73c\ub85c \uc778\ud130\ud398\uc774\uc2a4 \ub9cc\uc871\nfunc (c Circle) Draw() {\n    fmt.Printf(&quot;Drawing circle with radius %f\\n&quot;, c.Radius)\n}\n\nfunc (c Circle) Area() float64 {\n    return math.Pi * c.Radius * c.Radius\n}\n\n\/\/ \uc0ac\uc6a9\nfunc main() {\n    var s Shape = Circle{Radius: 5.0}\n    s.Draw()\n    fmt.Printf(&quot;Area: %f\\n&quot;, s.Area())\n}<\/code><\/pre>\n<ul>\n<li>\ube48 \uc778\ud130\ud398\uc774\uc2a4 (interface{})<\/li>\n<\/ul>\n<pre><code class=\"language-go\">\/\/ \ubaa8\ub4e0 \ud0c0\uc785\uc744 \ubc1b\uc744 \uc218 \uc788\uc74c (C\uc758 void*\uc640 \uc720\uc0ac)\nfunc printAnything(v interface{}) {\n    fmt.Printf(&quot;Value: %v, Type: %T\\n&quot;, v, v)\n}\n\nfunc main() {\n    printAnything(42)           \/\/ int\n    printAnything(&quot;hello&quot;)      \/\/ string\n    printAnything(3.14)         \/\/ float64\n    printAnything([]int{1,2,3}) \/\/ []int\n}<\/code><\/pre>\n<ul>\n<li>\ud0c0\uc785 \ucd94\ucd9c<\/li>\n<\/ul>\n<p>\uc778\ud130\ud398\uc774\uc2a4\uc758 \uc2e4\uc81c\uac12\uc744 \ucd94\ucd9c\ud55c\ub2e4.<br \/>\n\ucd94\ucd9c\uc5d0 \uc2e4\ud328\ud558\uba74 \ub7f0\ud0c0\uc784 \uc624\ub958\uac00 \ubc1c\uc0dd\ud55c\ub2e4.<\/p>\n<pre><code class=\"language-go\">package main\n\nfunc main() {\n    var a interface{} = 1\n\n    i := a       \/\/ a\uc640 i\ub294 dynamic type\uc774\uace0 \uac12\uc740 1\n    j := a.(int) \/\/ j\ub294 int \ud0c0\uc785\uc774\uace0, \uac12\uc740 1\n\n    println(i) \/\/ \ud3ec\uc778\ud130 \uc8fc\uc18c \ucd9c\ub825\n    println(j) \/\/ 1 \ucd9c\ub825\n}<\/code><\/pre>\n<h3>16\uc7a5. \ud328\ud0a4\uc9c0\uc640 \ubaa8\ub4c8<\/h3>\n<ul>\n<li>\ud5e4\ub354 \ud30c\uc77c \uc5c6\ub294 \uc138\uc0c1<\/li>\n<\/ul>\n<p>go \uc5b8\uc5b4\ub294 \ud5e4\ub354 \ud30c\uc77c\uc744 \uc0ac\uc6a9\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">\/\/ math\/math.go\npackage math\n\nfunc Add(a, b int) int {\n    return a + b\n}\n\nfunc Subtract(a, b int) int {\n    return a - b\n}\n\n\/\/ main.go\npackage main\n\nimport &quot;example.com\/hello\/math&quot;\n\nfunc main() {\n    println(math.Add(5, 3))\n}\n\n\/\/ go.mod\nmodule example.com\/hello\n\ngo 1.21.5<\/code><\/pre>\n<ul>\n<li>\n<p>\ud328\ud0a4\uc9c0 \uad6c\uc870\ud654<\/p>\n<p>\ud558\ub098\uc758 \ub514\ub809\ud1a0\ub9ac = \ud558\ub098\uc758 \ud328\ud0a4\uc9c0<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">   myproject\/\n   \u251c\u2500\u2500 main.go          (package main)\n   \u251c\u2500\u2500 utils\/\n   \u2502   \u251c\u2500\u2500 string.go    (package utils)\n   \u2502   \u2514\u2500\u2500 number.go    (package utils)\n   \u2514\u2500\u2500 database\/\n       \u2514\u2500\u2500 db.go        (package database)<\/code><\/pre>\n<ul>\n<li>\uacf5\uac1c\/\ube44\uacf5\uac1c (\ub300\uc18c\ubb38\uc790 \uaddc\uce59)<\/li>\n<\/ul>\n<p>\uccab \uae00\uc790\uac00 \uc18c\ubb38\uc790\uc778 \uacbd\uc6b0, \ud328\ud0a4\uc9c0 \ub0b4\ubd80\uc5d0\uc11c\ub9cc \uc811\uadfc\uac00\ub2a5\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-go\">package calculator\n\n\/\/ \uacf5\uac1c (Exported) - \uccab \uae00\uc790 \ub300\ubb38\uc790\nfunc Add(a, b int) int {\n    return a + b\n}\n\n\/\/ \ube44\uacf5\uac1c (Unexported) - \uccab \uae00\uc790 \uc18c\ubb38\uc790\nfunc validate(n int) bool {\n    return n &gt;= 0\n}\n\n\/\/ \uacf5\uac1c \ubcc0\uc218\nvar MaxValue = 1000\n\n\/\/ \ube44\uacf5\uac1c \ubcc0\uc218\nvar threshold = 100\n\n\/\/ \uacf5\uac1c \ud0c0\uc785\ntype Calculator struct {\n    Name string    \/\/ \uacf5\uac1c \ud544\ub4dc\n    version int    \/\/ \ube44\uacf5\uac1c \ud544\ub4dc\n}\n\n\/\/ \ube44\uacf5\uac1c \ud0c0\uc785\ntype internalState struct {\n    count int\n}<\/code><\/pre>\n<ul>\n<li>\n<p>go modules\uc640 \uc758\uc874\uc131 \uad00\ub9ac<\/p>\n<p>C\uc758 Makefile\uc774\ub098 CMakeLists.txt \ub300\uc2e0, Go\ub294 go.mod \ud30c\uc77c\ub85c \uc758\uc874\uc131\uc744 \uad00\ub9ac\ud569\ub2c8\ub2e4.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">go mod init github.com\/username\/myproject<\/code><\/pre>\n<p>go.mod<\/p>\n<pre><code class=\"language-go\">module github.com\/username\/myproject\n\ngo 1.21\n\nrequire (\n    github.com\/gorilla\/mux v1.8.0\n    github.com\/lib\/pq v1.10.9\n)<\/code><\/pre>\n<h3>17\uc7a5. \ud14c\uc2a4\ud305<\/h3>\n<ul>\n<li>\n<p>\ub0b4\uc7a5\ub41c testing \ud328\ud0a4\uc9c0<\/p>\n<p>Go\ub294 \uac15\ub825\ud55c \ud14c\uc2a4\ud305 \ud504\ub808\uc784\uc6cc\ud06c\ub97c \ud45c\uc900 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub85c \uc81c\uacf5\ud569\ub2c8\ub2e4.<\/p>\n<p>\ud14c\uc2a4\ud2b8 \ud30c\uc77c\uc740 <code>_test.go<\/code> \uc811\ubbf8\uc0ac\ub97c \uac00\uc9d1\ub2c8\ub2e4<br \/>\n\ud14c\uc2a4\ud2b8 \ud568\uc218\ub294 Test\ub85c \uc2dc\uc791\ud558\uace0 <code>*testing.T<\/code> \ud30c\ub77c\ubbf8\ud130\ub97c \ubc1b\uc2b5\ub2c8\ub2e4<br \/>\n\ubcc4\ub3c4\uc758 main \ud568\uc218\ub098 \ud14c\uc2a4\ud2b8 \ub7ec\ub108\uac00 \ud544\uc694 \uc5c6\uc2b5\ub2c8\ub2e4<br \/>\n<code>go test<\/code> \uba85\ub839\uc5b4\ub85c \uc790\ub3d9\uc73c\ub85c \ubaa8\ub4e0 \ud14c\uc2a4\ud2b8\ub97c \ucc3e\uc544 \uc2e4\ud589\ud569\ub2c8\ub2e4<\/p>\n<\/li>\n<li>\n<p>\ub2e8\uc704 \ud14c\uc2a4\ud2b8 \uc791\uc131\ud558\uae30<\/p>\n<\/li>\n<\/ul>\n<p>test\\math.go<\/p>\n<pre><code class=\"language-go\">package test\n\nfunc Add(a, b int) int {\n    return a + b\n}\n\nfunc Multiply(a, b int) int {\n    return a * b\n}<\/code><\/pre>\n<p>test\\math_test.go<\/p>\n<pre><code class=\"language-go\">package test\n\nimport &quot;testing&quot;\n\nfunc TestAdd(t *testing.T) {\n    result := Add(2, 3)\n    expected := 5\n\n    if result != expected {\n        t.Errorf(&quot;Add(2, 3) = %d; expected %d&quot;, result, expected)\n    }\n}<\/code><\/pre>\n<h2>7\ubd80: C\uc640\uc758 \uc0c1\ud638\uc6b4\uc6a9<\/h2>\n<h3>18\uc7a5. Cgo<\/h3>\n<ul>\n<li>\n<p>Cgo\ub780 \ubb34\uc5c7\uc778\uac00<\/p>\n<p>Cgo\ub294 Go \ud504\ub85c\uadf8\ub7a8\uc5d0\uc11c C \ucf54\ub4dc\ub97c \ud638\ucd9c\ud558\uac70\ub098, \ubc18\ub300\ub85c C \ud504\ub85c\uadf8\ub7a8\uc5d0\uc11c Go \ucf54\ub4dc\ub97c \ud638\ucd9c\ud560 \uc218 \uc788\uac8c \ud574\uc8fc\ub294 \uae30\ub2a5\uc785\ub2c8\ub2e4.<\/p>\n<\/li>\n<li>\n<p>C \ucf54\ub4dc\ub97c Go\uc5d0\uc11c \ud638\ucd9c\ud558\uae30<\/p>\n<\/li>\n<\/ul>\n<p>C \ucf54\ub4dc \ud3ec\ud568<\/p>\n<p><strong>import &quot;C&quot; \uc55e\uc758 \uc8fc\uc11d\uacfc import \ubb38 \uc0ac\uc774\uc5d0 \ube48 \uc904\uc774 \uc788\uc73c\uba74 \uc548 \ub429\ub2c8\ub2e4.<\/strong><\/p>\n<p><a href=\"https:\/\/pkg.go.dev\/cmd\/cgo\">https:\/\/pkg.go.dev\/cmd\/cgo<\/a><\/p>\n<blockquote>\n<p>To use cgo write normal Go code that imports a pseudo-package &quot;C&quot;. The Go code can then refer to types such as C.size_t, variables such as C.stdout, or functions such as C.putchar.<br \/>\nIf the import of &quot;C&quot; is immediately preceded by a comment, that comment, called the preamble, is used as a header when compiling the C parts of the package. For example:<\/p>\n<\/blockquote>\n<pre><code class=\"language-go\">package main\n\n\/*\n#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\nvoid sayHello(const char* name) {\n    printf(&quot;Hello, %s from C!\\n&quot;, name);\n    fflush(stdout);\n}\n*\/\nimport &quot;C&quot;\nimport (\n    &quot;fmt&quot;\n    &quot;unsafe&quot;\n)\n\nfunc main() {\n    name := C.CString(&quot;Gopher&quot;)\n    defer C.free(unsafe.Pointer(name))\n\n    fmt.Println(&quot;Hello from GO!&quot;)\n    C.sayHello(name)\n}<\/code><\/pre>\n<p>\ub77c\uc774\ube0c\ub7ec\ub9ac \ud638\ucd9c<\/p>\n<p>calc.h<\/p>\n<pre><code class=\"language-go\">#ifndef CALC_H\n#define CALC_H\n\ndouble calc(double x, double y);\n\n#endif<\/code><\/pre>\n<p>calc.c<\/p>\n<pre><code class=\"language-go\">#include &lt;math.h&gt;\n\ndouble calc(double x, double y) {\n    return sqrt(x * x + y * y);\n}<\/code><\/pre>\n<p>main.go<\/p>\n<pre><code class=\"language-go\">package main\n\n\/*\n#cgo CFLAGS: -I.\n#cgo LDFLAGS: -lm\n#include &quot;calc.h&quot;\n*\/\nimport &quot;C&quot;\nimport &quot;fmt&quot;\n\nfunc main() {\n    result := C.calc(3.0, 4.0)\n    fmt.Printf(&quot;Distance: %.2f\\n&quot;, float64(result))\n}<\/code><\/pre>\n<h3>19\uc7a5. C \ucf54\ub4dc \ub9c8\uc774\uadf8\ub808\uc774\uc158<\/h3>\n<ul>\n<li>\ub9c8\uc774\uadf8\ub808\uc774\uc158 \uc804\ub7b5<\/li>\n<li>\uc77c\ubc18\uc801\uc778 \ubcc0\ud658 \ud328\ud134<\/li>\n<li>\uc8fc\uc758\ud560 \uc810\ub4e4<\/li>\n<li>\uc2e4\uc804 \uc608\uc81c<\/li>\n<\/ul>\n<h2>8\ubd80: \uace0\uae09 \uc8fc\uc81c<\/h2>\n<h3>20\uc7a5. \uc131\ub2a5 \ucd5c\uc801\ud654<\/h3>\n<ul>\n<li>\ud504\ub85c\ud30c\uc77c\ub9c1 \ub3c4\uad6c<\/li>\n<li>\ubca4\uce58\ub9c8\ud0b9 best practices<\/li>\n<li>\uba54\ubaa8\ub9ac \ucd5c\uc801\ud654<\/li>\n<li>\ucef4\ud30c\uc77c\ub7ec \ucd5c\uc801\ud654 \uc774\ud574\ud558\uae30<\/li>\n<\/ul>\n<h3>21\uc7a5. \ud45c\uc900 \ub77c\uc774\ube0c\ub7ec\ub9ac \ud65c\uc6a9<\/h3>\n<ul>\n<li>io \ud328\ud0a4\uc9c0<\/li>\n<li>fmt\uc640 printf\uc758 \ucc28\uc774<\/li>\n<li>net\/http (\uc6f9 \uc11c\ubc84 \ub9cc\ub4e4\uae30)<\/li>\n<li>encoding\/json<\/li>\n<li>flag \ud328\ud0a4\uc9c0 (\uba85\ub839\ud589 \uc778\uc790)<\/li>\n<\/ul>\n<h3>22\uc7a5. \uc2e4\uc804 \ud504\ub85c\uc81d\ud2b8<\/h3>\n<ul>\n<li>CLI \ub3c4\uad6c \ub9cc\ub4e4\uae30<\/li>\n<li>\uac04\ub2e8\ud55c \uc6f9 \uc11c\ubc84 \uad6c\ud604<\/li>\n<li>\uc2dc\uc2a4\ud15c \ud504\ub85c\uadf8\ub798\ubc0d \uc608\uc81c<\/li>\n<li>C \ud504\ub85c\uc81d\ud2b8\ub97c Go\ub85c \uc7ac\uc791\uc131\ud558\uae30<\/li>\n<\/ul>\n<h3>23\uc7a5. \uc81c\ub124\ub9ad(Generics)<\/h3>\n<pre><code class=\"language-go\">func Min[T int | float64](a, b T) T {\n    if a &lt; b {\n        return a\n    }\n    return b\n}\n\n\/\/ \uc0ac\uc6a9\nresult1 := Min[int](5, 3)           \/\/ 3\nresult2 := Min[float64](5.5, 3.2)   \/\/ 3.2\nresult3 := Min(5, 3)                \/\/ \ud0c0\uc785 \ucd94\ub860\uc73c\ub85c [int] \uc0dd\ub7b5 \uac00\ub2a5<\/code><\/pre>\n<p>\ucee4\uc2a4\ud140 \uc81c\uc57d \uc815\uc758<\/p>\n<pre><code class=\"language-go\">type Number interface {\n    int | int64 | float64 | float32\n}\n\nfunc Sum[T Number](numbers []T) T {\n    var sum T\n    for _, n := range numbers {\n        sum += n\n    }\n    return sum\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>C \uac1c\ubc1c\uc790\ub97c \uc704\ud55c Go \uc5b8\uc5b4 \uac15\uc88c 1\ubd80: \uc2dc\uc791\ud558\uae30 1\uc7a5. Go \uc5b8\uc5b4 \uc18c\uac1c C\uc640 Go\uc758 \ucca0\ud559\uc801 \ucc28\uc774 C\uc758 \ucca0\ud559: \ud504\ub85c\uadf8\ub798\uba38\uc5d0\uac8c \ucd5c\ub300\ud55c\uc758 \uc81c\uc5b4\uad8c\uc744 \uc900\ub2e4 \ud558\ub4dc\uc6e8\uc5b4\uc5d0 \uac00\uae5d\uac8c, \ucd5c\uc18c\ud55c\uc758 \ucd94\uc0c1\ud654 &quot;\ud504\ub85c\uadf8\ub798\uba38\uac00 \ubb34\uc5c7\uc744 \ud558\ub294\uc9c0 \uc548\ub2e4&quot;\uace0 \uac00\uc815 \uc791\uace0 \ub2e8\uc21c\ud55c \uc5b8\uc5b4 Go\uc758 \ucca0\ud559: \ub2e8\uc21c\uc131\uacfc \uac00\ub3c5\uc131\uc744 \ucd5c\uc6b0\uc120\uc73c\ub85c \ud55c \uac00\uc9c0 \uc77c\uc744 \ud558\ub294 \ud55c \uac00\uc9c0 \ubc29\ubc95 \uba85\ud655\ud568\uc774 \uc601\ub9ac\ud568\ubcf4\ub2e4 \ub0ab\ub2e4 \ud300 \ud611\uc5c5\uacfc \ub300\uaddc\ubaa8 \uc18c\ud504\ud2b8\uc6e8\uc5b4\uc5d0 \ucd5c\uc801\ud654 \ub0b4\uc7a5\ub41c\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=10904\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[],"class_list":["post-10904","post","type-post","status-publish","format-standard","hentry","category-language"],"_links":{"self":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10904"}],"version-history":[{"count":36,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10904\/revisions"}],"predecessor-version":[{"id":10947,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10904\/revisions\/10947"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}