bumping knative.dev/networking 946273d...e937f69: > e937f69 upgrade to latest dependencies (# 461) bumping github.com/spf13/cobra 8380ddd...de187e8: > de187e8 Fix flag completion (# 1438) > 07861c8 Fix documentation (# 1434) > 5738d6b Add install instructions for zsh on Mac OS (# 1417) > 5d46ac9 custom comp: do not complete flags after args when interspersed is false (# 1308) > 3c8a19e fix RegisterFlagCompletionFunc concurrent map writes error (# 1423) > 2dea4f2 Bump to viper 1.8.1 (# 1433) > b361960 Bash completion V2 with completion descriptions (# 1146) > d0f318d ci: deprecate Travis CI > 8eaca5f drop mitchellh/go-homedir (# 853) > ace6b14 readme: split 'Getting Started' into 'user_guide.md' > 701fa6c chore(deps): update viper > 9a43267 fix home directory config not loading (# 1282) > 4590150 Correcting misspelled words (# 1349) > c2e21bd Fix multiple fish completion issues (# 1249) > 95d23d2 Fix zsh for DirectiveNoSpace and DirectiveNoFileComp (# 1213) > 2d94892 Custom completion handle multiple shorhand flags together (# 1258) > 6d00909 Pass context to completion (# 1265) > 7223a99 powershell completion fix no file comp directive (# 1363) > 06e4b59 Allow fish comp to support trailing empty lines (# 1284) > 3ed6a39 ci/MSYS2: go install @latest (# 1366) > eb3b639 Bash completion variable leak fixes (# 1352) > b55fa79 Add PR labeler with pull_request_target (# 1338) > b312f0a Create 'completion' command automatically (# 1192) > ded486a Fix trailing whitespace in the powershell completion script (# 1342) > 893ebf6 Fix typo > be1efc8 Update CHANGELOG.md for v1.1.3 bumping github.com/spf13/viper 3826be3...bd03865: > bd03865 Add a proper processing for pflag.StringArray > 3fcad43 update %s to %w > faa8ba0 chore: update gotestsum > 65ee986 chore(lint): fix gofumpt > 04ef5fa chore: update golangci-lint > acd965b Add ini load options argument > 5f4d053 chore(deps): update dependencies > dd57ae6 chore(deps): update etcd > cdb5e59 Fix merging a key into a nil target > 36be6bf feat: make sure Viper compiles on WASM > 727a41c doc: add a note about concurent Get/Set to godoc > cb41ae0 doc: discuss concurrency in README > 7fdb267 chore: update dependencies > 5253694 ci: add Go 1.16 to build matrix > fb4eafd fix INI saving panics (# 1075) > 3c7b44f Update afero version (CVE-2020-14040) (# 1090) > 4613c4a docs: move troubleshooting to a new document > a86148e docs: add note about go modules to the readme > e66f940 docs: add troubleshooting guide about package not being found > d10c856 Add discussions to issue links > da70fee Add troubleshooting about unmarshaling > 99da8b2 Add labels to issue templates > 811f0e6 Add issue and PR templates > bba82cf docs: add run on repl.it badge with example > 6ddd354 Always quote $@ > 493643f Update README.md > f415025 Fix a minor typo in README.md > 4938331 fix typo > 8c89438 docs: improve AutomaticEnv documentation > 33bcdc9 Added support for accessing slices (# 861) > 44e6ee8 Use pull_request_target event in PR feedback > 656b877 Revert "Remove pull request feedback" > 0a45372 Remove pull request feedback > 82c2ddf Fix tests broken by mapstructure update > 16dc0f7 chore(deps): update mapstructure dependency > f67a901 docs: add go version badge and update pkg.go.dev badge > d2df377 ci: drop tests for Go 1.11-1.13 > cfcfed5 refactor: add setenv helper for tests > ea89028 Update docs > b655224 Allow BindEnv to register multiple environment variables. > b534983 Add some emojis to feedback bot > f3c0954 Add some emojis to feedback bot > dd2e0fa Add feedback bot to pull request > bed424f Add feedback bot to issue > 29c3027 docs: rewrite sub documentation > 6d4eb76 Add feedback form to the readme > 406ea27 Add feedback form to the readme > a028516 ensure BindPFlag() detects a nil flag parameter before wrapping in pflagValue. > d9d7dcd Increase lint timeout > a515209 Improve lint rules > ae12c84 Upgrade linter > 387404d Add log for remote config errors > f26928c Add Go 1.15 to the build matrix > 9c7144e Build on both linux and macos bumping knative.dev/eventing 5add485...0af15fd: > 0af15fd Move knative.dev/pkg/source.StatsReporter to eventing/pkg/metrics/source.StatsReporting - 1/n (# 5587) > 144a5b8 tracing fix for APIServerSource and PingSource (# 5567) > c86690c upgrade to latest dependencies (# 5588) > 4a679a4 [PingSource] disable @every (# 5585) bumping knative.dev/pkg e8973c6...7d1b0f1: > 7d1b0f1 Add ability to filter objects on injection controller promotion (# 2180) > 459d317 Add CheckEndpointState method to SpoofingClient (# 2166) bumping knative.dev/serving b4b3ad9...69caf07: > 69caf07 allow conformance test setup to be done without ytt (# 11657) > 548da1c Update net-istio nightly (# 11665) > f4c0946 Update net-certmanager nightly (# 11666) > 1bc6a10 Update net-kourier nightly and fix ytt matchers (# 11663) > b79f306 Update net-contour nightly (# 11667) > 05af7d4 Update net-contour nightly (# 11643) > 782a827 Bump a few assorted deps (# 11662) > 92df69f upgrade to latest dependencies (# 11660) Signed-off-by: Knative Automation <automation@knative.team> |
||
|---|---|---|
| .. | ||
| .dockerignore | ||
| .gitignore | ||
| CONTRIBUTING.md | ||
| Dockerfile | ||
| LICENSE | ||
| Makefile | ||
| PULL_REQUEST_TEMPLATE.md | ||
| README.md | ||
| azure-pipelines.yml | ||
| benchmark.sh | ||
| doc.go | ||
| example-crlf.toml | ||
| example.toml | ||
| fuzz.go | ||
| fuzz.sh | ||
| go.mod | ||
| keysparsing.go | ||
| lexer.go | ||
| localtime.go | ||
| marshal.go | ||
| marshal_OrderPreserve_test.toml | ||
| marshal_test.toml | ||
| parser.go | ||
| position.go | ||
| token.go | ||
| toml.go | ||
| tomlpub.go | ||
| tomltree_create.go | ||
| tomltree_write.go | ||
| tomltree_writepub.go | ||
README.md
go-toml
Go library for the TOML format.
This library supports TOML version v1.0.0-rc.3
Development status
ℹ️ Consider go-toml v2!
The next version of go-toml is in active development, and nearing completion.
Though technically in beta, v2 is already more tested, fixes bugs, and much faster. If you only need reading and writing TOML documents (majority of cases), those features are implemented and the API unlikely to change.
The remaining features (Document structure editing and tooling) will be added shortly. While pull-requests are welcome on v1, no active development is expected on it. When v2.0.0 is released, v1 will be deprecated.
Features
Go-toml provides the following features for using data parsed from TOML documents:
- Load TOML documents from files and string data
- Easily navigate TOML structure using Tree
- Marshaling and unmarshaling to and from data structures
- Line & column position data for all parsed elements
- Query support similar to JSON-Path
- Syntax errors contain line and column numbers
Import
import "github.com/pelletier/go-toml"
Usage example
Read a TOML document:
config, _ := toml.Load(`
[postgres]
user = "pelletier"
password = "mypassword"`)
// retrieve data directly
user := config.Get("postgres.user").(string)
// or using an intermediate object
postgresConfig := config.Get("postgres").(*toml.Tree)
password := postgresConfig.Get("password").(string)
Or use Unmarshal:
type Postgres struct {
User string
Password string
}
type Config struct {
Postgres Postgres
}
doc := []byte(`
[Postgres]
User = "pelletier"
Password = "mypassword"`)
config := Config{}
toml.Unmarshal(doc, &config)
fmt.Println("user=", config.Postgres.User)
Or use a query:
// use a query to gather elements without walking the tree
q, _ := query.Compile("$..[user,password]")
results := q.Execute(config)
for ii, item := range results.Values() {
fmt.Printf("Query result %d: %v\n", ii, item)
}
Documentation
The documentation and additional examples are available at pkg.go.dev.
Tools
Go-toml provides three handy command line tools:
-
tomll: Reads TOML files and lints them.go install github.com/pelletier/go-toml/cmd/tomll tomll --help -
tomljson: Reads a TOML file and outputs its JSON representation.go install github.com/pelletier/go-toml/cmd/tomljson tomljson --help -
jsontoml: Reads a JSON file and outputs a TOML representation.go install github.com/pelletier/go-toml/cmd/jsontoml jsontoml --help
Docker image
Those tools are also available as a Docker image from
dockerhub. For example, to
use tomljson:
docker run -v $PWD:/workdir pelletier/go-toml tomljson /workdir/example.toml
Only master (latest) and tagged versions are published to dockerhub. You
can build your own image as usual:
docker build -t go-toml .
Contribute
Feel free to report bugs and patches using GitHub's pull requests system on pelletier/go-toml. Any feedback would be much appreciated!
Run tests
go test ./...
Fuzzing
The script ./fuzz.sh is available to
run go-fuzz on go-toml.
Versioning
Go-toml follows Semantic Versioning. The supported version of TOML is indicated at the beginning of this document. The last two major versions of Go are supported (see Go Release Policy).
License
The MIT License (MIT) + Apache 2.0. Read LICENSE.