diff --git a/ci/portlist.go b/ci/portlist.go index 47da43b..ad88269 100644 --- a/ci/portlist.go +++ b/ci/portlist.go @@ -32,9 +32,10 @@ func GetChangedPortList() ([]string, error) { } else if match = renameGrep.FindStringSubmatch(line); match == nil { continue } - if _, ok := portsFound[match[1]]; !ok { - portsFound[match[1]] = true - ports = append(ports, match[1]) + port := match[1] + if _, ok := portsFound[port]; !ok { + portsFound[port] = true + ports = append(ports, port) } } if err = gitCmd.Wait(); err != nil { diff --git a/pr/githubapi/pull_request.go b/pr/githubapi/pull_request.go index 03aad94..c95deeb 100644 --- a/pr/githubapi/pull_request.go +++ b/pr/githubapi/pull_request.go @@ -43,10 +43,11 @@ func (client *githubClient) ListChangedPortsAndFiles(owner, repo string, number } match := portGrep.FindStringSubmatch(fileName) if match != nil { - if idx, ok := portsFound[match[1]]; !ok { - ports = append(ports, match[1]) + port := match[1] + if idx, ok := portsFound[port]; !ok { + ports = append(ports, port) commitFiles = append(commitFiles, file) - portsFound[match[1]] = len(ports) - 1 + portsFound[port] = len(ports) - 1 } else { if match[2] == "Portfile" { commitFiles[idx] = file