Before starting GO check this

Lizen Shakya
3 min readJan 28, 2024
Go lang

Golang a relatively new programming language, is making quite a noise in the software development community.

Go is an open-source programming language developed by Google. It was created by Robert Griesemer, Rob Pike, and Ken Thompson and first released in 2009.

Go was designed with simplicity, efficiency, and ease of use in mind. It aims to combine the performance of low-level languages like C or C++ with the simplicity and productivity of high-level languages like Python or JavaScript.

Before starting go know this

  1. Statically typed:

Go is statically typed, providing better performance and catching errors at compile time rather than runtime. It means that the type of a variable is known at compile time. Once a variable is declared with a specific type, it cannot change its type during runtime.

var age int
var name string

2. Concurrency:

Go provides a set of features to make it easy to write concurrent programs, including goroutines, channels, and a select statement. Go has goroutines and channels to simplify concurrent programming. Goroutines are lightweight threads, and channels facilitate communication between goroutines.

func main() {
// Start a new goroutine
go printNumbers()

// Print numbers in the main goroutine

3. Package Declaration

In Go, a package declaration is used to define the name of the package to which the current Go source file belongs. The package name is declared at the top of each Go source file, and it helps in organizing and structuring the code.

package main

import "fmt"

func main() {
fmt.Println("Hello, Go!")

4. Pointers:

Pointers in Go are variables that store memory addresses. They allow you to create more efficient and flexible code by enabling direct manipulation of memory.

var x int
var ptr *int
ptr = &xgo
  • You declare a pointer using the * symbol followed by the type of the variable it will point to.
  • Use the & (address-of) operator to get the memory address of a variable.

5. Compiled language:

This means that Go source code is compiled into machine code or an intermediate code (such as bytecode) before execution. The resulting compiled binary can be executed on the target machine without the need for an interpreter or runtime environment.

To build go

go build yourprogram.go

6. Variable declaration:

In Go, var and const are keywords used for variable and constant declarations, respectively.

There is no let variable declaration.

var variableName type
const constantName = value

Go also provides the := shorthand for more concise variable declaration and initialization. The := operator infers the type of the variable from the assigned value.

 x := 10 

7. Struct:

Go has a struct type that allows you to define custom data types with named fields. This is similar to defining classes with fields in object-oriented languages.

type Person struct {
Name string
Age int

func main() {
p := Person{Name: "Alice", Age: 30}
fmt.Println(p.Name, p.Age)

8. Methods:

Go allows you to define methods on types, including user-defined types (structs). Methods provide a way to associate behavior with data

func (p *Person) sayHello() {
fmt.Println("Hello, my name is", p.Name)

func main() {
p := Person{Name: "Alice", Age: 30}

9. Garbage Collection:

Go has a garbage collector that automatically manages memory, eliminating the need for manual memory management.

10.Built-in Testing Support:

Go has a testing package built into the language, making it easy to write and run tests for your code.

package mypackage

import (

func TestAddition(t *testing.T) {
result := Add(2, 3)
expected := 5

if result != expected {
t.Errorf("Expected %d, but got %d", expected, result)

11. Dependencies and Go Modules:

Go introduced a module system to manage dependencies, and it is often used in conjunction with Git. Go modules allow developers to specify dependencies, including the version control system (such as Git) and the repository URL. Go modules make it easy to manage and version dependencies within a Go project.

These are some of the things to know before starting Golang. There might be many more to add on these. Please feel free to add more on this.

// main.go
package main

import (
"" // Example external dependency

func main() {
fmt.Println("Hello, Go Modules!")

r := gin.Default()
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "Hello, Gin!",


Thank you 🙏 😊