1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 18:15:42 +01:00

Merge branch 'main' into downloader-client-certs

This commit is contained in:
Sascha L. Teichmann 2023-08-15 18:40:40 +02:00
commit 65f635d42d

View file

@ -11,24 +11,13 @@ package main
import ( import (
"fmt" "fmt"
"log"
"os" "os"
"path/filepath" "path/filepath"
"github.com/csaf-poc/csaf_distribution/v2/internal/options" "github.com/csaf-poc/csaf_distribution/v2/internal/options"
"github.com/gofrs/flock" "github.com/gofrs/flock"
"github.com/jessevdk/go-flags"
) )
func errCheck(err error) {
if err != nil {
if flags.WroteHelp(err) {
os.Exit(0)
}
log.Fatalf("error: %v\n", err)
}
}
func lock(lockFile *string, fn func() error) error { func lock(lockFile *string, fn func() error) error {
if lockFile == nil { if lockFile == nil {
// No locking configured. // No locking configured.
@ -57,7 +46,6 @@ func main() {
_, cfg, err := parseArgsConfig() _, cfg, err := parseArgsConfig()
options.ErrorCheck(err) options.ErrorCheck(err)
options.ErrorCheck(cfg.prepare()) options.ErrorCheck(cfg.prepare())
p := processor{cfg: cfg} p := processor{cfg: cfg}
errCheck(lock(cfg.LockFile, p.process)) options.ErrorCheck(lock(cfg.LockFile, p.process))
} }