Always use data as paramter name in UnmarshalJSON()

This commit is contained in:
Eric Lippmann 2021-06-10 14:22:23 +02:00
parent 63b8d98237
commit f3f07a29cc
3 changed files with 7 additions and 7 deletions

View file

@ -13,15 +13,15 @@ import (
type CommentType uint8
// UnmarshalJSON implements the json.Unmarshaler interface.
func (ct *CommentType) UnmarshalJSON(bytes []byte) error {
func (ct *CommentType) UnmarshalJSON(data []byte) error {
var i uint8
if err := internal.UnmarshalJSON(bytes, &i); err != nil {
if err := internal.UnmarshalJSON(data, &i); err != nil {
return err
}
c := CommentType(i)
if _, ok := commentTypes[c]; !ok {
return badCommentType(bytes)
return badCommentType(data)
}
*ct = c

View file

@ -12,9 +12,9 @@ import (
type NotificationStates uint8
// UnmarshalJSON implements the json.Unmarshaler interface.
func (nst *NotificationStates) UnmarshalJSON(bytes []byte) error {
func (nst *NotificationStates) UnmarshalJSON(data []byte) error {
var states []string
if err := internal.UnmarshalJSON(bytes, &states); err != nil {
if err := internal.UnmarshalJSON(data, &states); err != nil {
return err
}

View file

@ -12,9 +12,9 @@ import (
type NotificationTypes uint16
// UnmarshalJSON implements the json.Unmarshaler interface.
func (nt *NotificationTypes) UnmarshalJSON(bytes []byte) error {
func (nt *NotificationTypes) UnmarshalJSON(data []byte) error {
var types []string
if err := internal.UnmarshalJSON(bytes, &types); err != nil {
if err := internal.UnmarshalJSON(data, &types); err != nil {
return err
}