From 79dc866f437ea53e9794f83d0296ab089dc6c6cf Mon Sep 17 00:00:00 2001 From: Jeff Storey Date: Wed, 30 Mar 2016 07:58:24 -0400 Subject: [PATCH] getting rid of string split and using the regex match --- remote/github/github.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/remote/github/github.go b/remote/github/github.go index 867c23ec..9ace2477 100644 --- a/remote/github/github.go +++ b/remote/github/github.go @@ -260,14 +260,13 @@ func repoStatus(client *github.Client, r *model.Repo, b *model.Build, link strin } func deploymentStatus(client *github.Client, r *model.Repo, b *model.Build, link string) error { - // the deployment ID is only available in the the link to the build as the last element in the URL - parts := strings.Split(b.Link, "/") matches := githubDeployRegex.FindStringSubmatch(b.Link) // if the deployment was not triggered from github, don't send a deployment status if len(matches) != 2 { return nil } - id, _ := strconv.Atoi(parts[len(parts)-1]) + // the deployment ID is only available in the the link to the build as the last element in the URL + id, _ := strconv.Atoi(matches[1]) status := getStatus(b.Status) desc := getDesc(b.Status) data := github.DeploymentStatusRequest{