mirror of
https://github.com/securego/gosec.git
synced 2025-07-07 00:35:35 +02:00
Extend the bind rule to handle the case when the net.Listen address in provided from a const
This commit is contained in:
committed by
Cosmin Cojocar
parent
9b32fcac16
commit
24e3094d2a
@ -134,6 +134,21 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer l.Close()
|
||||
}`}, 1},
|
||||
{[]string{`
|
||||
package main
|
||||
import (
|
||||
"log"
|
||||
"net"
|
||||
)
|
||||
const addr = "0.0.0.0:2000"
|
||||
|
||||
func main() {
|
||||
l, err := net.Listen("tcp", addr)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer l.Close()
|
||||
}`}, 1},
|
||||
}
|
||||
// SampleCodeG103 find instances of unsafe blocks for auditing purposes
|
||||
|
Reference in New Issue
Block a user