# marmot - **Start** - [Introduction](/docs): A Go compiler built on MLIR and LLVM. Keep your Go code, switch the compiler, and get small native executables. - [Getting started](/docs/getting-started): Build, run and test a Go program with marmot, and read your first error. - [Install](/docs/install): Build marmot from source and check the installation. - [Build modes](/docs/build-modes): Dev builds for fast rebuilds, release builds for small, fast binaries. - **Reference** - Commands - [Commands](/docs/commands): Every marmot command, one page each. - [marmot build](/docs/commands/build): Compile packages and their dependencies into an executable. - [marmot run](/docs/commands/run): Compile and run a program. - [marmot test](/docs/commands/test): Compile and run package tests, like go test. - [marmot check](/docs/commands/check): Run vet, lint, format and the other code checks in one pass. - [marmot fix](/docs/commands/fix): Apply the suggested fixes of build errors and check findings. - [marmot fmt](/docs/commands/fmt): Format Go source and fix its imports, as goimports does. - [marmot watch](/docs/commands/watch): Build, run or test again after every change. - [marmot repl](/docs/commands/repl): Evaluate Go declarations, statements and expressions interactively. - [marmot size](/docs/commands/size): Size of a binary by section, package and function. - [marmot bench](/docs/commands/bench): Run benchmarks and compare them with go or a saved run. - [marmot prof](/docs/commands/prof): Read a CPU or memory profile in the terminal. - [marmot doctor](/docs/commands/doctor): Check the installation and the environment and say what to fix. - [marmot explain](/docs/commands/explain): Describe an error code. - [marmot mcp](/docs/commands/mcp): Serve build, run, test, fix and explain to coding agents. - [marmot generate](/docs/commands/generate): Run //go:generate directives, with their outputs cached. - Diagnostics - [Diagnostics](/docs/diagnostics): How marmot reports errors to people, to scripts and to coding agents. - [JSON output](/docs/diagnostics/json): Schema version 1 of marmot's JSON Lines diagnostics. - Error codes - [Error codes](/docs/diagnostics/codes): Every code marmot reports, with the real diagnostic, an example of the mistake and the fix. - [M0000 error](/docs/diagnostics/codes/m0000): An error without a more specific code. - [M0001 syntax error](/docs/diagnostics/codes/m0001): The file does not parse. - [M0002 undefined name](/docs/diagnostics/codes/m0002): The name is not declared in this scope, the package, or the universe scope. - [M0003 no such field or method](/docs/diagnostics/codes/m0003): The selector names a field or method the type does not have. - [M0004 declared and not used](/docs/diagnostics/codes/m0004): Go rejects local variables that are never read. - [M0005 imported and not used](/docs/diagnostics/codes/m0005): Go rejects imports that the file does not use. - [M0006 type mismatch](/docs/diagnostics/codes/m0006): A value of one type is used where another type is required: as a function argument, in an assignment, in a return statement, or in a composite literal. - [M0007 mismatched types](/docs/diagnostics/codes/m0007): Both operands of a binary operator must have identical types (untyped constants convert implicitly). - [M0008 wrong number of return values](/docs/diagnostics/codes/m0008): The return statement gives a different number of values than the function signature declares. - [M0009 wrong number of arguments](/docs/diagnostics/codes/m0009): The call passes a different number of arguments than the function takes. - [M0010 missing return](/docs/diagnostics/codes/m0010): A function with results can reach its closing brace without a return statement. - [M0011 package not found](/docs/diagnostics/codes/m0011): An imported package is not in the standard library, the main module, or any required module. - [M0012 assignment count mismatch](/docs/diagnostics/codes/m0012): The number of variables on the left does not match the number of values on the right. - [M0013 no new variables](/docs/diagnostics/codes/m0013): A short variable declaration (:=) must declare at least one new variable. - [M0014 does not implement interface](/docs/diagnostics/codes/m0014): A value is used as an interface but its type lacks a method of the interface, or has it with a different signature or with a pointer receiver only. - [M0015 redeclared](/docs/diagnostics/codes/m0015): The same name is declared twice in one scope. - [M0016 invalid operation](/docs/diagnostics/codes/m0016): The operator or conversion is not defined for the operand types. - [M0017 bad command line](/docs/diagnostics/codes/m0017): The command line names no buildable main package, or a flag value is not valid. - [M0018 link error](/docs/diagnostics/codes/m0018): The program compiled but did not link: a function has no body (no assembly or runtime overlay provides it), or a symbol is missing from the runtime library. - [M0019 internal compiler error](/docs/diagnostics/codes/m0019): marmot failed on a valid program. - [M0020 runtime panic](/docs/diagnostics/codes/m0020): The program panicked and no deferred recover stopped it. - [M0021 fatal runtime error](/docs/diagnostics/codes/m0021): The runtime stopped the program: a deadlock, out of memory, a concurrent map write, or a broken invariant. - [M0022 test failed](/docs/diagnostics/codes/m0022): A test called t.Error, t.Fatal or panicked. - [M0023 import cycle](/docs/diagnostics/codes/m0023): Two or more packages import each other. - [M0024 name not exported](/docs/diagnostics/codes/m0024): The name exists in the package but starts with a lower case letter, so only that package can use it. - [M0025 not supported by marmot](/docs/diagnostics/codes/m0025): The program uses a feature marmot does not support yet (for example cgo, plugins, or a body-less function without an overlay). - [M0026 type argument does not satisfy constraint](/docs/diagnostics/codes/m0026): A generic function or type was instantiated with a type argument outside the type set of its constraint. - [M0027 cannot infer type argument](/docs/diagnostics/codes/m0027): A type parameter appears in no argument, so the call does not say what it is. - [M0028 shadowed variable](/docs/diagnostics/codes/m0028): A := in an inner block declares a new variable with the same name as one in an outer block. - [M0029 unknown struct field](/docs/diagnostics/codes/m0029): A composite literal names a field the struct type does not have. - [M0100 vet finding](/docs/diagnostics/codes/m0100): go vet's analyzers found code that compiles but is likely wrong: a Printf format that does not match its arguments, a copied lock, an unreachable statement, a struct tag that does not parse. - [M0101 lint finding](/docs/diagnostics/codes/m0101): A staticcheck style analyzer found a bug pattern, a deprecated API, or code that can be simpler. - [M0102 modernize suggestion](/docs/diagnostics/codes/m0102): The code can use a newer language or library feature that the module's go version allows (min and max, range over int, slices and maps functions, strings.Cut, ...). - [M0103 not formatted](/docs/diagnostics/codes/m0103): The file is not in gofmt layout, or its imports are not as goimports would write them. - [M0104 gopls finding](/docs/diagnostics/codes/m0104): An analyzer of gopls (simplifications, unused parameters, ...) has a suggestion. - [M0105 known vulnerability](/docs/diagnostics/codes/m0105): The program calls code of a module version with a known vulnerability (from the Go vulnerability database). - [M0106 go.mod not tidy](/docs/diagnostics/codes/m0106): go.mod or go.sum lists modules the build does not need, or lacks ones it does. - [M0107 cross build failure](/docs/diagnostics/codes/m0107): The module builds for this platform but not for another one it is checked for: a file with a build tag or a platform name is missing a function or uses one that does not exist there. - [M0108 unreachable function](/docs/diagnostics/codes/m0108): No path from main or a test reaches the function, so it is dead code. - [M0109 switch misses cases](/docs/diagnostics/codes/m0109): A switch on an enum-like type (a defined integer or string type with package level constants of that type) does not handle every constant, or a type switch on a sealed interface (one with an unexported method, so only its package implements it) does not handle every implementation, and there is no default clause. - [M0110 possible nil dereference](/docs/diagnostics/codes/m0110): A pointer is dereferenced, or a map written to, where it can be nil: it is nil on one path into the use (var p *T; if c { p = &T{} }; p.f), or it comes from a function that returns nil with a nil error (or with ok true), in this package or another. - [M0111 heap allocation](/docs/diagnostics/codes/m0111): marmot build -allocs lists where the program allocates on the heap and why the object could not live in the frame: it is returned, stored in memory that outlives the function or in a global, passed to a call that may keep it, captured by an escaping closure, converted to an interface, kept across loop iterations, or too large for the frame. - [cgo](/docs/cgo): Packages that import "C" build with marmot, and C calls are direct native calls. - [Agent setup](/docs/agents): Use marmot from a coding agent, over the Model Context Protocol or as a plain command. - **Inside** - [Design](/docs/design): How the compiler and the runtime are put together. - [Benchmarks](/docs/benchmarks): Run time, binary size and build time against go build, with the method. - [Support](/docs/support): Platforms, language, standard library, test results and known differences from Go. - [Support matrix](/docs/support-matrix): Feature by feature and package by package, from the test results. - [FAQ](/docs/faq): Short answers to common questions.