[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-692237-105":3,"doc-detail-692237-en":81,"detail-sidebar-cat-0-en-105":106,"doc-similar-692237":154},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","guide-to-golang","Guide to Golang","","A quick, practical walkthrough of the Go programming language, designed to support coursework and assignments. Covers setting up the Go development environment, initializing projects with modules, adding external packages, and common module maintenance commands. Explains building, running, and installing Go programs, then details core project structure (cmd, pkg, internal) and the fundamentals of writing a simple Hello World application. Introduces key concepts like packages, imports, printing, basic types, and variable and function declarations.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/guide-to-golang/692237/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/guide-to-golang/692237.png","ImageObject",300,407,{"name":42,"@type":43},"noah","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-19","2026-11-09",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",13,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"How do you verify the Go development environment is installed?","Question",{"text":63,"@type":64},"Run go version in the terminal within your development environment to see the installed Go version.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"What commands are commonly used to build, run, and install Go programs?",{"text":68,"@type":64},"Use go build to create an executable, go run to run a main package, and go install to build a main package and link it to your $PATH.",{"name":70,"@type":61,"acceptedAnswer":71},"How should a typical Go project be structured?",{"text":72,"@type":64},"A project commonly has a go.mod at the root, with top-level directories such as cmd for entrypoints and pkg for reusable packages; internal is for private packages.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},692237,1794186693,{"code":4,"msg":82,"data":83},"success",{"doc_id":79,"user_id":84,"nickname":42,"user_avatar":85,"doc_module":4,"category_id":86,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":87,"file_id":88,"file_url":89,"file_type":90,"file_size":91,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":55,"language":92,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":93,"faqs":94,"seo_title":95,"seo_description":12,"update_tm":80,"read_time":96,"preview_page_count":26,"preview_urls":97},1099529839121,"https://ap-avatar.wpscdn.com/davatar_994ba38a5ba835b3df7d355c54d3ed8d",6,"Guide to Golang  \nThis is a quick whirlwind tour of the Go programming language! Please feel free to use this as reference for your assignments. We highly recommend starting with A Tour of Go to get through the basics quickly and interactively; however, this guide will seek to be as comprehensive as possible. For other resources to learn Go, check out:  \n●  Go by Example  \nSetup  \nTo get started with Go, ﬁrst ensure that you have the dev-environment  \nproperly installed by running go version in the terminal in your dev-environment. You should see the version of Go 1.23.0.  \nTo set up a project, navigate to your folder and run go mod init \u003Cmod_name> . Your GitHub setup generally determines the module name. If your GitHub username is jswaggin and your repository name is dinodb, you should run go mod init [github.com/jswaggin/dinodb](github.com/jswaggin/dinodb. This creates a Go module)[. This creates a](github.com/jswaggin/dinodb. This creates a Go module)[ Go module](github.com/jswaggin/dinodb. This creates a Go module), a virtual environment complete with a package system. Most Go projects should be ina Go module.  \nYou can import external packages into your module for use in your code. Running go get \u003Cpkg> will add the package to your go.mod ﬁle and create a checksum ﬁle, go .sum. Then the package will then be accessible to your code. Try it out on [github.com/couchbase/vellum](github.com/couchbase/vellum)!  \nSome useful commands:  \n● go mod tidy cleans up your packages and downloads newly added packages.  \n● go clean -modcache removes cached packages.  \nBuilding and Running  \nNow that you've installed and initialized a Go project, it's time to learn how to run it!  \n● go build \u003Cdir> will build a main package into a runnable executable.  \n● go run \u003Cfile.go> will run a particular main package.  \n● go install \u003Cdir> will build a main package and link it to your $PATH, so it is callable from your entire machine.  \nWe' ll explain what a main package is in the next section. In this class, building, and running are handled by our Makeﬁle. We typically build the package into an executable to avoid creating too many binaries in your $PATH.  \nProject Structure  \nThe basic structure of every Go project is about the same. Your root directory will be your go.mod ﬁle alongside any other conﬁguration ﬁles or build scripts, like a Makeﬁle or README. There will be two or three top-level directories: cmd and pkg, and potentially internal.  \ncmd is where your project's primary entrypoint(s) will live, separated into subfolders containing a main package. Each main package is an entrypoint to your application and can be compiled into an executable. Let's say you had a ﬁle: cmd/db/main.go-running go build ./cmd/db would create an executable./db that would run the code inside the associated main.go ﬁle. Similarly, go run ./cmd/db/main.go would run the package. ·  \npkg is where your project's packages live. A package is a collection of related Go ﬁles, typically implementing a single piece of logic. To use a package in your binaries, you have to import them using the module name you deﬁned above ( more on this later) . Packages are self-contained, and everything capitalized will be exported from the package (e.g. func Sample() is exported, func secret() is not) . The main package is specially designed to be compiled into a binary. You can have multiple main packages, each in a subfolder in the cmd directory (detailed above) .  \ninternal is where private packages live; the compiler guarantees privacy, and code here can't be imported outside the module. In this course, we don't use the internal folder.  \nHello, World!  \nThe following is a classic \" Hello World\" program:  \npackage main import \"fmt\"  \nfunc main() {  \nfmt.Println(\"Hello, world!\")}  \nThe ﬁrst line of every Go ﬁle must be the package it belongs in; in this case, main. Next are the packages that are imported using the import keyword. You can (and should) import multiple packages, both from ","cbCaivmqsBRYKMQg","https://ap.wps.com/l/cbCaivmqsBRYKMQg","pdf",298168,"English","# Setup\n## Go environment check\n## Initialize modules with go mod init\n## Install packages with go get\n# Building and Running\n## go build\n## go run\n## go install\n# Project Structure\n## cmd\n## pkg\n## internal\n# Hello, World!\n# Printing with fmt\n# Types\n# Variables\n# Functions","[{\"question\":\"How do you verify the Go development environment is installed?\",\"answer\":\"Run go version in the terminal within your development environment to see the installed Go version.\"},{\"question\":\"What commands are commonly used to build, run, and install Go programs?\",\"answer\":\"Use go build to create an executable, go run to run a main package, and go install to build a main package and link it to your $PATH.\"},{\"question\":\"How should a typical Go project be structured?\",\"answer\":\"A project commonly has a go.mod at the root, with top-level directories such as cmd for entrypoints and pkg for reusable packages; internal is for private packages.\"}]","Guide to Golang | PDF",33,[98,102],{"page_no":22,"url":99,"width":100,"height":101},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/d3c720dd28c06aad3b8181dddd187057.webp",983,1272,{"page_no":26,"url":103,"width":104,"height":105},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/fc8e186760c429963c3747a88cf80ecf.webp",982,1270,{"code":4,"msg":82,"data":107},[108,112,116,120,125,128,133,138,143,146,150],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":109,"show_sort_weight":110,"slug":111},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":113,"show_sort_weight":114,"slug":115},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":117,"show_sort_weight":118,"slug":119},"Exam",70,"exam",{"id":121,"doc_module":4,"doc_module_name":25,"category_name":122,"show_sort_weight":123,"slug":124},5,"Comic",60,"comic",{"id":86,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":126,"slug":127},50,"technology",{"id":129,"doc_module":4,"doc_module_name":25,"category_name":130,"show_sort_weight":131,"slug":132},7,"Healthcare",40,"healthcare",{"id":134,"doc_module":4,"doc_module_name":25,"category_name":135,"show_sort_weight":136,"slug":137},8,"Research & Report",30,"research-report",{"id":139,"doc_module":4,"doc_module_name":25,"category_name":140,"show_sort_weight":141,"slug":142},9,"Religion & Spirituality",20,"religion-spirituality",{"id":141,"doc_module":4,"doc_module_name":25,"category_name":144,"show_sort_weight":141,"slug":145},"World Cup","world-cup",{"id":147,"doc_module":4,"doc_module_name":25,"category_name":148,"show_sort_weight":147,"slug":149},10,"Lifestyle","lifestyle",{"id":151,"doc_module":4,"doc_module_name":25,"category_name":152,"show_sort_weight":121,"slug":153},19,"General","general",{"list":155,"token":11},[156,163,169,175,181,187,193,199,206,212],{"doc_id":157,"doc_title":158,"file_type":90,"home_preview_img_url":159,"slug":160,"view_count":161,"category_name":29,"create_tm":162},399118,"R Guide - Technical Setup - Get Up and Running","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229919341006/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=MwYnlgs8lmI8nqZh95xwwEdctss%3D","r-guide-technical-setup-get-up-and-running",15,1790493026,{"doc_id":164,"doc_title":165,"file_type":90,"home_preview_img_url":166,"slug":167,"view_count":121,"category_name":29,"create_tm":168},692307,"The Essential Guide to the Node Package Manager - read online","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003199969/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=cGkoagZ5LWBZLCVxbj9Hb%2FXPfWw%3D","the-essential-guide-to-the-node-package-manager-read-online",1794192935,{"doc_id":170,"doc_title":171,"file_type":90,"home_preview_img_url":172,"slug":173,"view_count":30,"category_name":29,"create_tm":174},680170,"The Comprehensive LATEX Symbol List - Symbols and commands reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229997720321/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=FJ1JcRV2YGSchTuwVgYznSjQmdk%3D","the-comprehensive-latex-symbol-list-symbols-and-commands-reference",1793914376,{"doc_id":176,"doc_title":177,"file_type":90,"home_preview_img_url":178,"slug":179,"view_count":33,"category_name":29,"create_tm":180},700988,"Java Code Conventions - 1997-09-12 - Copyright and code style guidelines","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230012045653/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=85reeWIoqv6iZoayxE%2F0KHvwJEI%3D","java-code-conventions-1997-09-12-copyright-and-code-style-guidelines",1794522632,{"doc_id":182,"doc_title":183,"file_type":90,"home_preview_img_url":184,"slug":185,"view_count":121,"category_name":29,"create_tm":186},692309,"npm Cheatsheet - Quick npm Command Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230002737519/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=JuKUZRuNlTSPy%2B%2FQs2N8XJl2024%3D","npm-cheatsheet-quick-npm-command-reference",1794192940,{"doc_id":188,"doc_title":189,"file_type":90,"home_preview_img_url":190,"slug":191,"view_count":22,"category_name":29,"create_tm":192},760091,"Git - A Practical, Beginner-Friendly Guide to Version Control - From Your First Commit to Branching, Merging & GitHub","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230044495447/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=CkAAnsjqjMbt2zLy042G%2Bf1i6JI%3D","git-a-practical-beginner-friendly-guide-to-version-control-from-your-first-commit-to-branching-merging-github",1795898473,{"doc_id":194,"doc_title":195,"file_type":90,"home_preview_img_url":196,"slug":197,"view_count":121,"category_name":29,"create_tm":198},687542,"Eclipse Shortcuts - Keyboard Shortcuts","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001262166/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=8DUTnX%2FlkxN7Jy9oLMHh5yH4Lq4%3D","eclipse-shortcuts-keyboard-shortcuts",1794084048,{"doc_id":200,"doc_title":201,"file_type":90,"home_preview_img_url":202,"slug":203,"view_count":204,"category_name":29,"create_tm":205},671794,"Python Tutorial - Release 3.7.0","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988403939/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=bYbKo7GYytRGGmL5B0ajNr09Ue8%3D","python-tutorial-release-370",16,1793580648,{"doc_id":207,"doc_title":208,"file_type":90,"home_preview_img_url":209,"slug":210,"view_count":121,"category_name":29,"create_tm":211},693089,"Tutorial 4 - Introduction to AWS Lambda with the Serverless Application Analytics Framework (SAAF)","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230005085127/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=oNAaY990F5Ys575apReTM01zaAI%3D","tutorial-4-introduction-to-aws-lambda-with-the-serverless-application-analytics-framework-saaf",1794249655,{"doc_id":213,"doc_title":214,"file_type":90,"home_preview_img_url":215,"slug":216,"view_count":22,"category_name":29,"create_tm":217},759798,"Node.js Notes for Professionals","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230044485017/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=0dS3oFn2dS8mDtlKqoLfyX1XevE%3D","nodejs-notes-for-professionals",1795895079]