From d5d643af1de372fe5e583b2c2fb7c380ab2b9019 Mon Sep 17 00:00:00 2001 From: c9845 Date: Fri, 18 Aug 2023 00:01:11 -0400 Subject: [PATCH] Fix some linting warnings (plus future use of staticcheck?) (#226) --- asset_test.go | 7 ------- customer_address.go | 2 -- draft_order_test.go | 2 +- goshopify.go | 4 ++-- logger_test.go | 2 +- order_test.go | 12 ++++++------ product_listing.go | 1 - 7 files changed, 10 insertions(+), 20 deletions(-) diff --git a/asset_test.go b/asset_test.go index a822ac50..67543605 100644 --- a/asset_test.go +++ b/asset_test.go @@ -8,13 +8,6 @@ import ( "github.com/jarcoal/httpmock" ) -func assetTests(t *testing.T, asset Asset) { - expectedKey := "templates/index.liquid" - if asset.Key != expectedKey { - t.Errorf("Asset.Key returned %+v, expected %+v", asset.Key, expectedKey) - } -} - func TestAssetList(t *testing.T) { setup() defer teardown() diff --git a/customer_address.go b/customer_address.go index d34096a9..7d9d224a 100644 --- a/customer_address.go +++ b/customer_address.go @@ -2,8 +2,6 @@ package goshopify import "fmt" -const customerAddressResourceName = "customer-addresses" - // CustomerAddressService is an interface for interfacing with the customer address endpoints // of the Shopify API. // See: https://help.shopify.com/en/api/reference/customers/customer_address diff --git a/draft_order_test.go b/draft_order_test.go index 9579d742..c057941c 100644 --- a/draft_order_test.go +++ b/draft_order_test.go @@ -73,7 +73,7 @@ func TestDraftOrderCreate(t *testing.T) { draftOrder := DraftOrder{ LineItems: []LineItem{ - LineItem{ + { VariantID: 1, Quantity: 1, }, diff --git a/goshopify.go b/goshopify.go index 2e40c3a3..b1159c05 100644 --- a/goshopify.go +++ b/goshopify.go @@ -242,8 +242,8 @@ func (c *Client) NewRequest(method, relPath string, body, options interface{}) ( // token. The shopName parameter is the shop's myshopify domain, // e.g. "theshop.myshopify.com", or simply "theshop" // a.NewClient(shopName, token, opts) is equivalent to NewClient(a, shopName, token, opts) -func (a App) NewClient(shopName, token string, opts ...Option) *Client { - return NewClient(a, shopName, token, opts...) +func (app App) NewClient(shopName, token string, opts ...Option) *Client { + return NewClient(app, shopName, token, opts...) } // Returns a new Shopify API client with an already authenticated shopname and diff --git a/logger_test.go b/logger_test.go index bda27fcb..102a273d 100644 --- a/logger_test.go +++ b/logger_test.go @@ -115,7 +115,7 @@ func TestDoGetHeadersDebug(t *testing.T) { client.logResponse(&http.Response{ Status: http.StatusText(http.StatusOK), StatusCode: http.StatusOK, - Header: map[string][]string{"X-Request-Id": []string{"00000000-0000-0000-0000-000000000000"}}, + Header: map[string][]string{"X-Request-Id": {"00000000-0000-0000-0000-000000000000"}}, Body: ioutil.NopCloser(strings.NewReader("response body")), }) diff --git a/order_test.go b/order_test.go index 1cab1355..a3e268a6 100644 --- a/order_test.go +++ b/order_test.go @@ -370,7 +370,7 @@ func TestOrderCreate(t *testing.T) { order := Order{ LineItems: []LineItem{ - LineItem{ + { VariantID: 1, Quantity: 1, }, @@ -1173,7 +1173,7 @@ func propertiesEmptyStructLientItem() LineItem { func propertiesStructLientItem() LineItem { return LineItem{ Properties: []NoteAttribute{ - NoteAttribute{ + { Name: "property 1", Value: float64(3), }, @@ -1209,11 +1209,11 @@ func validLineItem() LineItem { VariantInventoryManagement: "shopify", PreTaxPrice: &preTaxPrice, Properties: []NoteAttribute{ - NoteAttribute{ + { Name: "note 1", Value: "one", }, - NoteAttribute{ + { Name: "note 2", Value: float64(2), }, @@ -1223,12 +1223,12 @@ func validLineItem() LineItem { Grams: 100, FulfillmentStatus: OrderFulfillmentStatusPartial, TaxLines: []TaxLine{ - TaxLine{ + { Title: "State tax", Price: &tl1Price, Rate: &tl1Rate, }, - TaxLine{ + { Title: "Federal tax", Price: &tl2Price, Rate: &tl2Rate, diff --git a/product_listing.go b/product_listing.go index d14093f0..9c2fbc09 100644 --- a/product_listing.go +++ b/product_listing.go @@ -6,7 +6,6 @@ import ( ) const productListingBasePath = "product_listings" -const productsListingResourceName = "product_listings" // ProductListingService is an interface for interfacing with the product listing endpoints // of the Shopify API.