Remove unnecessary pointers to Go maps
This commit is contained in:
parent
8d9e8e317e
commit
83a08aa3ba
7 changed files with 15 additions and 15 deletions
|
|
@ -5,7 +5,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
func (issue *Issue) ExportData(fields []string) *map[string]interface{} {
|
||||
func (issue *Issue) ExportData(fields []string) map[string]interface{} {
|
||||
v := reflect.ValueOf(issue).Elem()
|
||||
data := map[string]interface{}{}
|
||||
|
||||
|
|
@ -25,10 +25,10 @@ func (issue *Issue) ExportData(fields []string) *map[string]interface{} {
|
|||
}
|
||||
}
|
||||
|
||||
return &data
|
||||
return data
|
||||
}
|
||||
|
||||
func (pr *PullRequest) ExportData(fields []string) *map[string]interface{} {
|
||||
func (pr *PullRequest) ExportData(fields []string) map[string]interface{} {
|
||||
v := reflect.ValueOf(pr).Elem()
|
||||
data := map[string]interface{}{}
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ func (pr *PullRequest) ExportData(fields []string) *map[string]interface{} {
|
|||
}
|
||||
}
|
||||
|
||||
return &data
|
||||
return data
|
||||
}
|
||||
|
||||
func fieldByName(v reflect.Value, field string) reflect.Value {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"reflect"
|
||||
)
|
||||
|
||||
func (repo *Repository) ExportData(fields []string) *map[string]interface{} {
|
||||
func (repo *Repository) ExportData(fields []string) map[string]interface{} {
|
||||
v := reflect.ValueOf(repo).Elem()
|
||||
data := map[string]interface{}{}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ func (repo *Repository) ExportData(fields []string) *map[string]interface{} {
|
|||
}
|
||||
}
|
||||
|
||||
return &data
|
||||
return data
|
||||
}
|
||||
|
||||
func miniRepoExport(r *Repository) map[string]interface{} {
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ var CodespaceFields = []string{
|
|||
"lastUsedAt",
|
||||
}
|
||||
|
||||
func (c *Codespace) ExportData(fields []string) *map[string]interface{} {
|
||||
func (c *Codespace) ExportData(fields []string) map[string]interface{} {
|
||||
v := reflect.ValueOf(c).Elem()
|
||||
data := map[string]interface{}{}
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ func (c *Codespace) ExportData(fields []string) *map[string]interface{} {
|
|||
}
|
||||
}
|
||||
|
||||
return &data
|
||||
return data
|
||||
}
|
||||
|
||||
// ListCodespaces returns a list of codespaces for the user. Pass a negative limit to request all pages from
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ var portFields = []string{
|
|||
"browseUrl",
|
||||
}
|
||||
|
||||
func (pi *portInfo) ExportData(fields []string) *map[string]interface{} {
|
||||
func (pi *portInfo) ExportData(fields []string) map[string]interface{} {
|
||||
data := map[string]interface{}{}
|
||||
|
||||
for _, f := range fields {
|
||||
|
|
@ -163,7 +163,7 @@ func (pi *portInfo) ExportData(fields []string) *map[string]interface{} {
|
|||
}
|
||||
}
|
||||
|
||||
return &data
|
||||
return data
|
||||
}
|
||||
|
||||
type devContainerResult struct {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ type ReleaseAsset struct {
|
|||
BrowserDownloadURL string `json:"browser_download_url"`
|
||||
}
|
||||
|
||||
func (rel *Release) ExportData(fields []string) *map[string]interface{} {
|
||||
func (rel *Release) ExportData(fields []string) map[string]interface{} {
|
||||
v := reflect.ValueOf(rel).Elem()
|
||||
fieldByName := func(v reflect.Value, field string) reflect.Value {
|
||||
return v.FieldByNameFunc(func(s string) bool {
|
||||
|
|
@ -114,7 +114,7 @@ func (rel *Release) ExportData(fields []string) *map[string]interface{} {
|
|||
}
|
||||
}
|
||||
|
||||
return &data
|
||||
return data
|
||||
}
|
||||
|
||||
// FetchRelease finds a repository release by its tagName.
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ func (e *exportFormat) exportData(v reflect.Value) interface{} {
|
|||
}
|
||||
|
||||
type exportable interface {
|
||||
ExportData([]string) *map[string]interface{}
|
||||
ExportData([]string) map[string]interface{}
|
||||
}
|
||||
|
||||
var exportableType = reflect.TypeOf((*exportable)(nil)).Elem()
|
||||
|
|
|
|||
|
|
@ -198,10 +198,10 @@ type exportableItem struct {
|
|||
Name string
|
||||
}
|
||||
|
||||
func (e *exportableItem) ExportData(fields []string) *map[string]interface{} {
|
||||
func (e *exportableItem) ExportData(fields []string) map[string]interface{} {
|
||||
m := map[string]interface{}{}
|
||||
for _, f := range fields {
|
||||
m[f] = fmt.Sprintf("%s:%s", e.Name, f)
|
||||
}
|
||||
return &m
|
||||
return m
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue