github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/staticcheck/testdata/src/CheckListenAddress/CheckListenAddress.go (about)

     1  package pkg
     2  
     3  import "net/http"
     4  
     5  func fn() {
     6  	// Seen in actual code
     7  	http.ListenAndServe("localhost:8080/", nil) // MATCH /invalid port or service name in host:port pair/
     8  	http.ListenAndServe("localhost", nil)       // MATCH /invalid port or service name in host:port pair/
     9  	http.ListenAndServe("localhost:8080", nil)
    10  	http.ListenAndServe(":8080", nil)
    11  	http.ListenAndServe(":http", nil)
    12  	http.ListenAndServe("localhost:http", nil)
    13  	http.ListenAndServe("local_host:8080", nil)
    14  }