ini

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ini is a small, hand-written INI parser covering the practical subset gostructor needs: `[section]` headers, `key = value` or `key: value` pairs, `;`/`#` line comments, and quoted values. It does not support key interpolation (`%(name)s`), multi-line values, or duplicate-key merging beyond "last one wins".

Index

Constants

View Source
const GlobalSection = ""

GlobalSection is the section name for keys that appear before any `[section]` header.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

File is a parsed INI document: section name -> key -> value.

func Parse

func Parse(data []byte) (*File, error)

Parse reads an INI document from data.

func (*File) Get

func (f *File) Get(section, key string) (string, bool)

Get returns the value for key in section, and whether it was present.

func (*File) ToMap

func (f *File) ToMap() map[string]any

ToMap renders the parsed document as a nested map: global-section keys at the top level, each named `[section]` a nested map[string]any — the shape gostructor.LookupKey addresses.

Jump to

Keyboard shortcuts

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