List of all registries

Every function is categorized into a registry and may include a 'must' version. This 'must' version utilizes the native error handling of Go templates to manage errors that occur within your method.

List of registries

  • backward: Functions to maintain backward compatibility with sprig.

  • checksum: Tools to generate and verify checksums for data integrity.

  • conversion: Functions to convert between different data types within templates.

  • crypto: Cryptographic utilities for encryption, hashing, and security.

  • encoding: Methods for encoding and decoding data in various formats.

  • env: Access and manipulate environment variables within templates.

  • filesystem: Functions for interacting with the file system.

  • maps: Tools to manipulate and interact with map data structures.

  • numeric: Utilities for numerical operations and calculations.

  • random: Functions to generate random numbers, strings, and other data.

  • reflect: Tools to inspect and manipulate data types using reflection.

  • regexp: Regular expression functions for pattern matching and string manipulation.

  • semver: Functions to handle semantic versioning and comparison.

  • slices: Utilities for slice operations, including filtering, sorting, and transforming.

  • std: Standard functions for common operations.

  • strings: Functions for string manipulation, including formatting, splitting, and joining.

  • time: Tools to handle dates, times, and time-related calculations.

  • uniqueid: Functions to generate unique identifiers, such as UUIDs.

Must version

The Must strategy is currently under discussion and may be subject to change in the future. An RFC is currently open for feedback and discussion. You can view and participate in the RFC here.

The Must version of each function is essentially a safer variant that ensures error handling is integrated into the function's execution. When you use a function prefixed by Must (e.g., MustEncode, MustConvert), the template engine automatically checks for and handles any errors that might occur during the function's execution.

This is particularly useful in scenarios where failing silently is not an option, and you need immediate feedback if something goes wrong. Utilizing the Must versions helps to maintain the robustness and reliability of your template code.

Last updated

Change request #24: reflect safe functions feature and new signatures