magus v0.4.3 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
1 min read

MGS1104: this program does not link the Buzz engine

A Go program asked the magus library to evaluate a magusfile, and the program was built without the Buzz engine that evaluates one. The load stops there.

[MGS1104] cannot evaluate /repo/magusfile.buzz: this program does not link the
Buzz engine; add the blank import _ "github.com/egladman/magus/buzzengine" to
its main package

The magus command links the engine, so this only reaches a program that imports github.com/egladman/magus as a library.

Why

The library does not link the engine on its own, so a program that never evaluates a magusfile does not carry the Buzz VM.

The alternative to failing is silence. A workspace loaded without its magusfiles has no custom targets, no magus.project() settings and no per-target policy, and it renders exactly like a workspace that declares none. Only one of those is true, and nothing in the result says which.

So the load returns *types.EngineNotLinkedError instead of a partial workspace. A workspace with no magusfile still opens without the engine.

Fix

Link the engine from the program's main package:

import _ "github.com/egladman/magus/buzzengine"

Match the error from Go with errors.As:

var notLinked *types.EngineNotLinkedError
if errors.As(err, &notLinked) {
    // the program was built without buzzengine
}

See also

  • Go SDK: what the library does and does not link.
  • MGS1101: a capability reported as unavailable, never as empty.
MGS1104capabilitysdklibrarybuzzenginemagusfileembed
Last updated (29d8b3de)
Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. Workspace in full.

Project

A directory magus recognizes as a unit of work (it has a magusfile); the unit of caching, scheduling, and dependency tracking. Project in full.

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. Magusfile in full.

Target

A named operation (build, test, ...) you invoke with magus run <target>; it may compose a spell's tool-native operations and depend on other targets. Target in full.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). Op in full.

Buzz

The language magusfiles are written in (the .buzz engine). Buzz in full.

Engine

The interpreter a magusfile runs on; magus embeds the Buzz engine. Engine in full.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.