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

MGS3005: tool too old

The binary exists, reports a version, and is usable - and that version is older than the spell's ops support.

[MGS3005] golangci-lint v1.9.0 is older than this spell supports (>= 2.0).
The op "golangci-lint" needs a newer one

The fourth question about a tool

Each is distinct, and only the last two used to have answers:

question declared by code
does it exist? nothing - PATH lookup MGS3003
what version? Tool.probe -
is it usable now? Tool.ready MGS3004
is it new enough? Tool.floor MGS3005

Without a floor, a too-old binary fails with whatever it says about an unrecognized flag - the same misleading failure MGS3004 exists to prevent, one question over.

Declaring one

export fun mgs_getTools() > {str: Tool} {
    return {
        "golangci-lint": Tool{
            probe = Command{bin = "golangci-lint", args = ["--version"]},
            floor = ">= 2.0",
        },
    };
}

The constraint is the same syntax magus.yaml's required_version uses, and a malformed one is a load error rather than a silent pass - a floor nobody can parse protects nobody.

A floor needs a probe: there is nothing to compare without one.

What it deliberately does not do

An unprobeable tool is not "too old." If the probe fails, the floor passes. Failing there would make a floor a second way for a missing tool to break, with a worse message than MGS3003's.

Output magus cannot parse is not "too old" either. A tool whose version line carries no semver is left alone rather than judged against a constraint it was never going to satisfy.

The check runs before the op forks and is memoized per tool and directory, so a declared floor costs one probe per run, not one per target.

MGS3005versionfloortoolserrorsmagusfile
Last updated (a103255f)
Glossary

Magusfile

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

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. See targets.

Spell

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

Buzz

The language magusfiles are written in (the .buzz engine). See engines.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Conventions

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