From a61c519ac8ba7def41a7eb594047a04b95486fcf Mon Sep 17 00:00:00 2001 From: Junpei Tsuji Date: Thu, 20 Feb 2020 13:02:14 +0900 Subject: [PATCH] Fixed makefile --- Makefile | 23 ++++++++++++------- .../mocks/{mock_appstore.go => appstore.go} | 0 appstore/validator.go | 2 +- .../mocks/{mock_playstore.go => playstore.go} | 0 playstore/validator.go | 6 ++--- 5 files changed, 19 insertions(+), 12 deletions(-) rename appstore/mocks/{mock_appstore.go => appstore.go} (100%) rename playstore/mocks/{mock_playstore.go => playstore.go} (100%) diff --git a/Makefile b/Makefile index 2a1e304..9c73383 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,22 @@ - -.PHONEY: all setup test cover - +.PHONEY: all all: setup cover +.PHONEY: setup setup: - go get golang.org/x/tools/cmd/cover - go get google.golang.org/appengine/urlfetch - go get ./... + go get golang.org/x/tools/cmd/cover + go get google.golang.org/appengine/urlfetch + go get ./... +.PHONEY: test test: - go test -v ./... + go test -v ./... +.PHONEY: cover cover: - go test -coverprofile=coverage.txt ./... + go test -coverprofile=coverage.txt ./... + +.PHONEY: generate +generate: + rm -rf ./appstore/mocks/* + rm -rf ./playstore/mocks/* + go generate ./... diff --git a/appstore/mocks/mock_appstore.go b/appstore/mocks/appstore.go similarity index 100% rename from appstore/mocks/mock_appstore.go rename to appstore/mocks/appstore.go diff --git a/appstore/validator.go b/appstore/validator.go index 301ce59..f68f2b6 100644 --- a/appstore/validator.go +++ b/appstore/validator.go @@ -10,7 +10,7 @@ import ( "time" ) -//go:generate mockgen -destination=mocks/mock_appstore.go -package=mocks github.com/awa/go-iap/appstore IAPClient +//go:generate mockgen -destination=mocks/appstore.go -package=mocks github.com/awa/go-iap/appstore IAPClient const ( // SandboxURL is the endpoint for sandbox environment. diff --git a/playstore/mocks/mock_playstore.go b/playstore/mocks/playstore.go similarity index 100% rename from playstore/mocks/mock_playstore.go rename to playstore/mocks/playstore.go diff --git a/playstore/validator.go b/playstore/validator.go index 5a6e1ba..f572029 100644 --- a/playstore/validator.go +++ b/playstore/validator.go @@ -8,16 +8,17 @@ import ( "crypto/x509" "encoding/base64" "fmt" - "google.golang.org/api/option" "net/http" "time" + "google.golang.org/api/option" + "golang.org/x/oauth2" "golang.org/x/oauth2/google" androidpublisher "google.golang.org/api/androidpublisher/v3" ) -//go:generate mockgen -destination=mocks/mock_playstore.go -package=mocks github.com/awa/go-iap/playstore IABProduct,IABSubscription +//go:generate mockgen -destination=mocks/playstore.go -package=mocks github.com/awa/go-iap/playstore IABProduct,IABSubscription // The IABProduct type is an interface for product service type IABProduct interface { @@ -46,7 +47,6 @@ func New(jsonKey []byte) (*Client, error) { c := &http.Client{Timeout: 10 * time.Second} ctx := context.WithValue(context.Background(), oauth2.HTTPClient, c) - conf, err := google.JWTConfigFromJSON(jsonKey, androidpublisher.AndroidpublisherScope) if err != nil { return nil, err