-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.ImplementationIssues describing a semantics-preserving change to the Go implementation.Issues describing a semantics-preserving change to the Go implementation.Performance
Milestone
Description
Line 115 in f22d37d
| func removeEmptyPort(host string) string { |
func removeEmptyPort(host string) string {
if hasPort(host) {
return strings.TrimSuffix(host, ":")
}
return host
}
can be optimized to:
func removeEmptyPort(host string) string {
if len(host) > 0 && host[len(host)-1] == ':' {
return host[:len(host)-1]
}
return host
}
or using strings.HasSuffix:
func removeEmptyPort(host string) string {
if hasPort(host) && strings.HasSuffix(host, ":") {
return strings.TrimSuffix(host, ":")
}
return host
}
Metadata
Metadata
Assignees
Labels
FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.ImplementationIssues describing a semantics-preserving change to the Go implementation.Issues describing a semantics-preserving change to the Go implementation.Performance