Part 1 - Nuxnuxx/showcase_go GitHub Wiki


go mod init

After that create a main.go and add it.

// Filename: main.go
package main

func main(){


This is the entrypoint of your binary.

Setting up

Intall echo

go get

Get your Api Key for RAWG

What is RAWG : Here

Get your api key here

Now put it in your .env.

//Filename: .env

Load .env

This package his self explanatory, it just autoload what is in the .env automatically for us.

go get ""
// Filename: main.go
import (
    _ ""

Get started with RAWG

// Filename: main.go

// GET API_KEY from .env file
API_KEY := os.Getenv("API_KEY")

// Build the URL
builder := strings.Builder{}

// Make the request
resp, err := http.Get(builder.String())

if err != nil {

// Defer the closing of the response body
defer resp.Body.Close()

// Read the response body
body, err := io.ReadAll(resp.Body)

if err != nil {

// Print the response body

// Now the body is close automatically because there is no need for it anymore

Lets run this

// Filename: Makefile
		@go build -o bin/app

run: build

// Nobody write test
		@go test -v ./...

make run it will build and then start the binary.

to see a more clear response you select only the name of the games with jq.

make run | jq -r '.results[].name'

| Checkpoint |

git reset --hard HEAD
git merge origin/get_started_with_rawg

| Checkpoint |