Skip to content

Commit 4657860

Browse files
authored
Merge pull request #15 from RaghavRoy145/slice-pointers
Return slice and map to functions instead of pointers
2 parents bfc41b8 + 6734068 commit 4657860

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cmd/validate.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var validateCmd = &cobra.Command{
6969
}
7070

7171
groupMap := context.PrefixToGroupMap()
72-
fileMap, errors := validateOwnersFilesInGroups(&groupMap)
72+
fileMap, errors := validateOwnersFilesInGroups(groupMap)
7373
errors2 := warnFileMismatchesBetweenKubernetesRepoAndSigsYaml(fileMap)
7474
errors = append(errors, errors2...)
7575

@@ -95,7 +95,7 @@ func warnFileMismatchesBetweenKubernetesRepoAndSigsYaml(fileMap map[string]strin
9595
continue
9696
}
9797
found := false
98-
for _, file := range *ownerFiles {
98+
for _, file := range ownerFiles {
9999
if len(file) == 0 {
100100
continue
101101
}
@@ -108,7 +108,7 @@ func warnFileMismatchesBetweenKubernetesRepoAndSigsYaml(fileMap map[string]strin
108108
}
109109
}
110110

111-
for _, file := range *ownerFiles {
111+
for _, file := range ownerFiles {
112112
if len(file) > 0 {
113113
if _, ok := fileMap[file]; !ok {
114114
errors = append(errors, fmt.Errorf("file [%s] is not in sigs.yaml", file))
@@ -119,10 +119,10 @@ func warnFileMismatchesBetweenKubernetesRepoAndSigsYaml(fileMap map[string]strin
119119
return errors
120120
}
121121

122-
func validateOwnersFilesInGroups(groupMap *map[string][]utils.Group) (map[string]string, []error) {
122+
func validateOwnersFilesInGroups(groupMap map[string][]utils.Group) (map[string]string, []error) {
123123
fileMap := map[string]string{}
124124
var errors []error
125-
for groupType, groups := range *groupMap {
125+
for groupType, groups := range groupMap {
126126
for _, group := range groups {
127127
for _, sub := range group.Subprojects {
128128
for _, filePath := range sub.Owners {

pkg/utils/github_utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func FetchPRCommentCount(user, repository string) (int, error) {
7676
return strconv.Atoi(fmt.Sprintf("%v", result["total_count"]))
7777
}
7878

79-
func GetKubernetesOwnersFiles() (*[]string, error) {
79+
func GetKubernetesOwnersFiles() ([]string, error) {
8080
resp, err := http.Get("https://api.github.com/repos/kubernetes/kubernetes/git/trees/master?recursive=1")
8181
if err != nil {
8282
return nil, err
@@ -108,5 +108,5 @@ func GetKubernetesOwnersFiles() (*[]string, error) {
108108
directories = append(directories, directory.Path)
109109
}
110110
}
111-
return &directories, nil
111+
return directories, nil
112112
}

0 commit comments

Comments
 (0)