docs: cobra.dev broken Go snippets in "12-Factor App with Viper" tutorial
Author: salmanrfCreated Sep 23, 2026Updated Sep 23, 2026
The Building a 12-Factor App with Viper Integration tutorial has multiple instances of malformed shell and Go snippets.
In addition to the sections mentioned in #2322, the following Go snippet in "Step 2: Defining Commands and Flags" is broken.
Currently rendered as:
package cmd
import (
"fmt"
"os"
"[github.com/spf13/cobra](https://github.com/spf13/cobra)"
)
var (
// Used for flags.
cfgFile string
```
rootCmd = &cobra.Command{
Use: "myapp",
Short: "A demo application for Cobra and Viper",
}
```
)It doesn't compile: the import path is a Markdown link, and stray code fences are embedded inside the var block. Presumably intended:
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var (
// Used for flags.
cfgFile string
rootCmd = &cobra.Command{
Use: "myapp",
Short: "A demo application for Cobra and Viper",
}
)Source: spf13/cobra