File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,9 @@ var ngFuncMessages = map[string]string{
6565 "(*database/sql.Stmt).Query" : "must not be called. use (*database/sql.Conn).QueryContext" ,
6666 "(*database/sql.Stmt).QueryRow" : "must not be called. use (*database/sql.Conn).QueryRowContext" ,
6767
68+ // exec
69+ "os/exec.Command" : "must not be called. use os/exec.CommandContext" ,
70+
6871 // crypto/tls dialer
6972 "crypto/tls.Dial" : "must not be called. use (*crypto/tls.Dialer).DialContext" ,
7073 "crypto/tls.DialWithDialer" : "must not be called. use (*crypto/tls.Dialer).DialContext with NetDialer" ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ func TestAnalyzer(t *testing.T) {
1212 desc string
1313 }{
1414 {desc : "crypto_tls" },
15+ {desc : "exec_cmd" },
1516 {desc : "http_client" },
1617 {desc : "http_request" },
1718 {desc : "network" },
Original file line number Diff line number Diff line change 1+ package exec
2+
3+ import (
4+ "context"
5+ "os/exec"
6+ )
7+
8+ func _ () {
9+ ctx := context .Background ()
10+
11+ exec .Command ("ls" , "-l" ) // want `os/exec.Command must not be called. use os/exec.CommandContext`
12+
13+ exec .CommandContext (ctx , "ls" , "-l" )
14+ }
You can’t perform that action at this time.
0 commit comments