Merge pull request #240 from zalando-incubator/feature/goreport-improvements

Some improvements for golint, ineffassign and misspell
This commit is contained in:
Dmitry Dolgov
2018-02-22 11:31:08 +01:00
committed by GitHub
8 changed files with 31 additions and 36 deletions
+5 -8
View File
@@ -164,8 +164,7 @@ func (s *Server) clusters(w http.ResponseWriter, req *http.Request) {
clusterNames = append(clusterNames, cluster.Name[len(matches["team"])+1:])
}
s.respond(clusterNames, nil, w)
return
resp, err = clusterNames, nil
} else if matches := util.FindNamedStringSubmatch(clusterLogsURL, req.URL.Path); matches != nil {
namespace, _ := matches["namespace"]
resp, err = s.controller.ClusterLogs(matches["team"], namespace, matches["cluster"])
@@ -173,17 +172,15 @@ func (s *Server) clusters(w http.ResponseWriter, req *http.Request) {
namespace, _ := matches["namespace"]
resp, err = s.controller.ClusterHistory(matches["team"], namespace, matches["cluster"])
} else if req.URL.Path == clustersURL {
res := make(map[string][]string)
clusterNamesPerTeam := make(map[string][]string)
for team, clusters := range s.controller.TeamClusterList() {
for _, cluster := range clusters {
res[team] = append(res[team], cluster.Name[len(team)+1:])
clusterNamesPerTeam[team] = append(clusterNamesPerTeam[team], cluster.Name[len(team)+1:])
}
}
s.respond(res, nil, w)
return
resp, err = clusterNamesPerTeam, nil
} else {
err = fmt.Errorf("page not found")
resp, err = nil, fmt.Errorf("page not found")
}
s.respond(resp, err, w)