MCPcopy
hub / github.com/fabiolb/fabio / hostport

Function hostport

logger/pattern.go:284–290  ·  view source on GitHub ↗

hostport is a simplified no-alloc version of net.SplitHostPort. Since we know that the address values have the correct form we can skip all the error checking.

(s string)

Source from the content-addressed store, hash-verified

282// address values have the correct form we can
283// skip all the error checking.
284func hostport(s string) (host, port string) {
285 if s == "" {
286 return "", ""
287 }
288 n := strings.LastIndexByte(s, ':')
289 return s[:n], s[n+1:]
290}
291
292// atoi is a replacement for strconv.Atoi/strconv.FormatInt
293// which does not alloc.

Callers 1

pattern.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected