Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
atavism committed Aug 12, 2024
1 parent 32cdfc3 commit 318e336
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions masquerade.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,13 @@ type masquerade struct {
mx sync.RWMutex
}

// MarshalJSON marshals masquerade into json
func (m *masquerade) MarshalJSON() ([]byte, error) {
m.mx.RLock()
defer m.mx.RUnlock()
// Type alias for masquerade
type Alias masquerade
return json.Marshal(&struct {
*Alias
}{
Alias: (*Alias)(m),
})
// Type alias for masquerade so that we don't infinitely recurse when marshaling the struct
type alias masquerade
return json.Marshal((*alias)(m))
}

func (m *masquerade) lastSucceeded() time.Time {
Expand Down

0 comments on commit 318e336

Please sign in to comment.