Skip to content

Consistent use of non-pointer fields in URL option structs #3990

@Not-Dhananjay-Mishra

Description

@Not-Dhananjay-Mishra

As discuses in comment we should NOT use pointers for URL struct tags.

Example :

Currently (wrong) -

type GetAuditLogOptions struct {
Phrase *string `url:"phrase,omitempty"` // A search phrase. (Optional.)
Include *string `url:"include,omitempty"` // Event type includes. Can be one of "web", "git", "all". Default: "web". (Optional.)
Order *string `url:"order,omitempty"` // The order of audit log events. Can be one of "asc" or "desc". Default: "desc". (Optional.)
ListCursorOptions
}


Correct -

 type GetAuditLogOptions struct { 
 	Phrase  string `url:"phrase,omitempty"`
 	Include string `url:"include,omitempty"`
 	Order   string `url:"order,omitempty"`  
  
 	ListCursorOptions 
 }

Task :

  • Update all URL option structs to remove pointer fields
  • Update the structfield linter to catch this issue going forward

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions