Fixed makefile

This commit is contained in:
Junpei Tsuji
2020-02-20 13:02:14 +09:00
parent 3c88ce1648
commit a61c519ac8
5 changed files with 19 additions and 12 deletions

View File

@@ -1,15 +1,22 @@
.PHONEY: all
.PHONEY: all setup test cover
all: setup cover all: setup cover
.PHONEY: setup
setup: setup:
go get golang.org/x/tools/cmd/cover go get golang.org/x/tools/cmd/cover
go get google.golang.org/appengine/urlfetch go get google.golang.org/appengine/urlfetch
go get ./... go get ./...
.PHONEY: test
test: test:
go test -v ./... go test -v ./...
.PHONEY: cover
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 ./...

View File

@@ -10,7 +10,7 @@ import (
"time" "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 ( const (
// SandboxURL is the endpoint for sandbox environment. // SandboxURL is the endpoint for sandbox environment.

View File

@@ -8,16 +8,17 @@ import (
"crypto/x509" "crypto/x509"
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"google.golang.org/api/option"
"net/http" "net/http"
"time" "time"
"google.golang.org/api/option"
"golang.org/x/oauth2" "golang.org/x/oauth2"
"golang.org/x/oauth2/google" "golang.org/x/oauth2/google"
androidpublisher "google.golang.org/api/androidpublisher/v3" 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 // The IABProduct type is an interface for product service
type IABProduct interface { type IABProduct interface {
@@ -46,7 +47,6 @@ func New(jsonKey []byte) (*Client, error) {
c := &http.Client{Timeout: 10 * time.Second} c := &http.Client{Timeout: 10 * time.Second}
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, c) ctx := context.WithValue(context.Background(), oauth2.HTTPClient, c)
conf, err := google.JWTConfigFromJSON(jsonKey, androidpublisher.AndroidpublisherScope) conf, err := google.JWTConfigFromJSON(jsonKey, androidpublisher.AndroidpublisherScope)
if err != nil { if err != nil {
return nil, err return nil, err