diff options
| -rw-r--r-- | cmd/cmd.go | 13 | 
1 files changed, 8 insertions, 5 deletions
@@ -44,24 +44,27 @@ func getDb() dbstore.DbStore {    return db  } -// Get cache. -func getCache() nvdmirror.JsonCache { +// Get cache and cache directory path. +func getCache() (nvdmirror.JsonCache, string) {    // get path to cache directory -  cacheDir, err := datadir.CacheDir() +  dir, err := datadir.CacheDir()    if err != nil {      log.Error().Err(err).Msg("CacheDir")      os.Exit(-1)    } +  // build cache file path +  cachePath := filepath.Join(dir, "cache.json.gz") +    // create cache -  cache, err := nvdmirror.NewJsonCache(filepath.Join(cacheDir, "cache.json.gz")) +  cache, err := nvdmirror.NewJsonCache(cachePath)    if err != nil {      log.Error().Err(err).Msg("NewJsonCache")      os.Exit(-1)    }    // return cache -  return cache +  return cache, dir  }  // JSON encode data and write it to standard output  | 
