fix(golangci): add config
All checks were successful
Run Golang tests / Run unit tests (stable, ubuntu-latest-amd64) (push) Successful in 6s
Lint Markdown files / Run markdown linter (push) Successful in 3s
Lint Golang files / Run golang CI linter (stable, ubuntu-latest-arm64) (push) Successful in 29s
Run Golang tests / Run unit tests (stable, ubuntu-latest-arm64) (push) Successful in 23s
Lint Golang files / Run golang CI linter (stable, ubuntu-latest-amd64) (push) Successful in 59s

This commit is contained in:
2025-08-12 08:29:38 +02:00
parent 405f996e19
commit c60eb969d0
3 changed files with 18 additions and 2 deletions

13
.golangci.yaml Normal file
View File

@ -0,0 +1,13 @@
version: "2"
linters:
default: standard
enable:
- errname
- gosec
exclusions:
rules: []
warn-unused: true
run:
tests: true

View File

@ -90,11 +90,13 @@ func run(cmd *cobra.Command, args []string) error {
switch {
case len(outputFile) > 0:
// #nosec G301
err = os.MkdirAll(filepath.Dir(outputFile), 0755)
if err != nil {
return err
}
// #nosec G304
f, err := os.Create(outputFile)
if err != nil {
return err

View File

@ -43,7 +43,7 @@ func Fetch(urls ...string) ([]*dockerCompose.Config, error) {
return dockerComposeConfigs, nil
}
var ErrorPathIsDir error = errors.New("path is a directory")
var ErrPathIsDir error = errors.New("path is a directory")
func getDockerComposeViaHTTP(url string) (*dockerCompose.Config, error) {
req, err := http.NewRequest(http.MethodGet, url, nil)
@ -78,9 +78,10 @@ func readDockerComposeFromFile(name string) (*dockerCompose.Config, error) {
case err != nil:
return nil, err
case fileStat.IsDir():
return nil, fmt.Errorf("%w: %s", ErrorPathIsDir, name)
return nil, fmt.Errorf("%w: %s", ErrPathIsDir, name)
}
// #nosec G304
file, err := os.Open(name)
if err != nil {
return nil, err