github-vet / github-vet/rangeloop-pointer-findings
saarasio/enroute: enroute-dp/saaras/saarascloudcache.go; 23 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [saarasio/enroute](https://www.github.com/saarasio/enroute) at [enroute-dp/saaras/saarascloudcache.go](https://github.com/saarasio/enroute/blob/822ce08e9b2b7f815649fe0afff7d0d7d604c706/enroute-dp/saaras/saarascloudcache.go#L437-L459)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
> reference to secret is reassigned at line 450
[Click here to see the code in its original context.](https://github.com/saarasio/enroute/blob/822ce08e9b2b7f815649fe0afff7d0d7d604c706/enroute-dp/saaras/saarascloudcache.go#L437-L459)
Click here to show the 23 line(s) of Go which triggered the analyzer.
```go
for _, secret := range *secrets {
// TODO - encode this in a function
secret_cache_map_key := secret.Namespace + "_" + secret.Name
if sac.sdbsecrets == nil {
sac.sdbsecrets = make(map[string]*v1.Secret)
// config.GCC.Sdbpg = &(sac.sdbpg)
}
if cached_v1_secret, ok := sac.sdbsecrets[secret_cache_map_key]; ok {
// Found secret in cache
if apiequality.Semantic.DeepEqual(*cached_v1_secret, secret) {
} else {
fmt.Printf("Diff [%s]\n", diff.ObjectGoPrintDiff(*cached_v1_secret, secret))
sac.sdbsecrets[secret_cache_map_key] = &secret
reh.OnUpdate(cached_v1_secret, &secret)
}
} else {
// Secret not found in cache
fmt.Printf("update_saaras_secret_cache() Insert secret in Saaras Cache[%s]\n", secret_cache_map_key)
sac.sdbsecrets[secret_cache_map_key] = &secret
reh.OnAdd(&secret)
}
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 822ce08e9b2b7f815649fe0afff7d0d7d604c706
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.