debian-forge-composer/cmd/osbuild-worker-executor/build_result.go
Sanne Raymaekers b0543e89f4 osbuild-worker-executor: fix lint warnings/errors
The osbuild-composer linting found a bunch of issues that this
commit fixes.
2024-06-05 18:26:08 +02:00

37 lines
722 B
Go

package main
import (
"os"
"path/filepath"
)
type buildResult struct {
resultGood string
resultBad string
}
func newBuildResult(config *Config) *buildResult {
return &buildResult{
resultGood: filepath.Join(config.BuildDirBase, "result.good"),
resultBad: filepath.Join(config.BuildDirBase, "result.bad"),
}
}
func (br *buildResult) Mark(err error) error {
if err == nil {
return os.WriteFile(br.resultGood, nil, 0600)
} else {
return os.WriteFile(br.resultBad, nil, 0600)
}
}
// todo: switch to (Good, Bad, Unknown)
func (br *buildResult) Good() bool {
_, err := os.Stat(br.resultGood)
return err == nil
}
func (br *buildResult) Bad() bool {
_, err := os.Stat(br.resultBad)
return err == nil
}