Search⌘ K
AI Features

Creating an Application Skeleton With the Cobra Generator

Explore how to create a basic Go command-line application skeleton using the Cobra generator. Understand the generated file structure, main.go setup, root command details, and learn how to extend the app by adding subcommands. This lesson helps you build a foundation for structured CLI applications in Go.

Creating an application skeleton with the Cobra generator

Let’s start by creating an application called calc-app. We can skip the Viper configuration for now and use no license. Type the following command in the terminal below. You can use your name instead of Gigi

$ cobra init calc-app --pkg-name calc-app --license=none --viper=false --author= Gigi

Type the above command in the terminal below and explore the created calc-app directory and its ...