Improve code readability

This commit is contained in:
Zero King
2019-01-08 11:33:49 +00:00
parent 61c263e7fe
commit a13ba9066e
2 changed files with 8 additions and 6 deletions

View File

@@ -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 {

View File

@@ -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