Help us shape the future of Go! Take the 2026 Go Developer Survey

flow_version

package
v0.58.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package flow_version provides the @nflow_version directive, which rejects a .nflow file at compile time when the running compiler does not satisfy the declared version constraint. It gives flow authors a hard guarantee that a file will not be silently reinterpreted under different language semantics on a different release.

Typical use:

@nflow_version ">=0.7.0"

A source build (compiler.Version == "dev") accepts every constraint — there is no release identity to compare against, and failing the build for a local `go run` would be counterproductive.

Index

Constants

View Source
const ID = "flow_version"

Variables

View Source
var Directive = compiler.Directive{
	Name:    "nflow_version",
	Example: `@nflow_version ">=0.7.0"`,
	Handler: handleDirective,
}

Directive parses `@nflow_version "CONSTRAINT"` and rejects the source when the running compiler does not satisfy it. The constraint is one of `=`, `==`, `>=`, `<=`, `>`, `<`, or bare (implicit `=`), followed by a MAJOR.MINOR.PATCH version, optionally prefixed with `v` and optionally carrying a pre-release or build-metadata suffix that is ignored for comparison. Whitespace-separated constraints are ANDed, for example `>=0.37.0 <0.40.0`.

Functions

func Bundle

func Bundle(_ map[string]string) compiler.Bundle

func SatisfiesConstraint added in v0.45.0

func SatisfiesConstraint(constraint, version string) (bool, error)

SatisfiesConstraint reports whether version meets the same comparator grammar used by @nflow_version. Version must be an exact MAJOR.MINOR.PATCH release.

func WithDeferredCompatibilityCheck added in v0.45.0

func WithDeferredCompatibilityCheck(ctx context.Context) context.Context

WithDeferredCompatibilityCheck lets the CLI inspect and validate a source's declared range before selecting the engine that will compile it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL