feat(tests): Fixing linter problems

Using golangci-lint
This commit is contained in:
2025-06-04 14:29:13 +02:00
parent d77029b597
commit def5d097a4
13 changed files with 195 additions and 49 deletions

View File

@@ -113,7 +113,11 @@ func Convert(config ConvertOptions, dockerComposeFile ...string) error {
fmt.Println(utils.IconFailure, err)
return err
}
defer os.Chdir(currentDir) // after the generation, go back to the original directory
defer func() {
if err := os.Chdir(currentDir); err != nil { // after the generation, go back to the original directory
log.Fatal(err)
}
}()
// repove the directory part of the docker-compose files
for i, f := range dockerComposeFile {
@@ -626,8 +630,14 @@ func writeContent(path string, content []byte) {
fmt.Println(utils.IconFailure, err)
os.Exit(1)
}
defer f.Close()
f.Write(content)
defer func() {
if err := f.Close(); err != nil {
log.Fatal(err)
}
if _, err := f.Write(content); err != nil {
log.Fatal(err)
}
}()
}
// helmLint runs "helm lint" on the output directory.