@@ -76,14 +76,14 @@ func (act *action) persistFactsToCache() error {
7676
7777 factsCacheDebugf ("Caching %d facts for package %q and analyzer %s" , len (facts ), act .pkg .Name , act .a .Name )
7878
79- key := fmt .Sprintf ("%s/facts" , analyzer .Name )
80- return act .r .pkgCache .Put (act .pkg , cache .HashModeNeedAllDeps , key , facts )
79+ return act .r .pkgCache .Put (act .pkg , cache .HashModeNeedAllDeps , factCacheKey (analyzer ), facts )
8180}
8281
8382func (act * action ) loadPersistedFacts () bool {
8483 var facts []Fact
85- key := fmt .Sprintf ("%s/facts" , act .a .Name )
86- if err := act .r .pkgCache .Get (act .pkg , cache .HashModeNeedAllDeps , key , & facts ); err != nil {
84+
85+ err := act .r .pkgCache .Get (act .pkg , cache .HashModeNeedAllDeps , factCacheKey (act .a ), & facts )
86+ if err != nil {
8787 if ! errors .Is (err , cache .ErrMissing ) && ! errors .Is (err , io .EOF ) {
8888 act .r .log .Warnf ("Failed to get persisted facts: %s" , err )
8989 }
@@ -121,3 +121,7 @@ func (act *action) loadPersistedFacts() bool {
121121
122122 return true
123123}
124+
125+ func factCacheKey (a * analysis.Analyzer ) string {
126+ return fmt .Sprintf ("%s/facts" , a .Name )
127+ }
0 commit comments