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

MGS1039: magus is called without being imported

A file names magus\ (a call such as magus\project, or a type such as magus\Context) and has no import "magus";:

[error] [MGS1039] [BZZ1009] buzz: line 1:8: undefined type "magus\Context": no import
binds magus in this module; add `import "magus";`; magus is an imported module since v0.5.0

Why

Before v0.5.0 magus bound magus into every magusfile, spell and script whether or not the file imported it. It is now an ordinary host module, imported like fs or http, so a program's own declarations are not shadowed by a name it never asked for. A file that relied on the implicit binding fails to load, and the checker's own error (BZZ1009, a namespace the file never imported) says what is missing but not why it once worked.

What to do

Add the import at the top of the file, beside the others:

import "magus";

Nothing else changes: every magus\ call keeps its name and signature.

MGS1039magusfilespellsimportsupgradebuzz
Last updated (b5647a35)
Earlier changes on this page (1)

Full history ↗ · Blame source ↗

Glossary

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.

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.

Spell

A language/runtime adapter (e.g. go, md) that maps generic targets onto a toolchain's real commands. Spell in full.

Module

A magus stdlib namespace a magusfile imports for host capabilities: filesystem, exec, vcs, and more. Module in full.

Buzz

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

CI

An ordinary target you compose yourself with ctx.needs; magus does not hardcode its stages. It is the anchor magus affected ci keys off, and ci strips the rw charm. CI in full.

Conventions

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