From c6384b927f65c426f36d80b02e19004f2a274de0 Mon Sep 17 00:00:00 2001 From: Jumpei Tsuji Date: Fri, 13 May 2016 13:28:59 +0900 Subject: [PATCH] Golint and fixed a typo --- amazon/validator.go | 11 +++++++---- appstore/validator.go | 4 +++- appstore/validator_test.go | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/amazon/validator.go b/amazon/validator.go index c1c08be..f429b93 100644 --- a/amazon/validator.go +++ b/amazon/validator.go @@ -12,11 +12,13 @@ import ( ) const ( - SandboxURL string = "http://localhost:8080/RVSSandbox" + // SandboxURL is the endpoint for local environment. + SandboxURL string = "http://localhost:8080/RVSSandbox" + // ProductionURL is the endpoint for production environment. ProductionURL string = "https://appstore-sdk.amazon.com" ) -func getSandboxUrl() string { +func getSandboxURL() string { url := os.Getenv("IAP_SANDBOX_URL") if url == "" { url = SandboxURL @@ -41,6 +43,7 @@ type IAPResponse struct { TestTransaction bool `json:"testTransaction"` } +// The IAPResponseError typs has error message and status. type IAPResponseError struct { Message string `json:"message"` Status bool `json:"status"` @@ -61,7 +64,7 @@ type Client struct { // New creates a client object func New(secret string) IAPClient { client := Client{ - URL: getSandboxUrl(), + URL: getSandboxURL(), Secret: secret, TimeOut: time.Second * 5, } @@ -78,7 +81,7 @@ func NewWithConfig(config Config) Client { } client := Client{ - URL: getSandboxUrl(), + URL: getSandboxURL(), Secret: config.Secret, TimeOut: config.TimeOut, } diff --git a/appstore/validator.go b/appstore/validator.go index e963d62..15b00ef 100644 --- a/appstore/validator.go +++ b/appstore/validator.go @@ -13,7 +13,9 @@ import ( ) const ( - SandboxURL string = "https://sandbox.itunes.apple.com/verifyReceipt" + // SandboxURL is the endpoint for sandbox environment. + SandboxURL string = "https://sandbox.itunes.apple.com/verifyReceipt" + // ProductionURL is the endpoint for production environment. ProductionURL string = "https://buy.itunes.apple.com/verifyReceipt" ) diff --git a/appstore/validator_test.go b/appstore/validator_test.go index 9e32f12..3afc638 100644 --- a/appstore/validator_test.go +++ b/appstore/validator_test.go @@ -63,7 +63,7 @@ func TestHandleError(t *testing.T) { t.Errorf("got %v\nwant %v", actual, expected) } - // status unkown + // status unknown expected = errors.New("An unknown error ocurred") actual = HandleError(100) if !reflect.DeepEqual(actual, expected) {