Skip to content

Commit

Permalink
Remove helper required in go < 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed Apr 27, 2017
1 parent 7deb1a2 commit d1e77f1
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions core/pkg/ingress/annotations/authreq/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,10 @@ func (a authReq) Parse(ing *extensions.Ingress) (interface{}, error) {

return &External{
URL: str,
Host: stripPort(ur.Host),
Host: ur.Hostname(),
SigninURL: signin,
Method: m,
SendBody: sb,
ResponseHeaders: h,
}, nil
}

// TODO: Remove after upgrade to Go 1.8
func stripPort(hostport string) string {
colon := strings.IndexByte(hostport, ':')
if colon == -1 {
return hostport
}
if i := strings.IndexByte(hostport, ']'); i != -1 {
return strings.TrimPrefix(hostport[:i], "[")
}
return hostport[:colon]
}

0 comments on commit d1e77f1

Please sign in to comment.