Fixed linter errors
This commit is contained in:
@ -21,6 +21,7 @@ const (
|
||||
|
||||
// ShopItem is a purchasable item in the shop.
|
||||
type ShopItem struct {
|
||||
ID string `json:"id" primary:"true"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Price uint `json:"price"`
|
||||
@ -28,8 +29,11 @@ type ShopItem struct {
|
||||
Rarity string `json:"rarity"`
|
||||
Order int `json:"order"`
|
||||
Consumable bool `json:"consumable"`
|
||||
}
|
||||
|
||||
hasID
|
||||
// GetID returns the ID.
|
||||
func (item *ShopItem) GetID() string {
|
||||
return item.ID
|
||||
}
|
||||
|
||||
// GetShopItem ...
|
||||
|
15
arn/User.go
15
arn/User.go
@ -175,11 +175,11 @@ func (user *User) SendNotification(pushNotification *PushNotification) {
|
||||
expired := []*PushSubscription{}
|
||||
|
||||
for _, sub := range subs.Items {
|
||||
resp, err := sub.SendNotification(pushNotification)
|
||||
response, err := sub.SendNotification(pushNotification)
|
||||
|
||||
if resp != nil && resp.StatusCode == http.StatusGone {
|
||||
// It is possible to receive a non-nil response with an error, so check the status.
|
||||
if response != nil && response.StatusCode == http.StatusGone {
|
||||
expired = append(expired, sub)
|
||||
continue
|
||||
}
|
||||
|
||||
// Print errors
|
||||
@ -188,10 +188,13 @@ func (user *User) SendNotification(pushNotification *PushNotification) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Response body must be closed if no error was returned
|
||||
defer response.Body.Close()
|
||||
|
||||
// Print bad status codes
|
||||
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
fmt.Println(resp.StatusCode, string(body))
|
||||
if response.StatusCode != http.StatusOK && response.StatusCode != http.StatusCreated {
|
||||
body, _ := ioutil.ReadAll(response.Body)
|
||||
fmt.Println(response.StatusCode, string(body))
|
||||
continue
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user