Add cron jobs to service

This commit is contained in:
dwrz
2026-06-02 12:04:02 +00:00
parent e5238e4081
commit 6fb63c8c90
84 changed files with 3022 additions and 2452 deletions

View File

@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build go1.18
// +build go1.18
package buildinfo

View File

@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build go1.18
// +build go1.18
package buildinfo

View File

@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build go1.18
// +build go1.18
package buildinfo

View File

@@ -11,7 +11,7 @@ import (
//lint:file-ignore ST1005 Ignore staticcheck message about error formatting
var (
// ErrVulnerabilitiesFound indicates that vulnerabilities were detected
// errVulnerabilitiesFound indicates that vulnerabilities were detected
// when running govulncheck. This returns exit status 3 when running
// without the -json flag.
errVulnerabilitiesFound = &exitCodeError{message: "vulnerabilities found", code: 3}
@@ -25,6 +25,18 @@ var (
// govulncheck and exit with status 2.
errUsage = &exitCodeError{message: "invalid usage", code: 2}
// errNoPatterns indicates that no package patterns were provided if the scan level is WantPackages.
errNoPatterns = &exitCodeError{
message: "no package patterns provided\n\nTo scan the current module, run: govulncheck ./...",
code: 2,
}
// errNoPackagesMatched indicates that the provided patterns matched no packages if scan level is WantPackages.
errNoPackagesMatched = &exitCodeError{
message: "no packages matched the provided patterns",
code: 2,
}
// errGoVersionMismatch is used to indicate that there is a mismatch between
// the Go version used to build govulncheck and the one currently on PATH.
errGoVersionMismatch = errors.New(`Loading packages failed, possibly due to a mismatch between the Go version

View File

@@ -25,6 +25,7 @@ type config struct {
test bool
show ShowFlag
format FormatFlag
version bool
env []string
}
@@ -72,6 +73,7 @@ Usage:
cfg.patterns = flags.Args()
if version {
cfg.show = append(cfg.show, "version")
cfg.version = true
}
cfg.ScanLevel = govulncheck.ScanLevel(scanFlag)
cfg.ScanMode = govulncheck.ScanMode(modeFlag)

View File

@@ -55,6 +55,12 @@ func RunGovulncheck(ctx context.Context, env []string, r io.Reader, stdout io.Wr
return err
}
if cfg.version {
// If the -version flag is passed, exit before doing anything else. This is different than
// passing -show which includes "version".
return nil
}
incTelemetryFlagCounters(cfg)
switch cfg.ScanMode {

View File

@@ -24,7 +24,7 @@ func runSource(ctx context.Context, handler govulncheck.Handler, cfg *config, cl
defer derrors.Wrap(&err, "govulncheck")
if cfg.ScanLevel.WantPackages() && len(cfg.patterns) == 0 {
return nil // don't throw an error here
return errNoPatterns
}
if !gomodExists(dir) {
return errNoGoMod
@@ -43,7 +43,7 @@ func runSource(ctx context.Context, handler govulncheck.Handler, cfg *config, cl
}
if cfg.ScanLevel.WantPackages() && len(graph.TopPkgs()) == 0 {
return nil // early exit
return errNoPackagesMatched
}
return vulncheck.Source(ctx, handler, &cfg.Config, client, graph)
}

View File

@@ -93,7 +93,7 @@ func callGraph(ctx context.Context, prog *ssa.Program, entries []*ssa.Function)
// - pointer designation * is skipped
// - full path prefix is skipped as well
func dbTypeFormat(t types.Type) string {
switch tt := t.(type) {
switch tt := types.Unalias(t).(type) {
case *types.Pointer:
return dbTypeFormat(tt.Elem())
case *types.Named: