comment alternatives and similar packages
Based on the "Configuration" category.
Alternatively, view comment alternatives based on common mentions on social networks and blogs.
-
kelseyhightower/envconfig
Go library for managing configuration data from environment variables. -
konfig
Composable, observable and performant config handling for Go for the distributed processing era. -
koanf
Light weight, extensible library for reading config in Go applications. Built in support for JSON, TOML, YAML, env, command line. -
confita
Load configuration in cascade from multiple backends into a struct. -
config
JSON or YAML configuration wrapper with environment variables and flags parsing. -
cleanenv
Minimalistic configuration reader (from files, ENV, and wherever you want). -
gookit/config
application config manage(load,get,set). support JSON, YAML, TOML, INI, HCL. multi file load, data override merge. -
hjson
Human JSON, a configuration file format for humans. Relaxed syntax, fewer mistakes, more comments. -
gcfg
read INI-style configuration files into Go structs; supports user-defined types and subsections -
goConfig
Parse a struct as input and populates the fields of this struct with parameters fom command line, environment variables and configuration file. -
joshbetz/config
A small configuration library for Go that parses environment variables, JSON files, and reloads automatically on SIGHUP. -
harvester
Harvester, a easy to use static and dynamic configuration package supportig seeding, env vars and Consul integration. -
onion
Layer based configuration for Go, Supports JSON, TOML, YAML, properties, etcd, env, and encryption using PGP. -
configuro
opinionated configuration loading & validation framework from ENV and Files focused towards 12-Factor compliant applications. -
configure
Provides configuration through multiple sources, including JSON, flags and environment variables. -
configuration
Library for initializing configuration structs from env variables, files, flags and 'default' tag. -
go-up
A simple configuration library with recursive placeholders resolution and no magic. -
hocon
Configuration library for working with the HOCON(a human-friendly JSON superset) format, supports features like environment variables, referencing other values, comments and multiple files. -
CONFLATE
Library providing routines to merge and validate JSON, YAML and/or TOML files -
go-ssm-config
Go utility for loading configuration parameters from AWS SSM (Parameter Store). -
sprbox
Build-environment aware toolbox factory and agnostic config parser (YAML, TOML, JSON and Environment vars). -
swap
Instantiate/configure structs recursively, based on build environment. (YAML, TOML, JSON and env). -
typenv
Minimalistic, zero dependency, typed environment variables library. -
gonfig
Tag-based configuration parser which loads values from different providers into typesafe struct. -
nasermirzaei89/env
Simple useful package for read environment variables. -
gone/jconf
Modular JSON configuration. Keep you config structs along the code they configure and delegate parsing to submodules without sacrificing full config serialization. -
txgruppi-config
Quick and easy way to load config files based on a simple set of rules.
Scout APM - Leading-edge performance monitoring starting at $39/month
Do you think we are missing an alternative of comment or a related project?
Popular Comparisons
README
comment
Golang package for use comments in JSON config files
Motivation
json config file: config.json
{
"name": "example",
"address": "192.168.0.1",
"active": true
}
How we can change address?
Create a new file config2.json
or fix in the current one.
Both variants are not convenient.
What is proposed
Introduce end-line comment. For shielding use the symbol #.
new json-config file with comments config.cjson
{
"name": "example",
# "address": "192.168.0.1", - this line is commented
"address": "192.168.0.2", # New address!
"active": true
}
Easier and convenient than previous both variants.
For parse this file first use the function comment.Trim(data)
.
We obtain the following:
{
"name": "example",
"address": "192.168.0.2",
"active": true
}
Next, we use standard parser json.Unmarshal
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"github.com/toelsiba/comment"
)
type Config struct {
Name string `json:"name"`
Address string `json:"address"`
Active bool `json:"active"`
}
func main() {
data, err := ioutil.ReadFile("config.cjson")
if err != nil {
log.Fatal(err)
}
data = comment.Trim(data)
fmt.Println(string(data))
var config Config
err = json.Unmarshal(data, &config)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", config)
}
Or more short variant:
func main() {
var c Config
err := comment.ReadConfig("config.cjson", &c)
if err != nil {
log.Fatal(err)
}
fmt.Println(c)
}
If you need have symbol # in line - used doublet ##.