Skip to Content
marmot

This page assumes marmot is installed and marmot doctor reports no problems. If not, see Install.

Build and run

marmot works on any Go module. Make one:

mkdir hello && cd hello
go mod init hello
main.go
package main

import "fmt"

func main() {
	name := "marmot"
	fmt.Println("hello,", name)
}

Run it, then build an executable. The commands are the go command's, with marmot in front:

marmot run main.go
marmot build -o hello .
./hello

The first build compiles the standard library packages the program uses and caches them, so later builds are fast. For the binary you ship, use release mode:

marmot build -release -o hello .

Read an error

Change Println to Printn and build again. marmot shows the source, marks the exact span, says what is wrong there, and suggests a fix:

hello
marmot build: error M0002, undefined fmt.Printn, with help: use fmt.Println and a diff

The fix is marked check it because it is a guess based on the name. marmot fix -all applies it; plain marmot fix applies only fixes that are always safe, such as removing an unused import. marmot explain M0002 describes the error with an example.

Errors that involve more than one place point at each of them:

shapes
marmot build: error M0014, Square does not implement Shape, with labels on the interface, the method with a pointer receiver and the assignment, and a fix that adds &

Test

marmot test runs package tests like go test. On a terminal each failure comes first, at the line of its t.Error or t.Fatal:

stack
marmot test showing a failing test at the line of its t.Errorf, then every test with its status and time

Next

  • Build modes: dev and release, and what each is for.
  • Commands: every command, with its flags.
  • Diagnostics: human, plain and JSON output, and every error code.

On this page

Was this page helpful?

Report an issueOpen issues