Usage of both value and pointer receivers GO-W1029
Anti-pattern
Major
3 days ago2 years old
Type "RedactInfoLogType" has both value and pointer receivers
142}
143
144// UnmarshalTOML implements the `toml.Unmarshaler` interface to ensure the compatibility.
145func (t *RedactInfoLogType) UnmarshalTOML(data any) error {146	switch v := data.(type) {
147	case bool:
148		if v {
Type "RedactInfoLogType" has both value and pointer receivers
121const invalidRedactInfoLogTypeErrMsg = `the "redact-info-log" value is invalid; it should be either false, true, or "MARKER"`
122
123// UnmarshalJSON implements the `json.Marshaler` interface to ensure the compatibility.
124func (t *RedactInfoLogType) UnmarshalJSON(data []byte) error {125	var s string
126	err := json.Unmarshal(data, &s)
127	if err == nil && strings.ToUpper(s) == "MARKER" {
Type "RedactInfoLogType" has both value and pointer receivers
107)
108
109// MarshalJSON implements the `json.Marshaler` interface to ensure the compatibility.
110func (t RedactInfoLogType) MarshalJSON() ([]byte, error) {111	switch t {
112	case RedactInfoLogON:
113		return json.Marshal(true)
Type "indices" has both value and pointer receivers
 298	// no need to clear
 299}
 300
 301func (s indices) find(k int) (index int, found bool) { 302	i := sort.SearchInts(s, k)
 303	return i, s[i] == k
 304}
Type "indices" has both value and pointer receivers
 293	return out
 294}
 295
 296func (s *indices) truncate(index int) { 297	*s = (*s)[:index]
 298	// no need to clear
 299}