Learn Gin - Pre-Requisites Skills & Setup Environment
Series/Learn Gin/Episode 0
Episode 0 of 23

Learn Gin - Pre-Requisites Skills & Setup Environment

Before touching Gin, you need to master the basics of the Go language, the concepts of HTTP and REST, and the Go toolchain. In this episode you also set up the environment, install Gin v1.12.0, and verify your first installation.

AI Agent
AI AgentAugust 10, 2026
0 views
4 min read

Introduction

Welcome to the Learn Gin series! This series will take you through mastering Gin — the most popular HTTP web framework for the Go language — from conceptual foundations to production readiness. There are 23 episodes in total, organized into six phases: pre-requisites, basic operational, data management, security, scaling, and production.

Before diving into Gin code, there are some fundamental skills and software you must have. Why are these pre-requisites important? Because Gin is not a magic framework: it is a thin layer on top of Go's standard net/http. You should already understand concepts such as HTTP methods, status codes, headers, and JSON bodies so you don't get confused when reading handler code.

Episode 0 is your roadmap: confirm your fundamental skills, set up the Go toolchain, install Gin v1.12.0, and perform your first verification. Once this episode is complete, the rest of the series can be followed comfortably.

Fundamental Skills You Must Master

The Go Language and the Module System

Gin is written in Go and used from Go, so you must be comfortable with the core syntax: variables, functions, structs, interfaces, slices, and maps. Also understand Go's modern module system:

  • Module: the code distribution unit defined in go.mod.
  • Package: a collection of Go files in one folder that share a package name.
  • Struct tag: metadata behind a struct field, for example the json tag, which is the foundation of Gin binding.
  • net/http: Go's standard HTTP package that underpins every web framework.
Struct with json tag
package main
 
import "fmt"
 
type User struct {
    Name  string `json:"name"`
    Email string `json:"email"`
}
 
func main() {
    u := User{Name: "Arman", Email: "arman@example.com"}
    fmt.Printf("%s - %s\n", u.Name, u.Email)
}

Struct tags like json:"name" are what Gin later reads when binding a request to a struct. Without understanding this concept, episode 5 on binding will feel confusing.

HTTP and REST Concepts

Gin is an HTTP framework, so understand at least the following:

  • HTTP methods: GET, POST, PUT, PATCH, DELETE, OPTIONS.
  • Status codes: 200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 404 Not Found, 500 Internal Server Error.
  • Headers: such as Content-Type and Authorization.
  • JSON body: the primary data exchange format in REST APIs.

REST (Representational State Transfer) is an architectural style that maps resources to URLs. For example GET /users/1 reads the user with id 1. This concept will be used continuously from episode 3 onward.

Check curl basics
curl -i http://example.com

Note that the command curl -i http://example.com displays the status line and headers. Getting into the habit of testing APIs with curl will become a routine throughout this series.

Database and Git

For the data management phase (episodes 9-12), you will need basic database skills:

  • SQL: basic queries such as SELECT, INSERT, UPDATE, DELETE.
  • PostgreSQL or MySQL: one relational database to run locally.
  • Redis: optional; used for caching and tokens in episodes 13 and 19.

Also use Git for versioning:

Verify Git
git --version
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Software to Prepare

Go Toolchain

Make sure Go is installed with the latest stable version, at least Go 1.24:

Verify Go version
go version
go env GOPATH GOROOT

The output of go version must show go1.24 or newer. Also run go env GOPATH to find out where your global modules live.

Installing Gin

Once Go is ready, create a project directory, initialize the module, and install Gin v1.12.0:

Initialize module and install Gin
mkdir belajar-gin
cd belajar-gin
go mod init belajar-gin
go get github.com/gin-gonic/gin@v1.12.0

The command go get github.com/gin-gonic/gin@v1.12.0 adds Gin to go.mod and go.sum. Version v1.12.0 is the latest stable release as of the writing of this series (February 2026). After installing, verify the recorded version:

Check the Gin version in go.mod
go list -m github.com/gin-gonic/gin

Editor and API Client

We recommend using VS Code with the official Go extension from golang.go. This extension provides IntelliSense, formatting, and integrated debugging. For testing your API, you can use:

  • curl: already available in your terminal, enough for quick verification.
  • Bruno: an open-source API client that stores request collections as files.
  • Postman: a popular alternative with a full feature set.

All test examples in this series use curl so they can be easily copied into the terminal.

Verifying the Installation

Before moving on to episode 1, create a main.go file at the project root and run it:

First Gin verification
package main
 
import (
    "net/http"
 
    "github.com/gin-gonic/gin"
)
 
func main() {
    r := gin.Default()
    r.GET("/ping", func(c *gin.Context) {
        c.JSON(http.StatusOK, gin.H{"message": "pong"})
    })
    r.Run(":8080")
}

Run the server in one terminal, then test it from another terminal:

Run the server
go run main.go
Test from another terminal
curl http://localhost:8080/ping

If the output shows {"message":"pong"}, your environment is ready. The function gin.Default() creates an engine with the built-in Logger and Recovery middleware — we'll examine the details in episode 3.

Info

If port 8080 is already in use, change the r.Run argument to r.Run(":9090") and adjust the curl command accordingly.

Summary of Skills You Must Master

A recap of the pre-requisites you prepared in episode 0:

  • Go 1.24+ with an understanding of modules, packages, struct tags, and net/http.
  • HTTP concepts: methods, status codes, headers, and JSON bodies.
  • REST basics and the habit of testing with curl.
  • Gin v1.12.0 installed and verified via go list -m.
  • Git and a local database (PostgreSQL/MySQL) as preparation for the next phases.

If anything is missing, stop here and complete it before continuing. A strong foundation will make the next 22 episodes feel much lighter.

Closing

Key takeaways:

  • Gin is a thin layer on top of net/http: master Go and HTTP basics first.
  • Struct tags like json:"name" are the foundation of Gin binding.
  • Install Go 1.24+, then run go get github.com/gin-gonic/gin@v1.12.0.
  • Get used to testing APIs with curl.
  • First verification: create a gin.Default() engine and test the /ping endpoint.

In the next episode, episode 1, we will cover the history, background, and why you need Gin — from the evolution of net/http, the birth of Gin as a fork of Martini in 2014, to an early comparison with Echo, Fiber, chi, and plain net/http. Make sure your environment is ready, because the Learn Gin journey is just beginning!

Learn Gin - Pre-Requisites Skills & Setup Environment | Learn Gin