I'm looking for a good alternativ to Viper

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/golang

Our great sponsors
  • SonarLint - Deliver Cleaner and Safer Code - Right in Your IDE of Choice!
  • Scout APM - Less time debugging, more time building
  • SaaSHub - Software Alternatives and Reviews
  • urfave/cli

    A simple, fast, and fun package for building command line apps in Go (by urfave)

    Personally I used https://github.com/urfave/cli for CLI a lot but ended up migrating few project to cobra just because while way to use it was pretty aisine and annoying it ended up better at parsing said CLI (urfave/cli insist on positional arguments which don't work well for some cases)

  • go-envconfig

    A Go library for parsing struct tags from environment variables.

  • SonarLint

    Deliver Cleaner and Safer Code - Right in Your IDE of Choice!. SonarLint is a free and open source IDE extension that identifies and catches bugs and vulnerabilities as you code, directly in the IDE. Install from your favorite IDE marketplace today.

  • godotenv

    A Go port of Ruby's dotenv library (Loads environment variables from `.env`.)

  • kong

    Kong is a command-line parser for Go (by alecthomas)

    For all my commandline parsing and config loading needs I use kong. In contrast to Viper and Cobra it has almost no dependencies (while viper and cobra pull in half a jungle).

  • ff

    Flags-first package for configuration

    Have a look at https://github.com/peterbourgon/ff

  • cleanenv

    ✨Clean and minimalistic environment configuration reader for Golang

    check this package: https://github.com/ilyakaznacheev/cleanenv

  • conf

    Package conf provides support for using environmental variables and command line arguments for configuration. (by ardanlabs)

  • Scout APM

    Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.

  • kelseyhightower/envconfig

    Golang library for managing configuration data from environment variables

    Pretty much all of our services and pkgs use https://github.com/kelseyhightower/envconfig. It’s dead simple, gets out of your way, and is battle tested

  • copre

    A small library to load configuration from multiple sources with predefined precedence

    Shameless self-promotion: I encountered the same pain points and put together a small library to tie together multiple configuration sources. As I still really like cobra it is intended to be used with pflags.

  • xflags

    Expressive flags for Go (by cavaliergopher)

    Self promo: it won’t help with the config file side of things but should elegantly cover the flags and environment variables: https://github.com/cavaliergopher/xflags.

  • go-yamlcfg

    For config I ended up making wrapper for YAML parser that did the "pick a config from list list" and "generate default config" features. But my config needs are not that big

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts