<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: RS</title>
    <description>The latest articles on DEV Community by RS (@rs9000).</description>
    <link>https://dev.to/rs9000</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3690029%2F7e3ad136-3677-4dbd-80bf-0b0cdcb5fae1.png</url>
      <title>DEV Community: RS</title>
      <link>https://dev.to/rs9000</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rs9000"/>
    <language>en</language>
    <item>
      <title>Complete Go Starter Guide: Setup, Syntax &amp; First Program</title>
      <dc:creator>RS</dc:creator>
      <pubDate>Wed, 14 Jan 2026 21:13:12 +0000</pubDate>
      <link>https://dev.to/rs9000/complete-go-starter-guide-setup-syntax-first-program-3c4p</link>
      <guid>https://dev.to/rs9000/complete-go-starter-guide-setup-syntax-first-program-3c4p</guid>
      <description>&lt;p&gt;Have you ever felt like you want to code and learn a new programming language, but there are so many languages to choose from: Java, Python, Rust, Go? I researched, and Go caught my interest, as highlighted by the JetBrains report &lt;a href="https://www.jetbrains.com/lp/devecosystem-data-playground/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Go was used by approximately 4.8 million users. Many companies have widely accepted Go for backend development and libraries due to its high performance. There are many advantages of Go, which we will cover in future articles. A bit of background on Go is that it was created at Google, and its first public release was in 2009. Go was created to address issues with large-scale systems at Google, such as slow compilation, complexity, and poor concurrency support. C++ and Java do solve some issues, but the learning curve is much steeper than with developer-friendly, readable languages like Python. The focus was on creating a simple language that would inherit many advantages of languages like C++. By the end of this article, we will have Go installed and will have written our first program.&lt;/p&gt;




&lt;h1&gt;
  
  
  Installation &amp;amp; Verification
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Step 1: Download &amp;amp; install
&lt;/h2&gt;

&lt;p&gt;Head to &lt;a href="https://go.dev/dl/" rel="noopener noreferrer"&gt;https://go.dev/dl/&lt;/a&gt; and grab the installer for your OS. Double-click and install once downloaded. The installer will set up Go and configure essential paths. There are multiple ways to get Go; you can use package managers like Homebrew for macOS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Verify Installation
&lt;/h2&gt;

&lt;p&gt;Run the following command in your terminal (bash or command prompt):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go version
&amp;gt;&amp;gt;&amp;gt; go version go1.25.5 darwin/arm64

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see output like go1.21.5. This confirms that Go is installed and ready to use.&lt;/p&gt;




&lt;h1&gt;
  
  
  What Are Go Modules?
&lt;/h1&gt;

&lt;p&gt;A Go module is a collection of Go files that includes a go.mod file. This file tracks your project’s name and its dependencies. Previously, this was done via a special workspace (GOPATH), but we don’t need that anymore.&lt;/p&gt;

&lt;p&gt;Let’s create one: Open your terminal and run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir my-go-app
cd my-go-app
# go mod init &amp;lt;the-go-module-name-you-like&amp;gt;
go mod init my-first-go-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command creates a go.mod file. This is now the root of your Go project. All the code and commands will run relative to this folder going forward.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft7aukj1lc5tel5drodql.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft7aukj1lc5tel5drodql.png" alt="Go mod init" width="550" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fecr8az4g8larg6u7dl0s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fecr8az4g8larg6u7dl0s.png" alt="Directory" width="800" height="119"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Nostalgic “Hello, World!”
&lt;/h1&gt;

&lt;p&gt;Inside the folder, create a file named main.go. Open it, add all the following code, and save the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main // Every executable program starts with package main

import "fmt" 
// Unlike Python, where methods like print, round are readily available
// in Go functions are always in a package, and we need fmt to use print text.

func main(){ // The main function is where the program begins
 fmt.Println("Hello, World!") // This line prints the text
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Running &amp;amp; Building: go run vs go build
&lt;/h1&gt;

&lt;h2&gt;
  
  
  go run — For Quick Testing
&lt;/h2&gt;

&lt;p&gt;Why we use it: To quickly check if your code works or not; no extra files are created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go run main.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpsmob9odv11xkzokpg9r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpsmob9odv11xkzokpg9r.png" alt="Go Run Command" width="376" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  go build — To Create an Executable
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The command will compile your code and create a standalone binary file, which you can share and run anytime, even without having Go installed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After execution, you will see an executable created in the folder, which you can run and share.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Why we use it: If we want to distribute a program or run it later.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;go build main.go&lt;/code&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Current Project Layout
&lt;/h1&gt;

&lt;p&gt;You can execute the following command to see what the project looks like. You can add more .go files and play around.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -la # use `dir` for Windows

go-app/
├── go.mod       # Your module definition file
├── main.go      # Your source code
└── main.exe     # Your compiled program (if you built it)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Variables and Basic Types
&lt;/h1&gt;

&lt;p&gt;Variables are containers used for storing data. Go is a statically-typed language, which means you must define the type of data that the variable will hold.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Types
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;string: Text (e.g., “Hello”)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;int: Whole number (e.g., 10, -10)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;float64: Decimal numbers (e.g., 3.14)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;bool: True or False&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Three Ways to Declare Variables
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Full Declaration (Verbose) — Declare the variable name, type, and optionally assign a value
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var name string = "Tom Cruise"
var age int
age = 25
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Type Inference (Shorter) — Go will figure out the type based on the value assigned.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var name = "Tom" // Go will figure out it's a string
var age = 30
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Short Declaration (Mostly Inside Functions) — Use the := operator. It declares and initialises the variable in a single step.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import "fmt"

func main(){
    name := "Tom"   // String
    age := 25       // Integer
    isActor := true // Boolean
    height := 5.5   // Float64

    fmt.Println(name, age, isActor, height)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Putting it All Together
&lt;/h1&gt;

&lt;p&gt;Here’s a sample main.go with all these concepts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import "fmt"

func main(){
    var name string = "Tom"  // Full Declaration
    var age = 25            // Type Inference
    isActor := true        // Short Declaration (inside main function)
    height := 5.5 // Float64

    fmt.Println(name, age, isActor, height) // using variables

    age = 26 // changing variable
    fmt.Println(name, age, isActor, height) // using variables
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  What’s Next?
&lt;/h1&gt;

&lt;p&gt;We have installed Go, created a project with a module, run our first program, and learned about basic data types and variables.&lt;/p&gt;

&lt;p&gt;What you can do:&lt;/p&gt;

&lt;p&gt;Try playing with the main.go file.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Change the message in the print statement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create new variables and try storing new values in them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create an int variable and try storing a string in it. Comment on what happens below 🙂&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use go build to create an executable and send it to someone, and ask them to execute it.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In subsequent articles, we will learn more about the syntax, including conditionals and loops.&lt;/p&gt;

&lt;p&gt;If you are stuck or have any questions, drop a comment with the output, and I will try my best to answer them all.&lt;/p&gt;

</description>
      <category>go</category>
      <category>backend</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
