X Tutup
Skip to content

Commit 83a08aa

Browse files
committed
Remove unnecessary pointers to Go maps
1 parent 8d9e8e3 commit 83a08aa

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

api/export_pr.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"strings"
66
)
77

8-
func (issue *Issue) ExportData(fields []string) *map[string]interface{} {
8+
func (issue *Issue) ExportData(fields []string) map[string]interface{} {
99
v := reflect.ValueOf(issue).Elem()
1010
data := map[string]interface{}{}
1111

@@ -25,10 +25,10 @@ func (issue *Issue) ExportData(fields []string) *map[string]interface{} {
2525
}
2626
}
2727

28-
return &data
28+
return data
2929
}
3030

31-
func (pr *PullRequest) ExportData(fields []string) *map[string]interface{} {
31+
func (pr *PullRequest) ExportData(fields []string) map[string]interface{} {
3232
v := reflect.ValueOf(pr).Elem()
3333
data := map[string]interface{}{}
3434

@@ -102,7 +102,7 @@ func (pr *PullRequest) ExportData(fields []string) *map[string]interface{} {
102102
}
103103
}
104104

105-
return &data
105+
return data
106106
}
107107

108108
func fieldByName(v reflect.Value, field string) reflect.Value {

api/export_repo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
)
66

7-
func (repo *Repository) ExportData(fields []string) *map[string]interface{} {
7+
func (repo *Repository) ExportData(fields []string) map[string]interface{} {
88
v := reflect.ValueOf(repo).Elem()
99
data := map[string]interface{}{}
1010

@@ -38,7 +38,7 @@ func (repo *Repository) ExportData(fields []string) *map[string]interface{} {
3838
}
3939
}
4040

41-
return &data
41+
return data
4242
}
4343

4444
func miniRepoExport(r *Repository) map[string]interface{} {

internal/codespaces/api/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ var CodespaceFields = []string{
189189
"lastUsedAt",
190190
}
191191

192-
func (c *Codespace) ExportData(fields []string) *map[string]interface{} {
192+
func (c *Codespace) ExportData(fields []string) map[string]interface{} {
193193
v := reflect.ValueOf(c).Elem()
194194
data := map[string]interface{}{}
195195

@@ -213,7 +213,7 @@ func (c *Codespace) ExportData(fields []string) *map[string]interface{} {
213213
}
214214
}
215215

216-
return &data
216+
return data
217217
}
218218

219219
// ListCodespaces returns a list of codespaces for the user. Pass a negative limit to request all pages from

pkg/cmd/codespace/ports.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ var portFields = []string{
143143
"browseUrl",
144144
}
145145

146-
func (pi *portInfo) ExportData(fields []string) *map[string]interface{} {
146+
func (pi *portInfo) ExportData(fields []string) map[string]interface{} {
147147
data := map[string]interface{}{}
148148

149149
for _, f := range fields {
@@ -163,7 +163,7 @@ func (pi *portInfo) ExportData(fields []string) *map[string]interface{} {
163163
}
164164
}
165165

166-
return &data
166+
return data
167167
}
168168

169169
type devContainerResult struct {

pkg/cmd/release/shared/fetch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ type ReleaseAsset struct {
7474
BrowserDownloadURL string `json:"browser_download_url"`
7575
}
7676

77-
func (rel *Release) ExportData(fields []string) *map[string]interface{} {
77+
func (rel *Release) ExportData(fields []string) map[string]interface{} {
7878
v := reflect.ValueOf(rel).Elem()
7979
fieldByName := func(v reflect.Value, field string) reflect.Value {
8080
return v.FieldByNameFunc(func(s string) bool {
@@ -114,7 +114,7 @@ func (rel *Release) ExportData(fields []string) *map[string]interface{} {
114114
}
115115
}
116116

117-
return &data
117+
return data
118118
}
119119

120120
// FetchRelease finds a repository release by its tagName.

pkg/cmdutil/json_flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (e *exportFormat) exportData(v reflect.Value) interface{} {
179179
}
180180

181181
type exportable interface {
182-
ExportData([]string) *map[string]interface{}
182+
ExportData([]string) map[string]interface{}
183183
}
184184

185185
var exportableType = reflect.TypeOf((*exportable)(nil)).Elem()

pkg/cmdutil/json_flags_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ type exportableItem struct {
198198
Name string
199199
}
200200

201-
func (e *exportableItem) ExportData(fields []string) *map[string]interface{} {
201+
func (e *exportableItem) ExportData(fields []string) map[string]interface{} {
202202
m := map[string]interface{}{}
203203
for _, f := range fields {
204204
m[f] = fmt.Sprintf("%s:%s", e.Name, f)
205205
}
206-
return &m
206+
return m
207207
}

0 commit comments

Comments
 (0)
X Tutup