Skip to content

Commit

Permalink
Silence gofumpt (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsch authored Feb 27, 2024
1 parent a5f591c commit 792278f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion fastly/alerts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func TestClient_FastlyAlerts(t *testing.T) {
var ad *AlertDefinition
record(t, "alerts/create_alert_definition", func(c *Client) {
ad, err = c.CreateAlertDefinition(cadi)

})
if err != nil {
t.Fatal(err)
Expand Down
10 changes: 5 additions & 5 deletions fastly/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func NewClient(key string) (*Client, error) {
// endpoint. Because Fastly allows some requests without an API key, this
// function will not error if the API token is not supplied. Attempts to make a
// request that requires an API key will return a 403 response.
func NewClientForEndpoint(key string, endpoint string) (*Client, error) {
func NewClientForEndpoint(key, endpoint string) (*Client, error) {
client := &Client{apiKey: key, Address: endpoint}

if endpoint, ok := os.LookupEnv(DebugEnvVar); ok && endpoint == "true" {
Expand Down Expand Up @@ -261,12 +261,12 @@ func (c *Client) PutForm(p string, i any, ro *RequestOptions) (*http.Response, e
}

// PutFormFile issues an HTTP PUT request (multipart/form-encoded) to put a file to an endpoint.
func (c *Client) PutFormFile(urlPath string, filePath string, fieldName string, ro *RequestOptions) (*http.Response, error) {
func (c *Client) PutFormFile(urlPath, filePath, fieldName string, ro *RequestOptions) (*http.Response, error) {
return c.RequestFormFile("PUT", urlPath, filePath, fieldName, ro)
}

// PutFormFileFromReader issues an HTTP PUT request (multipart/form-encoded) to put a file to an endpoint.
func (c *Client) PutFormFileFromReader(urlPath string, fileName string, fileBytes io.Reader, fieldName string, ro *RequestOptions) (*http.Response, error) {
func (c *Client) PutFormFileFromReader(urlPath, fileName string, fileBytes io.Reader, fieldName string, ro *RequestOptions) (*http.Response, error) {
return c.RequestFormFileFromReader("PUT", urlPath, fileName, fileBytes, fieldName, ro)
}

Expand Down Expand Up @@ -492,7 +492,7 @@ func (c *Client) RequestForm(verb, p string, i any, ro *RequestOptions) (*http.R
}

// RequestFormFile makes an HTTP request to upload a file to an endpoint.
func (c *Client) RequestFormFile(verb, urlPath string, filePath string, fieldName string, ro *RequestOptions) (*http.Response, error) {
func (c *Client) RequestFormFile(verb, urlPath, filePath, fieldName string, ro *RequestOptions) (*http.Response, error) {
file, err := os.Open(filepath.Clean(filePath))
if err != nil {
return nil, fmt.Errorf("error reading file: %v", err)
Expand All @@ -503,7 +503,7 @@ func (c *Client) RequestFormFile(verb, urlPath string, filePath string, fieldNam
}

// RequestFormFileFromReader makes an HTTP request to upload a raw reader to an endpoint.
func (c *Client) RequestFormFileFromReader(verb, urlPath string, fileName string, fileBytes io.Reader, fieldName string, ro *RequestOptions) (*http.Response, error) {
func (c *Client) RequestFormFileFromReader(verb, urlPath, fileName string, fileBytes io.Reader, fieldName string, ro *RequestOptions) (*http.Response, error) {
var body bytes.Buffer
writer := multipart.NewWriter(&body)
part, err := writer.CreateFormFile(fieldName, fileName)
Expand Down
12 changes: 6 additions & 6 deletions fastly/fastly_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func recordRealtimeStats(t *testing.T, fixture string, f func(*RTSClient)) {
f(client)
}

func createTestService(t *testing.T, serviceFixture string, serviceNameSuffix string) *Service {
func createTestService(t *testing.T, serviceFixture, serviceNameSuffix string) *Service {
var err error
var service *Service

Expand All @@ -137,7 +137,7 @@ func createTestService(t *testing.T, serviceFixture string, serviceNameSuffix st
return service
}

func createTestServiceWasm(t *testing.T, serviceFixture string, serviceNameSuffix string) *Service {
func createTestServiceWasm(t *testing.T, serviceFixture, serviceNameSuffix string) *Service {
var err error
var service *Service

Expand Down Expand Up @@ -169,7 +169,7 @@ func testVersion(t *testing.T, c *Client) *Version {
return v
}

func createTestVersion(t *testing.T, versionFixture string, serviceID string) *Version {
func createTestVersion(t *testing.T, versionFixture, serviceID string) *Version {
var err error
var version *Version

Expand All @@ -188,7 +188,7 @@ func createTestVersion(t *testing.T, versionFixture string, serviceID string) *V
return version
}

func createTestDictionary(t *testing.T, dictionaryFixture string, serviceID string, version int, dictionaryNameSuffix string) *Dictionary {
func createTestDictionary(t *testing.T, dictionaryFixture, serviceID string, version int, dictionaryNameSuffix string) *Dictionary {
var err error
var dictionary *Dictionary

Expand Down Expand Up @@ -220,7 +220,7 @@ func deleteTestDictionary(t *testing.T, dictionary *Dictionary, deleteFixture st
}
}

func createTestACL(t *testing.T, createFixture string, serviceID string, version int, aclNameSuffix string) *ACL {
func createTestACL(t *testing.T, createFixture, serviceID string, version int, aclNameSuffix string) *ACL {
var err error
var acl *ACL

Expand Down Expand Up @@ -252,7 +252,7 @@ func deleteTestACL(t *testing.T, acl *ACL, deleteFixture string) {
}
}

func createTestPool(t *testing.T, createFixture string, serviceID string, version int, poolNameSuffix string) *Pool {
func createTestPool(t *testing.T, createFixture, serviceID string, version int, poolNameSuffix string) *Pool {
var err error
var pool *Pool

Expand Down
2 changes: 1 addition & 1 deletion fastly/tls_private_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func buildCertificate(privateKey *rsa.PrivateKey, domains ...string) (string, er
return c, nil
}

func formatCertificate(certificate *x509.Certificate, parent *x509.Certificate, publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey) (string, error) {
func formatCertificate(certificate, parent *x509.Certificate, publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey) (string, error) {
derBytes, err := x509.CreateCertificate(
rand.Reader,
certificate,
Expand Down
2 changes: 1 addition & 1 deletion fastly/waf_rule_exclusion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func TestClient_WAF_Rule_Exclusion_delete_validation(t *testing.T) {
}
}

func assertWAFRuleExclusionEquals(t *testing.T, actual *WAFRuleExclusion, expected *WAFRuleExclusion) {
func assertWAFRuleExclusionEquals(t *testing.T, actual, expected *WAFRuleExclusion) {
if *actual.ExclusionType != *expected.ExclusionType {
t.Errorf("expected ExclusionType to be %s got %s", *expected.ExclusionType, *actual.ExclusionType)
}
Expand Down

0 comments on commit 792278f

Please sign in to comment.