MCPcopy
hub / github.com/docker/docker-agent / networkIOCall

Function networkIOCall

lint/constructor_network_io.go:50–62  ·  view source on GitHub ↗
(p *cop.Pass, call *ast.CallExpr)

Source from the content-addressed store, hash-verified

48}
49
50func networkIOCall(p *cop.Pass, call *ast.CallExpr) (string, string, bool) {
51 if pkg, name, ok := networkIOFuncName(calleeObject(p.Info, call)); ok {
52 return pkg, name, true
53 }
54
55 if name, ok := cop.CallTo(call, "net", "Dial", "DialTimeout", "Listen", "ListenPacket", "ListenTCP", "ListenUDP", "ListenUnix"); ok {
56 return "net", name, true
57 }
58 if name, ok := cop.CallTo(call, "http", "Get", "Head", "Post", "PostForm"); ok {
59 return "http", name, true
60 }
61 return "", "", false
62}
63
64func networkIOFuncName(obj types.Object) (string, string, bool) {
65 fn, ok := obj.(*types.Func)

Callers 1

Calls 2

networkIOFuncNameFunction · 0.85
calleeObjectFunction · 0.85

Tested by

no test coverage detected