...

/

Understanding the Synergy Between Cobra and Viper

Understanding the Synergy Between Cobra and Viper

In this lesson, we will revisit Cobra and you'lllearn about the synergy between Cobra and Viper.

We'll cover the following...

Cobra and Viper were designed by the same author in order to work together. The integration is very simple and smooth.

Overview

As you recall, Cobra has fantastic support for parsing command-line arguments, but it doesn’t offer any built-in capabilities for managing any other type of configuration. This is all by design to let Cobra focus on the command-line and rely on Viper for all other forms of configuration.

Cobra and Viper

Command-line arguments or flags are different from all other forms of configuration because they are not used just for configuration. When you run a command-line program and provide it some command-line arguments, some of the arguments will be the command itself and possibly some sub-commands, some other arguments may be configuration flags and yet other arguments may be inputs.

As developers, we need to ...