Go-Simple-Eval#

Regolith uses the go-simple-eval library to evaluate expressions within the project configuration file:

Syntax#

Go-simple-eval offers a simple syntax supporting basic operations commonly found in programming languages.

Warning

This section does not provide a full reference for go-simple-eval, but the features outlined here are sufficient for use in Regolith.

Operators#

  • Comparison operators : ==, !=, <, <=, >, >=

  • Logical operators : &&, ||, !

  • Math operators : +, -, *, /

  • String concatenation : +

Parentheses#

Use parentheses to group expressions, such as (1 + 2) * 3.

Strings#

Strings are enclosed in single quotes, like 'This is a string'.

Reserved Words#

  • true and true and false: Reserved for boolean values.

  • null: Reserved for null values.

Variables#

Regolith provides several variables for use in expressions:

  • project.name: The name of the project.

  • project.author: The author of the project.

  • os: The host operating system, retrieved from runtime.GOOS (e.g., linux, windows, darwin).

  • arch: The host architecture, retrieved from runtime.GOARCH (e.g., amd64, arm64).

  • debug: Indicates whether Regolith is running in debug mode (i.e., when the --debug flag is used).

  • version: The version of Regolith.

  • profile: The name of the profile being run.