Skip to content

Commit

Permalink
fix: Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
HRemonen committed Oct 29, 2023
1 parent e49282f commit 97ea14a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ package cmd

import (
"commitsense/pkg/config"
colorprinter "commitsense/pkg/printer"
"fmt"
"os"
"strings"

colorprinter "commitsense/pkg/printer"

"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
)
Expand Down Expand Up @@ -104,6 +105,6 @@ func printYAML(data interface{}) {
}

// Use strings.Replace to add proper indentation
indentedYAML := strings.Replace(string(yamlData), "\n", "\n ", -1)
indentedYAML := strings.ReplaceAll(string(yamlData), "\n", "\n ")
fmt.Println(" " + indentedYAML)
}
3 changes: 2 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ Copyright © 2023 HENRI REMONEN <[email protected]>
package config

import (
colorprinter "commitsense/pkg/printer"
"os"

colorprinter "commitsense/pkg/printer"

"github.com/spf13/viper"
)

Expand Down
10 changes: 8 additions & 2 deletions pkg/printer/colorprinter.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ func ColorPrint(variant string, text string, args ...interface{}) {
}

if len(args) > 0 {
printer.Printf(text, args...)
_, err := printer.Printf(text, args...)
if err != nil {
fmt.Println("Error printing colored message: ", err)
}
fmt.Println()
} else {
printer.Println(text)
_, err := printer.Println(text)
if err != nil {
fmt.Println("Error printing colored message: ", err)
}
}
}

0 comments on commit 97ea14a

Please sign in to comment.