Categorygithub.com/gophertuts/go-basics
module
0.0.0-20200903160043-e34dbd4ff13f
Repository: https://github.com/gophertuts/go-basics.git
Documentation: pkg.go.dev

# README

go-basics

Go language basics

This section includes exercises and small projects which illustrate the basics of Go programming language. Things such as: types, data structures, functions, pointers, packages and others.

Section overview

Installation

Before trying any of these examples make sure to have the Go binary installed on your platform.

OSX:

# Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Go

brew install go

Linux:

# Move into $HOME directory
cd ~

# Download the binary for your distribution
curl -O https://dl.google.com/go/go1.12.linux-amd64.tar.gz

# Verify that the downloaded binary is not corrupted. Check if the hash matches the one from downloads page
sha256sum go1.12.linux-amd64.tar.gz

# Extract the binary
tar xvf go1.12.linux-amd64.tar.gz

# Make root user the owner of Go workspace
sudo chown -R root:root ./go

# Move go directory to a standard location
sudo mv go /usr/local

For more details regarding Go installation check out

Golang Installation

For downloading Go binary for your platform checkout

Golang Downloads

To check if you installed Go successfully type:

# Displays installed Go version
go version

# Displays all environment variables defined by Go
go env

Docker:

docker run -it golang:1.11

Set $GOPATH variable

sudo nano ~/.profile

# Linux
export GOPATH=/usr/local/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:/$GOBIN

# OSX
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:/$GOBIN

# Save File

# Restart shell configuration
source ~/.profile

Other Go tools

You can also install other Go tools which will help you have a more productive development process

Go Tools

go get -u golang.org/x/tools/...

Go Lint

go get -u golang.org/x/lint/golint

Go Imports

go get -u golang.org/x/tools/cmd/goimports

Daily routine things

  • Format your entire code recursively using go fmt ./...

  • Lint your entire code recursively using golint ./...

For more info about Go check out

Go Doc

Go Packages

Go Playground

Effective Go

A Tour of Go

For more info about Go commands & WORKSPACE check out

Go commands explained

Go WORKSPACE explained

FEEDBACK ⚗

GopherTuts TypeForm

COMMUNITY 🙌

GopherTuts Discord


Happy hacking gophers 🚀🚀🚀

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author