go-options alternatives and similar packages
Based on the "Configuration" category.
Alternatively, view go-options alternatives based on common mentions on social networks and blogs.
-
koanf
Simple, extremely lightweight, extensible, configuration management library for Go. Supports JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper. -
konfig
Composable, observable and performant config handling for Go for the distributed processing era -
gookit/config
📝 Go configuration manage(load,get,set,export). support JSON, YAML, TOML, Properties, INI, HCL, ENV and Flags. Multi file load, data override merge, parse ENV var. Go应用配置加载管理,支持多种格式,多文件加载,远程文件加载,支持数据合并,解析环境变量名 -
gcfg
read INI-style configuration files into Go structs; supports user-defined types and subsections -
goConfig
DISCONTINUED. goconfig uses a struct as input and populates the fields of this struct with parameters from command line, environment variables and configuration file. -
joshbetz/config
🛠 A configuration library for Go that parses environment variables, JSON files, and reloads automatically on SIGHUP. -
configuro
An opinionated configuration loading framework for Containerized and Cloud-Native applications. -
hocon
go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config -
configure
Configure is a Go package that gives you easy configuration of your project through redundancy -
Genv
Genv is a library for Go (golang) that makes it easy to read and use environment variables in your projects. It also allows environment variables to be loaded from the .env file. -
swap
Instantiate/configure structs recursively, based on build environment. (YAML, TOML, JSON and env).
InfluxDB high-performance time series database

Do you think we are missing an alternative of go-options or a related project?
README
Clean APIs for your Go Applications. Inspired by functional options pattern.
Quick view
package main
import (
"fmt"
"github.com/kataras/go-options"
)
type appOptions struct {
Name string
MaxRequests int
DevMode bool
EnableLogs bool
}
type app struct {
options appOptions
}
func newApp(setters ...options.OptionSetter) *app {
opts := appOptions{Name: "My App's Default Name"} // any default options here
options.Struct(&opts, setters...) // convert any dynamic options to the appOptions struct, fills non-default options from the setters
app := &app{options: opts}
return app
}
// Name sets the appOptions.Name field
// pass an (optionall) option via static func
func Name(val string) options.OptionSetter {
return options.Option("Name", val)
}
// Dev sets the appOptions.DevMode & appOptions.EnableLogs field
// pass an (optionall) option via static func
func Dev(val bool) options.OptionSetter {
return options.Options{"DevMode": val, "EnableLogs": val}
}
// and so on...
func passDynamicOptions() {
myApp := newApp(options.Options{"MaxRequests": 17, "DevMode": true})
fmt.Printf("passDynamicOptions: %#v\n", myApp.options)
}
func passDynamicOptionsAlternative() {
myApp := newApp(options.Option("MaxRequests", 17), options.Option("DevMode", true))
fmt.Printf("passDynamicOptionsAlternative: %#v\n", myApp.options)
}
func passFuncsOptions() {
myApp := newApp(Name("My name"), Dev(true))
fmt.Printf("passFuncsOptions: %#v\n", myApp.options)
}
// go run $GOPATH/github.com/kataras/go-options/example/main.go
func main() {
passDynamicOptions()
passDynamicOptionsAlternative()
passFuncsOptions()
}
Installation
The only requirement is the Go Programming Language, at least v1.7.
$ go get -u github.com/kataras/go-options
FAQ
If you'd like to discuss this package, or ask questions about it, feel free to
- Explore these questions.
- Post an issue or idea here.
- Navigate to the Chat.
Versioning
Current: v0.0.1
Read more about Semantic Versioning 2.0.0
- http://semver.org/
- https://en.wikipedia.org/wiki/Software_versioning
- https://wiki.debian.org/UpstreamGuide#Releases_and_Versions
People
The author of go-options is @kataras.
Contributing
If you are interested in contributing to the go-options project, please make a PR.
License
This project is licensed under the MIT License.
License can be found [here](LICENSE).
*Note that all licence references and agreements mentioned in the go-options README section above
are relevant to that project's source code only.