Skip to content

invalid-listen-address

Detect invalid constant HTTP listen addresses.

Updated View as Markdown

Default severity: error

http.ListenAndServe and http.ListenAndServeTLS expect a host and port separated by a colon. Either side may be omitted. Numeric ports must be in range; service names must use their supported letter, digit, and hyphen form.

Bad

http.ListenAndServe("localhost", handler)

Good

http.ListenAndServe(":8080", handler)
Navigation

Type to search…

↑↓ navigate↵ selectEsc close