This repository contains the encoding libraries (with external dependencies) used by Viper.
go get github.com/go-viper/encoding
Note
Note: This module is not intended to be used directly. It is used by Viper to support various encoding formats.
An encoding library MUST implement one (or all) of the following interfaces:
// Encoder encodes the contents of Viper's internal representation into a byte representation.
// It's primarily used for encoding into a file format.
type Encoder interface {
Encode(map[string]any) ([]byte, error)
}
// Decoder decodes the contents of a byte slice.
// It's primarily used for decoding contents of a file into Viper's internal representation (map[string]any).
type Decoder interface {
Decode([]byte, map[string]any) error
}
Each library MUST be it's own Go module: github.com/go-viper/encoding/<library-name>
.
Libraries are versioned independently: <library-name>/vX.Y.Z
.
The project is licensed under the MIT License.