LogoLogo
  • Project Reclass Infrastructure
  • Frequently Asked Questions
  • Cloud Basics
  • Cloud Basics
  • How to migrate to a new AWS Account
  • Setting up SSL with Bitnami
  • AWS OpsWorks
  • Docker Basics
    • Intro to Docker
    • Buddy Bot
  • Github
    • Project-Reclass/toynet-react
  • Golang
    • Hello, Project Reclass
  • HashiCorp Vault
    • Getting Started with Vault
  • Linux Basics
    • What is a command?
    • Super User
    • Creating and managing users
    • How to move around the filesystem
    • Getting started with vim
    • Running your first shell script
    • Understanding Linux Permissions
    • How to SSH
  • Terraform
  • Terraform Basics
Powered by GitBook
On this page
  • Why Go?
  • Installation
  • Writing the Code
  • More Resources

Was this helpful?

Export as PDF
  1. Golang

Hello, Project Reclass

How to create your first hello world program in Go!

PreviousProject-Reclass/toynet-reactNextGetting Started with Vault

Last updated 3 years ago

Was this helpful?

Why Go?

Go is a powerful language that powers the infrastructure that Project Reclass runs on. Docker, Kubernetes, Terraform, Vault, and even our chatbots are written in Go. Having even a basic understanding of the language can assist in making important infrastructure decisions, and interacting with the tools we utilize. Go also has a very large, friendly and diverse community.

Installation

First you'll need to install Golang, you can do so . Go is often also found in most package managers so you can install it using the default manager for your system.

Follow the below instructions to properly finish setup on your Linux System

rm -rf /usr/local/go && tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz
# Remove any previous versions of go and unzip the new version

export PATH=$PATH:/usr/local/go/bin
# Add Go to your $PATH

go version
# You should be able to run this from anyway and get the most recent version

Package managers may handle the path setting for you. Check this with echo $PATH

Writing the Code

Create a file named main.go and add the following:

// this is a comment

package main // You'll always need a package name this is usually main

import (
    "fmt" // "fmt" is the format package and contains the Println func
)

func main() { // You'll need a main function to run your code
    fmt.Println("Hello, Project Reclass") //Println prints to stdout and formats
}

Save your code and run go run main.go

More Resources

There are several solid resources for go the being a great goto

Other tools I like are and

Finally, check out the and

here
docs page
gobyexample
Learn Go with Tests
Go Playground
Play with Go