Skip to content

Go compiler on MeluXina

The MeluXina system environment provides the Go compiler.

EasyBuild module description

 Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

You can use Go to compile your Go programs.

Go usage

Interactive

Reserve an interactive session:

salloc -A COMPUTE_ACCOUNT -t 01:00:00 -q dev --res cpudev -p cpu -N 1

The example above will allocate one CPU node in interactive mode. Load the Go (Will load default version if not specified) module as in below script.

module load Go
go run main.go

Batch

Go can also be used in a batch job using Slurm. The script below builds a simple Go HelloWorld binary on one CPU node allocated for 5 minutes.

#!/bin/bash -l
#SBATCH -N 1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH -p cpu
#SBATCH -q test
#SBATCH --time 00:05:00

#Load Go module
module load Go

#Check Go version
go version

#Create the binay
go build main.go

#Run the program
go run main.go