Skip to content

Commit 647cf55

Browse files
authored
Simplify removeEmptyPort function implementation
1 parent 2eb154b commit 647cf55

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/net/http/http.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ func hasPort(s string) bool { return strings.LastIndex(s, ":") > strings.LastInd
113113
// removeEmptyPort strips the empty port in ":port" to ""
114114
// as mandated by RFC 3986 Section 6.2.3.
115115
func removeEmptyPort(host string) string {
116-
host, _ = strings.CutSuffix(host, ":")
117-
return host
116+
return strings.TrimSuffix(host, ":")
118117
}
119118

120119
// isToken reports whether v is a valid token (https://www.rfc-editor.org/rfc/rfc2616#section-2.2).

0 commit comments

Comments
 (0)