fix(install): add error handling and minor code cleanups

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
This commit is contained in:
Rodney Osodo
2026-02-17 08:53:40 +03:00
parent bfd5aa30a7
commit ffbea7af59
5 changed files with 67 additions and 41 deletions

View File

@@ -192,8 +192,7 @@ func MarshalYAMLWithIndent(data interface{}, indent int) ([]byte, error) {
encoder := yaml.NewEncoder(buffer)
encoder.SetIndent(indent)
err := encoder.Encode(data)
if err != nil {
if err := encoder.Encode(data); err != nil {
return nil, err
}
@@ -209,7 +208,7 @@ func replaceInFile(filepath, oldStr, newStr string) error {
}
// Replace the string
newContent := strings.Replace(string(content), oldStr, newStr, -1)
newContent := strings.ReplaceAll(string(content), oldStr, newStr)
// Write the modified content back to the file
err = os.WriteFile(filepath, []byte(newContent), 0644)