pkg/proc/internal/ebpf: remove redundant nil check (#3502)

From the Go specification:

  "1. For a nil slice, the number of iterations is 0." [1]

Therefore, an additional nil check for before the loop is unnecessary.

[1]: https://go.dev/ref/spec#For_range

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2023-09-18 23:01:52 +08:00
committed by GitHub
parent c7097b8e1d
commit 382bb0fde6

View File

@ -71,10 +71,8 @@ func (ctx *EBPFContext) Close() {
if ctx.objs != nil {
ctx.objs.Close()
}
if ctx.links != nil {
for _, l := range ctx.links {
l.Close()
}
for _, l := range ctx.links {
l.Close()
}
}