[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"article-golang-basics-for-beginners-2026-en":3,"article-related-golang-basics-for-beginners-2026-en":29,"series-tools-60582080-6e78-42fc-87e5-85c2c5d1655e":76},{"id":4,"slug":5,"title":6,"content":7,"summary":8,"source":9,"source_url":10,"author":11,"image_url":12,"cover_image":12,"category":13,"language":14,"translated_content":11,"related_article_id":15,"keywords":16,"key_takeaways":22,"views":26,"created_at":27,"published_at":28,"topic_cluster_id":11},"60582080-6e78-42fc-87e5-85c2c5d1655e","golang-basics-for-beginners-2026-en","Golang basics for beginners in 2026","\u003Cp>How do I start learning Golang as a beginner?\u003C\u002Fp>\u003Cp data-speakable=\"summary\">This guide gets you from Go install to a working module with tests.\u003C\u002Fp>\u003Ch2>Before you start\u003C\u002Fh2>\u003Cul>\u003Cli>Go 1.22+ installed from the official \u003Ca href=\"https:\u002F\u002Fgo.dev\u002Fdoc\u002Finstall\">Go installation docs\u003C\u002Fa>.\u003C\u002Fli>\u003Cli>A code editor such as VS Code with the Go extension.\u003C\u002Fli>\u003Cli>A terminal on macOS, Linux, or Windows.\u003C\u002Fli>\u003Cli>A GitHub account if you plan to publish code.\u003C\u002Fli>\u003Cli>Basic command-line comfort: cd, mkdir, and running commands.\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>Step 1: Install the Go toolchain\u003C\u002Fh2>\u003Cp>Your first outcome is a working Go environment that can compile and run programs locally. Use the official installer so your PATH and GOROOT setup match the current release. If you want the source project, start from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fgolang\u002Fgo\">Go GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003Cfigure class=\"my-6\">\u003Cimg src=\"https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1785976359754-atcf.png\" alt=\"Golang basics for beginners in 2026\" class=\"rounded-xl w-full\" loading=\"lazy\" \u002F>\u003C\u002Ffigure>\n\u003Cpre>\u003Ccode>go version\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>You should see a version string such as \u003Ccode>go version go1.22.x\u003C\u002Fcode>. If the command is not found, reopen your terminal and verify that Go is on your PATH.\u003C\u002Fp>\u003Ch2>Step 2: Create your first Go file\u003C\u002Fh2>\u003Cp>Your next outcome is a tiny program that prints text to the terminal. Create a new folder, add a file named \u003Ccode>main.go\u003C\u002Fcode>, and place a minimal \u003Ccode>main\u003C\u002Fcode> package inside it.\u003C\u002Fp>\n\u003Cfigure class=\"my-6\">\u003Cimg src=\"https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1785976356822-8861.png\" alt=\"Golang basics for beginners in 2026\" class=\"rounded-xl w-full\" loading=\"lazy\" \u002F>\u003C\u002Ffigure>\n\u003Cpre>\u003Ccode>package main\n\nimport \"fmt\"\n\nfunc main() {\n    fmt.Println(\"Hello, Go\")\n}\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Run it with \u003Ccode>go run main.go\u003C\u002Fcode>. You should see \u003Ccode>Hello, Go\u003C\u002Fcode> in the terminal, which confirms that your compiler and standard library are working.\u003C\u002Fp>\u003Ch2>Step 3: Initialize a Go module\u003C\u002Fh2>\u003Cp>Your third outcome is a project that Go can manage with versioned dependencies and repeatable builds. From the project folder, initialize a module name that matches your repo or local package path.\u003C\u002Fp>\u003Cpre>\u003Ccode>go mod init example.com\u002Fhello-go\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>After that, you should see a new \u003Ccode>go.mod\u003C\u002Fcode> file. Run \u003Ccode>go mod tidy\u003C\u002Fcode> if you add imports later; for now, the verification is simply that the module file exists and Go recognizes the folder as a module root.\u003C\u002Fp>\u003Ch2>Step 4: Add a function and test\u003C\u002Fh2>\u003Cp>Your fourth outcome is a reusable function with an automated test. This step shows the basic Go workflow: write code, write a test, and let the toolchain prove that behavior stays correct.\u003C\u002Fp>\u003Cpre>\u003Ccode>package main\n\nfunc greet(name string) string {\n    if name == \"\" {\n        return \"Hello, Go\"\n    }\n    return \"Hello, \" + name\n}\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Create a \u003Ccode>main_test.go\u003C\u002Fcode> file and run \u003Ccode>go test\u003C\u002Fcode>. You should see \u003Ccode>ok\u003C\u002Fcode> for your module, which confirms your function behaves as expected.\u003C\u002Fp>\u003Ch2>Step 5: Build a runnable binary\u003C\u002Fh2>\u003Cp>Your final outcome is a compiled executable you can ship or share. Build the program with the Go toolchain so you can confirm the output binary is created and ready to run.\u003C\u002Fp>\u003Cpre>\u003Ccode>go build -o hello-go\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>You should see a new binary named \u003Ccode>hello-go\u003C\u002Fcode> in the current directory. On Unix-like systems, run it with \u003Ccode>.\u002Fhello-go\u003C\u002Fcode>; on Windows, run \u003Ccode>hello-go.exe\u003C\u002Fcode>. The expected result is the same greeting you saw with \u003Ccode>go run\u003C\u002Fcode>.\u003C\u002Fp>\u003Ch2>Common mistakes\u003C\u002Fh2>\u003Cul>\u003Cli>Using an outdated Go version. Fix: install Go 1.22+ and recheck \u003Ccode>go version\u003C\u002Fcode>.\u003C\u002Fli>\u003Cli>Forgetting \u003Ccode>package main\u003C\u002Fcode> or \u003Ccode>func main()\u003C\u002Fcode>. Fix: add both so the file can run as an entry point.\u003C\u002Fli>\u003Cli>Running commands outside the module folder. Fix: change into the directory that contains \u003Ccode>go.mod\u003C\u002Fcode> before you build or test.\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>What's next\u003C\u002Fh2>\u003Cp>Once this works, move on to structs, interfaces, slices, error handling, and HTTP servers, then publish your code to \u003Ca href=\"\u002Ftag\u002Fgithub\">GitHub\u003C\u002Fa> and build a small CLI or web \u003Ca href=\"\u002Ftag\u002Fapi\">API\u003C\u002Fa> as your next practice project.\u003C\u002Fp>","Set up Go, write your first program, and build a small module with tests.","www.igmguru.com","https:\u002F\u002Fwww.igmguru.com\u002Fblog\u002Fgolang-tutorial",null,"https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1785976359754-atcf.png","tools","en","a08d7243-ccc3-4ac7-8e68-12d17699f934",[17,18,19,20,21],"Go","Golang","go.mod","testing","CLI",[23,24,25],"Install Go 1.22+ and verify the toolchain with go version.","Create a first program, then turn it into a module.","Use go test and go build to confirm your code works and ships as a binary.",1,"2026-08-06T00:32:16.673622+00:00","2026-08-06T00:32:16.653+00:00",{"tags":30,"relatedLang":35,"relatedPosts":39},[31,33],{"name":17,"slug":32},"go",{"name":21,"slug":34},"cli",{"id":15,"slug":36,"title":37,"language":38},"golang-basics-for-beginners-2026-zh","Golang 入門實作：安裝到測試通過","zh",[40,46,52,58,64,70],{"id":41,"slug":42,"title":43,"cover_image":44,"image_url":44,"created_at":45,"category":13},"e522fdf6-aaa1-46b3-87dd-1dfd46a89e6c","harness-agent-coding-steadier-loop-en","Harness turns agent coding into a steadier loop","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1786043023625-ye2m.png","2026-08-06T19:03:18.986388+00:00",{"id":47,"slug":48,"title":49,"cover_image":50,"image_url":50,"created_at":51,"category":13},"c21b1af8-9be1-43e4-892d-8a4f9ab8c16b","source-2-swaps-bsp-for-meshes-and-octrees-en","Source 2 swaps BSP for meshes and octrees","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1785978184152-le0e.png","2026-08-06T01:02:44.396782+00:00",{"id":53,"slug":54,"title":55,"cover_image":56,"image_url":56,"created_at":57,"category":13},"422265fa-3472-489b-a791-af1622f7461b","run-linux-containers-on-wsl-with-wslc-en","Run Linux containers on WSL with wslc","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1785933173005-9jnb.png","2026-08-05T12:32:28.209285+00:00",{"id":59,"slug":60,"title":61,"cover_image":62,"image_url":62,"created_at":63,"category":13},"90a9e12a-c375-4082-b7f7-9c2f56f4b803","claim-alibaba-cloud-free-trial-ecs-credits-en","Claim Alibaba Cloud Free Trial Credits on ECS","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1785846783510-ed2x.png","2026-08-04T12:32:35.510907+00:00",{"id":65,"slug":66,"title":67,"cover_image":68,"image_url":68,"created_at":69,"category":13},"9d41f638-ce04-4c38-8791-b1bf0136ac61","deepseek-v4-flash-turns-agent-work-cheap-en","DeepSeek V4 Flash turns Agent work cheap","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1785785622118-cv0b.png","2026-08-03T19:33:16.512658+00:00",{"id":71,"slug":72,"title":73,"cover_image":74,"image_url":74,"created_at":75,"category":13},"f7b3e715-3846-4073-a11a-724cee335a56","gpt-56-sol-cuts-gpu-costs-20-en","GPT-5.6 Sol cuts GPU costs 20%","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1785780227547-t9b5.png","2026-08-03T18:03:17.835161+00:00",[77,82,87,92,97,102,107,112,117,122],{"id":78,"slug":79,"title":80,"created_at":81},"8008f1a9-7a00-4bad-88c9-3eedc9c6b4b1","surepath-ai-mcp-policy-controls-en","SurePath AI's New MCP Policy Controls Enhance AI Security","2026-03-26T01:26:52.222015+00:00",{"id":83,"slug":84,"title":85,"created_at":86},"27e39a8f-b65d-4f7b-a875-859e2b210156","mcp-standard-ai-tools-2026-en","MCP Standard in 2026: Integrating AI Tools","2026-03-26T01:27:43.127519+00:00",{"id":88,"slug":89,"title":90,"created_at":91},"165f9a19-c92d-46ba-b3f0-7125f662921d","rag-2026-transforming-enterprise-ai-en","How RAG in 2026 is Transforming Enterprise AI","2026-03-26T01:28:11.485236+00:00",{"id":93,"slug":94,"title":95,"created_at":96},"6a2a8e6e-b956-49d8-be12-cc47bdc132b2","mastering-ai-prompts-2026-guide-en","Mastering AI Prompts: A 2026 Guide for Developers","2026-03-26T01:29:07.835148+00:00",{"id":98,"slug":99,"title":100,"created_at":101},"3ab2c67e-4664-4c67-a013-687a2f605814","garry-tan-open-sources-claude-code-toolkit-en","Garry Tan Open-Sources a Claude Code Toolkit","2026-03-26T08:26:20.245934+00:00",{"id":103,"slug":104,"title":105,"created_at":106},"66a7cbf8-7e76-41d4-9bbf-eaca9761bf69","github-ai-projects-to-watch-in-2026-en","20 GitHub AI Projects to Watch in 2026","2026-03-26T08:28:09.752027+00:00",{"id":108,"slug":109,"title":110,"created_at":111},"9f332fda-eace-448a-a292-2283951eee71","practical-github-guide-learning-ml-2026-en","A Practical GitHub Guide to Learning ML in 2026","2026-03-27T01:16:50.125678+00:00",{"id":113,"slug":114,"title":115,"created_at":116},"1b1f637d-0f4d-42bd-974b-07b53829144d","aiml-2026-student-ai-ml-lab-repo-review-en","AIML-2026 Is a Bare-Bones Student Lab Repo","2026-03-27T01:21:51.661231+00:00",{"id":118,"slug":119,"title":120,"created_at":121},"6d1bf3f6-e191-4d30-b55b-8a0722fa6afe","ai-trending-github-repos-and-research-feeds-en","AI Trending Tracks Repos and Research Feeds","2026-03-27T01:31:35.709532+00:00",{"id":123,"slug":124,"title":125,"created_at":126},"010539a1-4c3a-4bd3-937a-26616422ee0d","awesome-ai-for-science-research-tools-map-en","Awesome AI for Science Is Becoming a Real Research Map","2026-03-27T01:46:50.89513+00:00"]