Compare commits

...

3 Commits

Author SHA1 Message Date
f0955bc835
fix: extend error handling
All checks were successful
Golang Tests / unittest (stable, ubuntu-latest-amd64) (push) Successful in 8s
Lint Markdown files / markdown-lint (push) Successful in 4s
Golang CI lint / golangci (stable, ubuntu-latest-amd64) (push) Successful in 2m31s
Golang Tests / unittest (stable, ubuntu-latest-arm64) (push) Successful in 45s
Golang CI lint / golangci (stable, ubuntu-latest-arm64) (push) Successful in 1m50s
2025-06-01 13:47:15 +02:00
17695e0996
chore(ci): use DavidAnson/markdownlint-cli2-action@v19.1.0
Some checks failed
Golang Tests / unittest (stable, ubuntu-latest-amd64) (push) Successful in 8s
Lint Markdown files / markdown-lint (push) Successful in 4s
Golang Tests / unittest (stable, ubuntu-latest-arm64) (push) Successful in 40s
Golang CI lint / golangci (stable, ubuntu-latest-arm64) (push) Failing after 1m26s
Golang CI lint / golangci (stable, ubuntu-latest-amd64) (push) Failing after 2m19s
2025-06-01 13:37:49 +02:00
e473009b6e
chore(ci): add golangci-lint
Some checks failed
Golang Tests / unittest (stable, ubuntu-latest-amd64) (push) Successful in 33s
Markdown linter / markdown-lint (push) Successful in 3s
Golang CI lint / golangci (stable, ubuntu-latest-amd64) (push) Failing after 2m34s
Golang Tests / unittest (stable, ubuntu-latest-arm64) (push) Successful in 3m42s
Golang CI lint / golangci (stable, ubuntu-latest-arm64) (push) Failing after 1m54s
2025-06-01 12:18:37 +02:00
6 changed files with 48 additions and 20 deletions

View File

@ -9,13 +9,16 @@ on:
jobs:
unittest:
runs-on:
- ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: [ stable ]
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-go@v5.5.0
with:
go-version: stable
go-version: ${{ matrix.go }}
- env:
GOPROXY: ${{ vars.GOPROXY }}
run: make test/unit

View File

@ -0,0 +1,27 @@
name: Golang CI lint
on:
pull_request:
types: [ "opened", "reopened", "synchronize" ]
push:
branches: [ '**' ]
tags-ignore: [ '**' ]
permissions:
contents: read
jobs:
golangci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: [ stable ]
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-go@v5.5.0
with:
go-version: ${{ matrix.go }}
- uses: golangci/golangci-lint-action@v8.0.0
with:
version: v2.1

View File

@ -1,20 +1,18 @@
name: Markdown linter
name: 'Lint Markdown files'
on:
pull_request:
types: [ "opened", "reopened", "synchronize" ]
push:
branches: [ '**' ]
tags-ignore: [ '**' ]
workflow_dispatch: {}
branches: [ '*' ]
tags-ignore: [ '*' ]
jobs:
markdown-lint:
container:
image: git.cryptic.systems/volker.raschek/markdownlint:0.45.0
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- name: Lint Markdown files
run: markdownlint --config .markdownlint.yaml .
- uses: DavidAnson/markdownlint-cli2-action@v19.1.0
with:
globs: '**/*.md'

View File

@ -5,5 +5,5 @@ import "git.cryptic.systems/volker.raschek/civ/cmd"
var version string
func main() {
cmd.Execute(version)
_ = cmd.Execute(version)
}

View File

@ -65,7 +65,7 @@ func (jr *JSONReader) ReadFile() (*domain.Config, error) {
if err != nil {
return nil, err
}
defer f.Close()
defer func() { _ = f.Close() }()
return jr.read(f)
}
@ -79,7 +79,7 @@ func (jw *JSONWriter) WriteFile(config *domain.Config) error {
if err != nil {
return err
}
defer func() { f.Close() }()
defer func() { _ = f.Close() }()
return jw.write(f, config)
}
@ -103,7 +103,7 @@ func (yr *YAMLReader) ReadFile() (*domain.Config, error) {
if err != nil {
return nil, err
}
defer f.Close()
defer func() { _ = f.Close() }()
return yr.read(f)
}
@ -129,7 +129,7 @@ func (yw *YAMLWriter) WriteFile(config *domain.Config) error {
if err != nil {
return err
}
defer func() { f.Close() }()
defer func() { _ = f.Close() }()
return yw.write(f, config)
}

View File

@ -14,8 +14,8 @@ import (
// ContainerRuntime is an interface for different container runtimes to return labels
// based on their full qualified container image name. For example:
//
// imageLabels, err := Load(ctx, "docker.io/library/alpine:latest")
// imageLabels, err := Load(ctx, "docker.io/library/busybox:latest")
// imageLabels, err := Load(ctx, "docker.io/library/alpine:latest")
// imageLabels, err := Load(ctx, "docker.io/library/busybox:latest")
type ContainerRuntime interface {
GetImageLabels(ctx context.Context, name string) (map[string]string, error)
}
@ -182,7 +182,7 @@ func labelCompareSemver(compareSemver *domain.LabelConstraintCompareSemver, pars
}
func labelCompareString(compareString *domain.LabelConstraintCompareString, labelValue string) bool {
var majorState bool = true
var majorState = true
// Equal
if compareString.Equal != "" {
@ -224,7 +224,7 @@ func labelCompareString(compareString *domain.LabelConstraintCompareString, labe
}
func labelCount(re *regexp.Regexp, labelConstraintCounter *domain.LabelConstraintCounter, labels map[string]string) bool {
var majorState bool = true
var majorState = true
var i uint = 0
for key := range labels {