From ebefd7edaa5d6221a785c89bd5c303005ae42043 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Fri, 18 Mar 2022 22:58:59 -0400 Subject: cmd/update.go: use getCache() --- cmd/update.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cmd/update.go b/cmd/update.go index e825c66..f8b2219 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -4,7 +4,6 @@ import ( // "encoding/json" "github.com/pablotron/cvez/nvdmirror" "github.com/spf13/cobra" - "github.com/rs/zerolog/log" ) var updateCmd = &cobra.Command{ @@ -14,13 +13,6 @@ var updateCmd = &cobra.Command{ Long: `Update local NVD mirror.`, Run: func(cmd *cobra.Command, args []string) { - // create cache - cache, err := nvdmirror.NewJsonCache("stuff/cache.json.gz") - if err != nil { - log.Error().Err(err).Msg("NewJsonCache") - } - defer cache.Close() - // custom sync config config := nvdmirror.SyncConfig { Cve11BaseUrl: "https://pmdn.org/cvez-test/20220318/nvd/cve", @@ -30,7 +22,11 @@ var updateCmd = &cobra.Command{ CweListUrl: "https://pmdn.org/cvez-test/20220318/cwe/cwec_latest.xml.zip", } + // get cache and cache dir + cache, cacheDir := getCache() + defer cache.Close() + // sync data, get changed data - nvdmirror.Sync(config, &cache, "stuff") + nvdmirror.Sync(config, &cache, cacheDir) }, } -- cgit v1.2.3