Welcome to the official documentation for the Gauntlet Programming Language.
Gauntlet was made so you can overcome Golang's frustrating design choices. Have a look:
package main
// Seamless interop with the entire golang ecosystem
import "fmt" as fmt
import "os" as os
import "strings" as strings
import "strconv" as strconv
// Explicit export keyword
Like what you see? Hit the "Introduction To Gauntlet" button below.
package main
import fmt "fmt"
import os "os"
import strings "strings"
import strconv "strconv"
func GetTrimmedFileLines(fileName string) ([]string, error) {
fileContent, err := os.ReadFile(fileName)
if err != nil {
return nil, err
}
fileContentStrVersion := string(fileContent)
trimmedLines := strings.Split(strings.TrimSpace(fileContentStrVersion), "\n")
// Eliminates any 'unused variable' errors
_, _, _, _ = err, fileContent, fileContentStrVersion, trimmedLines
return trimmedLines, nil
}
func main() {
a := 1
lines, err := GetTrimmedFileLines("example.txt")
if err != nil {
panic(err)
}
properWord := (func() string {
if len(lines) > 1 {
return "lines"
}
return "line"
})()
stringLength := strconv.Itoa(len(lines))
fmt.Println("There are " + stringLength + " " + properWord + ".")
fmt.Println("Here they are:")
for i, line := range lines {
fmt.Println("Line " + strconv.Itoa(i+1) + " is:")
fmt.Println(line)
// Eliminates any 'unused variable' errors
_, _ = i, line
}
// Eliminates any 'unused variable' errors
_, _, _, _, _ = a, err, lines, properWord, stringLength
}
Whats
the
meaning
of
lifeThere are 5 lines.
Here they are:
Line 1 is:
Whats
Line 2 is:
the
Line 3 is:
meaning
Line 4 is:
of
Line 5 is:
life