tomlio

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownKeys = errors.New("unknown keys")

ErrUnknownKeys indicates that the TOML file contains keys not defined in the target struct.

Functions

func Load

func Load[T any](path string, cfg *T) error

Load loads a TOML configuration file from path into cfg.

cfg must be a pointer. Unknown keys in the file result in ErrUnknownKeys.

func Save

func Save[T any](path string, cfg T) error

Save writes cfg as TOML to path.

Save is crash-safe:

  • data is written to a temporary file
  • the file is synced
  • the file is atomically renamed to the target path

The parent directory is created if it does not exist. Concurrent writes to the same path are not synchronized.

Types

This section is empty.

Jump to

Keyboard shortcuts

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