Make golangci-lint more strict (#150)

* Reformat some YAML files

* Make `golangci-lint` more strict
This commit is contained in:
Joshua Spence
2023-06-23 09:00:12 +10:00
committed by GitHub
parent 5f0ca38414
commit 206f4be940
13 changed files with 105 additions and 76 deletions

View File

@@ -5,7 +5,7 @@ import (
"fmt"
)
// just to fix compile issues with the import
// just to fix compile issues with the import.
var (
_ fmt.Formatter
_ context.Context

View File

@@ -45,7 +45,6 @@ func (c *Client) UpdateDevice(ctx context.Context, site string, d *Device) (*Dev
func (c *Client) GetDevice(ctx context.Context, site, id string) (*Device, error) {
devices, err := c.ListDevice(ctx, site)
if err != nil {
return nil, err
}

View File

@@ -16,7 +16,7 @@ type Site struct {
Name string `json:"name"`
Description string `json:"desc"`
//Role string `json:"role"`
// Role string `json:"role"`
}
func (c *Client) ListSites(ctx context.Context) ([]Site, error) {
@@ -35,7 +35,6 @@ func (c *Client) ListSites(ctx context.Context) ([]Site, error) {
func (c *Client) GetSite(ctx context.Context, id string) (*Site, error) {
sites, err := c.ListSites(ctx)
if err != nil {
return nil, err
}

View File

@@ -95,7 +95,7 @@ func (c *Client) setAPIUrlStyle(ctx context.Context) error {
// see https://github.com/unifi-poller/unifi/blob/4dc44f11f61a2e08bf7ec5b20c71d5bced837b5d/unifi.go#L101-L104
// and https://github.com/unifi-poller/unifi/commit/43a6b225031a28f2b358f52d03a7217c7b524143
req, err := http.NewRequestWithContext(ctx, "GET", c.baseURL.String(), nil)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.baseURL.String(), nil)
if err != nil {
return err
}
@@ -243,7 +243,7 @@ func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody int
c.csrf = resp.Header.Get("x-csrf-token")
}
if resp.StatusCode != 200 {
if resp.StatusCode != http.StatusOK {
errBody := struct {
Meta meta `json:"meta"`
Data []struct {

View File

@@ -65,9 +65,9 @@ func (c *Client) CreateUser(ctx context.Context, site string, d *User) (*User, e
return nil, &NotFoundError{}
}
new := respBody.Data[0].Data[0]
user := respBody.Data[0].Data[0]
return &new, nil
return &user, nil
}
func (c *Client) stamgr(ctx context.Context, site, cmd string, data map[string]interface{}) ([]User, error) {