You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: setup.go
    path of file: ./repos/semaphore/cli/cmd
    
    the code of the file until where you have to start completion: package cmd

import (
	"bufio"
	"fmt"
	"github.com/ansible-semaphore/semaphore/cli/setup"
	"github.com/ansible-semaphore/semaphore/db"
	"github.com/ansible-semaphore/semaphore/db/factory"
	"github.com/ansible-semaphore/semaphore/util"
	"github.com/spf13/cobra"
	"os"
	"strings"
)

func init() {
	rootCmd.AddCommand(setupCmd)
}

var setupCmd = &cobra.Command{
	Use:   "setup",
	Short: "Perform interactive setup",
	Run: func(cmd *cobra.Command, args []string) {
		doSetup()
	},
}

// nolint: gocyclo
func doSetup() int {
	var config *util.ConfigType
	config = &util.ConfigType{}
	config.GenerateSecrets()
	setup.InteractiveSetup(config)

	configPath := setup.SaveConfig(config)
	util.Config = config

	fmt.Println(" Pinging db..")

	store := factory.CreateStore()
	defer store.Close("setup")
	store.Connect("setup")

	fmt.Println("Running 
    
func doSetup() int {
	var config *util.ConfigType
	config = &util.ConfigType{}
	config.GenerateSecrets()
	setup.InteractiveSetup(config)

	configPath := setup.SaveConfig(config)
	util.Config = config

	fmt.Println(" Pinging db..")

	store := factory.CreateStore()
	defer store.Close("setup")
	store.Connect("setup")

	fmt.Println("Running db Migrations..")
	if err := db.Migrate(store); err != nil {
		fmt.Printf("Database migrations failed!\n %v\n", err.Error())
		os.Exit(1)
	}

	stdin := bufio.NewReader(os.Stdin)

	var user db.UserWithPwd
	user.Username = readNewline("\n\n > Username: ", stdin)
	user.Username = strings.ToLower(user.Username)
	user.Email = readNewline(" > Email: ", stdin)
	user.Email = strings.ToLower(user.Email)

	existingUser, err := store.GetUserByLoginOrEmail(user.Username, user.Email)
	util.LogWarning(err)

	if existingUser.ID > 0 {
		// user already exists
		fmt.Printf("\n Welcome back, %v! (a user with this username/email is already set up..)\n\n", existingUser.Name)
	} else {
		user.Name = readNewline(" > Your name: ", stdin)
		user.Pwd = readNewline(" > Password: ", stdin)
		user.Admin = true

		if _, err := store.CreateUser(user); err != nil {
			fmt.Printf(" Inserting user failed. If you already have a user, you can disregard this error.\n %v\n", err.Error())
			os.Exit(1)
		}

		fmt.Printf("\n You are all setup %v!\n", user.Name)
	}

	fmt.Printf(" Re-launch this program pointing to the configuration file\n\n./semaphore server --config %v\n\n", configPath)
	fmt.Printf(" To run as daemon:\n\nnohup ./semaphore server --config %v &\n\n", configPath)
	fmt.Printf(" You can login with %v or %v.\n", user.Email, user.Username)

	return 0
}