@@ -128,28 +128,29 @@ func (c *Cache) pkgActionID(pkg *packages.Package, mode HashMode) (cache.ActionI
128
128
}
129
129
130
130
func (c * Cache ) packageHash (pkg * packages.Package , mode HashMode ) (string , error ) {
131
- hashResI , ok := c .pkgHashes .Load (pkg )
132
- if ok {
133
- hashRes := hashResI .(hashResults )
134
- if _ , ok := hashRes [mode ]; ! ok {
135
- return "" , fmt . Errorf ( "no mode %d in hash result" , mode )
131
+ results , found := c .pkgHashes .Load (pkg )
132
+ if found {
133
+ hashRes := results .(hashResults )
134
+ if result , ok := hashRes [mode ]; ok {
135
+ return result , nil
136
136
}
137
137
138
- return hashRes [ mode ], nil
138
+ return "" , fmt . Errorf ( "no mode %d in hash result" , mode )
139
139
}
140
140
141
141
hashRes , err := c .computePkgHash (pkg )
142
142
if err != nil {
143
143
return "" , err
144
144
}
145
145
146
- if _ , ok := hashRes [mode ]; ! ok {
146
+ result , found := hashRes [mode ]
147
+ if ! found {
147
148
return "" , fmt .Errorf ("invalid mode %d" , mode )
148
149
}
149
150
150
151
c .pkgHashes .Store (pkg , hashRes )
151
152
152
- return hashRes [ mode ] , nil
153
+ return result , nil
153
154
}
154
155
155
156
// computePkgHash computes a package's hash.
0 commit comments