Skip to content

Commit

Permalink
Use pointer receivers for some types:
Browse files Browse the repository at this point in the history
- Trie `Node`'s `Copy` method
- pprof `Settings`'s `String` method
Keep value receivers for some types:
- Keep value receivers for VDTs
- `common.Hash`, `transaction.priorityQueue`
  • Loading branch information
qdm12 committed Jan 24, 2023
1 parent 758ea3f commit 6e26064
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/pprof/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ type Settings struct {
MutexProfileRate int
}

func (s *Settings) setDefaults() { //skipcq: GO-W1029
func (s *Settings) setDefaults() {
if s.ListeningAddress == "" {
s.ListeningAddress = "localhost:6060"
}
}

func (s Settings) String() string { //skipcq: GO-W1029
func (s *Settings) String() string {
return fmt.Sprintf(
"listening on %s and setting block profile rate to %d, mutex profile rate to %d",
s.ListeningAddress, s.BlockProfileRate, s.MutexProfileRate)
Expand Down
2 changes: 1 addition & 1 deletion internal/trie/node/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type CopySettings struct {
// Copy deep copies the node.
// Setting copyChildren to true will deep copy
// children as well.
func (n *Node) Copy(settings CopySettings) *Node { //skipcq: GO-W1029
func (n *Node) Copy(settings CopySettings) *Node {
cpy := &Node{
Dirty: n.Dirty,
Generation: n.Generation,
Expand Down
2 changes: 1 addition & 1 deletion pkg/scale/varying_data_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (vdt *VaryingDataType) Value() (VaryingDataTypeValue, error) { //skipcq: GO
return vdt.value, nil
}

func (vdt VaryingDataType) String() string { //skipcq: GO-W1029
func (vdt *VaryingDataType) String() string { //skipcq: GO-W1029
if vdt.value == nil {
return "VaryingDataType(nil)"
}
Expand Down

0 comments on commit 6e26064

Please sign in to comment.