Go-Simple-Eval#
Regolith uses the go-simple-eval library to evaluate expressions within the project configuration file:
The
whenexpression in the filter settings.The
rpNameandbpNamein some of the export targets.
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#
trueandtrueandfalse: 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 fromruntime.GOOS(e.g.,linux,windows,darwin).arch: The host architecture, retrieved fromruntime.GOARCH(e.g.,amd64,arm64).debug: Indicates whether Regolith is running in debug mode (i.e., when the--debugflag is used).version: The version of Regolith.profile: The name of the profile being run.mode: The mode that Regolith is running in (runorwatch).initial: Returns true for the first execution in “watch” mode; false in subsequent “watch” mode runs. In “run” mode, it always returns true.env: The system environment variables. For example to access variable “EXAMPLE”, you writeenv.EXAMPLE.nested: A boolean indicating that the filter being executed in a profile that has a parent profile.