mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-22 15:16:33 -08:00
fix(plugin): resolve a closure (#1207)
There is a closure inside a function for Action field: variable p always refers on the last plugin. solution: redefine variable inside the for loop. Fixes #1086
This commit is contained in:
@@ -84,6 +84,7 @@ func LoadCommands() cli.Commands {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
for _, p := range plugins {
|
for _, p := range plugins {
|
||||||
|
p := p
|
||||||
cmd := &cli.Command{
|
cmd := &cli.Command{
|
||||||
Name: p.Name,
|
Name: p.Name,
|
||||||
Usage: p.Usage,
|
Usage: p.Usage,
|
||||||
|
|||||||
Reference in New Issue
Block a user