fix: lint errors (#923)

Signed-off-by: amitamrutiya2210 <amitamrutiya2210@gmail.com>
This commit is contained in:
Amit Amrutiya
2024-02-07 17:00:45 +05:30
committed by GitHub
parent d97dea2896
commit 3415031006
11 changed files with 99 additions and 36 deletions

View File

@@ -24,7 +24,8 @@ import (
)
var (
backend string
backend string
backendType string
)
// generateCmd represents the auth command
@@ -34,14 +35,13 @@ var GenerateCmd = &cobra.Command{
Long: `Opens your browser to generate a key for your chosen backend.`,
Run: func(cmd *cobra.Command, args []string) {
backendType := viper.GetString("backend_type")
backendType = viper.GetString("backend_type")
if backendType == "" {
// Set the default backend
backend = "openai"
}
// override the default backend if a flag is provided
if backend != "" {
//nolint:all
backendType = backend
}
fmt.Println("")

View File

@@ -120,7 +120,12 @@ var ServeCmd = &cobra.Command{
color.Red("failed to create logger: %v", err)
os.Exit(1)
}
defer logger.Sync()
defer func() {
if err := logger.Sync(); err != nil {
color.Red("failed to sync logger: %v", err)
os.Exit(1)
}
}()
server := k8sgptserver.Config{
Backend: aiProvider.Name,