Install Go:
1GO_VERSION="1.21.0"
2
3wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
4sudo rm -rf /usr/local/go
5sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
6
7export PATH="/usr/local/go/bin:$PATH"
8
9go version
To keep Go available after reboot:
1echo 'export PATH="/usr/local/go/bin:$PATH"' >> ~/.bashrc
2source ~/.bashrc
1mkdir myapp
2cd myapp
3
4go mod init myapp
A go.mod file is created:
1myapp/
2โโโ go.mod
It describes the Go module and its dependencies.
Create main.go:
1package main
2
3import "fmt"
4
5func main() {
6 fmt.Println("Hello World")
7}
1go run .
2go build
This creates a binary: ./myapp
Cobra is a Go library for building command-line applications.
It is used by many well-known tools from the Go ecosystem because it gives us a convenient structure for:
A Cobra application usually reads naturally:
1app command argument --flag value
For example:
1git clone repository --bare
2kubectl get pods --namespace production
A useful introduction is also available here:
CUE stands for Configure, Unify, Execute
1# Install GO
2GO_VERSION="1.21.0"
3wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
4sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
5export PATH=$PATH:/usr/local/go/bin
6
7go install cuelang.org/go/cmd/cue@latest
8sudo cp -pr ./go /usr/local/.
9
10# or use Container
11printf "\e[1;34m[INFO]\e[m Install CUElang:\n";
12podman pull docker.io/cuelang/cue:latest
top -> schema -> constraint -> data -> bottom
1# import a file
2cue import imageset-config.yaml
3
4# Validate
5cue vet imageset-config.cue imageset-config.yaml
6
7
8* Some basics example
9
10```go
11// This is a comment
12_greeting: "Welcome" // Hidden fields start with "_"
13#project: "CUE" // Definitions start with "#"
14
15message: "\(_greeting) to \(#project)!" // Regular fields are exported
16
17#Person: {
18 age: number // Mandatory condition and must be a number
19 hobbies?: [...string] // non mandatory but if present must be a list of string
20}
21
22// Constrain which call #Person and check if age
23#Adult: #Person & {
24 age: >=18
25}
26
27// =~ match a regular expression
28#Phone: string & =~ "[0-9]+"
29
30// Mapping
31instanceType: {
32 web: "small"
33 app: "medium"
34 db: "large"
35}
36
37server1: {
38 role: "app"
39 instance: instanceType[role]
40}
41
42// server1.instance: "medium"
1# executable have extension name "_tool.cue"
2
3# usage
4cue cmd prompter
1package foo
2
3import (
4 "tool/cli"
5 "tool/exec"
6 "tool/file"
7)
8
9// moved to the data.cue file to show how we can reference "pure" Cue files
10city: "Amsterdam"
11
12// A command named "prompter"
13command: prompter: {
14
15 // save transcript to this file
16 var: {
17 file: *"out.txt" | string @tag(file)
18 } // you can use "-t flag=filename.txt" to change the output file, see "cue help injection" for more details
19
20 // prompt the user for some input
21 ask: cli.Ask & {
22 prompt: "What is your name?"
23 response: string
24 }
25
26 // run an external command, starts after ask
27 echo: exec.Run & {
28 // note the reference to ask and city here
29 cmd: ["echo", "Hello", ask.response + "!", "Have you been to", city + "?"]
30 stdout: string // capture stdout, don't print to the terminal
31 }
32
33 // append to a file, starts after echo
34 append: file.Append & {
35 filename: var.file
36 contents: echo.stdout // because we reference the echo task
37 }
38
39 // also starts after echo, and concurrently with append
40 print: cli.Print & {
41 text: echo.stdout // write the output to the terminal since we captured it previously
42 }
43}
GoDog is the Cucumber implementation for Go: Behaviour-Driven Development (BDD).
You write scenarios in Gherkin (.feature files), then implement the steps in Go.
go test runs the scenarios as normal tests.
1go get github.com/cucumber/godog/cmd/godog@latest
In practice it is a test dependency added to your go.mod.
features/calculator.feature:
1Feature: Calculator
2
3 Scenario: add two numbers
4 Given I have a calculator
5 When I add 3 and 5
6 Then the result should be 8
main_test.go:
Hugo is a fast static site generator, written in Go.
It turns Markdown + templates + config into a static website.
Use the extended build if you process SCSS (this theme does):
1# binary
2curl -L https://github.com/gohugoio/hugo/releases/download/v0.154.3/hugo_extended_0.154.3_linux-amd64.tar.gz | tar -xz
3sudo mv hugo /usr/local/bin/hugo
4
5# or snap
6sudo snap install hugo
You also need Dart Sass and Node/npm for SCSS + PostCSS.
1hugo new site myblog
2cd myblog
1hugo new posts/first-post.md # draft: true by default
1hugo server -D # dev server, include drafts
2hugo # build into public/
3hugo --gc # build + garbage-collect cache
4hugo --minify -e production # production build
1content/ source markdown
2layouts/ templates (override the theme)
3static/ files copied as-is (images, favicons)
4data/ site data (.yaml/.json/.toml)
5config/ configuration (hugo.yaml, params, menus)
6public/ generated site (gitignored)
1---
2title: "First Post"
3date: 2026-01-01T00:00:00+02:00
4draft: true
5---
6
7Content.
layouts/_default/single.html, list.html, baseof.htmllayouts/.{{ partial "name" . }}1{{ .Title }} {{ .Content }} {{ .Params.custom }}
2{{ range ... }} {{ if ... }} {{ with ... }}
3{{ resources.Get "x" | minify | fingerprint }}
1hugo mod get -u ./... # update modules
2hugo mod tidy
3hugo mod graph # list the module graph
_index.md = section page; index.md = leaf bundle page.draft: true pages only appear with hugo server -D../-relative image paths resolve against static/, not the content bundle.