mirror of
https://github.com/anchore/syft
synced 2024-09-20 22:21:56 +00:00
97f0f83544
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
30 lines
833 B
Go
30 lines
833 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/anchore/syft/internal"
|
|
"github.com/anchore/syft/internal/bus"
|
|
"github.com/anchore/syft/internal/log"
|
|
"github.com/anchore/syft/internal/version"
|
|
"github.com/anchore/syft/syft/event"
|
|
"github.com/wagoodman/go-partybus"
|
|
)
|
|
|
|
func checkForApplicationUpdate() {
|
|
if appConfig.CheckForAppUpdate {
|
|
isAvailable, newVersion, err := version.IsUpdateAvailable()
|
|
if err != nil {
|
|
// this should never stop the application
|
|
log.Errorf(err.Error())
|
|
}
|
|
if isAvailable {
|
|
log.Infof("new version of %s is available: %s (current version is %s)", internal.ApplicationName, newVersion, version.FromBuild().Version)
|
|
|
|
bus.Publish(partybus.Event{
|
|
Type: event.AppUpdateAvailable,
|
|
Value: newVersion,
|
|
})
|
|
} else {
|
|
log.Debugf("no new %s update available", internal.ApplicationName)
|
|
}
|
|
}
|
|
}
|