From 792278f3613e80d2768fca1f3b8086cc1c968bc0 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Tue, 27 Feb 2024 15:13:08 +0000 Subject: [PATCH] Silence gofumpt (#500) --- fastly/alerts_test.go | 1 - fastly/client.go | 10 +++++----- fastly/fastly_test.go | 12 ++++++------ fastly/tls_private_keys_test.go | 2 +- fastly/waf_rule_exclusion_test.go | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/fastly/alerts_test.go b/fastly/alerts_test.go index 8d8c56097..148230483 100644 --- a/fastly/alerts_test.go +++ b/fastly/alerts_test.go @@ -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) diff --git a/fastly/client.go b/fastly/client.go index 1c17007ba..ad619412e 100644 --- a/fastly/client.go +++ b/fastly/client.go @@ -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" { @@ -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) } @@ -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) @@ -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) diff --git a/fastly/fastly_test.go b/fastly/fastly_test.go index 6bc843290..a12642b7b 100644 --- a/fastly/fastly_test.go +++ b/fastly/fastly_test.go @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/fastly/tls_private_keys_test.go b/fastly/tls_private_keys_test.go index 372cab73d..88ebe8ade 100644 --- a/fastly/tls_private_keys_test.go +++ b/fastly/tls_private_keys_test.go @@ -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, diff --git a/fastly/waf_rule_exclusion_test.go b/fastly/waf_rule_exclusion_test.go index bf3115aa8..4e2382cc0 100644 --- a/fastly/waf_rule_exclusion_test.go +++ b/fastly/waf_rule_exclusion_test.go @@ -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) }