Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Go to 1.16, switch to go:embed #331

Merged
merged 3 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.15', '1.*' ]
go: [ '1.16', '1.*' ]
name: With Go ${{ matrix.go }}
steps:
- uses: actions/checkout@v2
Expand Down
245 changes: 0 additions & 245 deletions cart/interfaces/graphql/schema.go

This file was deleted.

9 changes: 6 additions & 3 deletions cart/interfaces/graphql/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package graphql

import (
"context"
// embed schema.graphql
_ "embed"

"flamingo.me/flamingo-commerce/v3/cart/domain/cart"
"flamingo.me/flamingo-commerce/v3/cart/domain/placeorder"
Expand All @@ -12,16 +14,17 @@ import (
"flamingo.me/graphql"
)

//go:generate go run github.com/go-bindata/go-bindata/v3/go-bindata -nometadata -o schema.go -pkg graphql schema.graphql

// Service describes the Commerce/Cart GraphQL Service
type Service struct{}

var _ graphql.Service = new(Service)

//go:embed schema.graphql
var schema []byte

// Schema for cart, delivery and addresses
func (*Service) Schema() []byte {
return MustAsset("schema.graphql")
return schema
}

// Types configures the GraphQL to Go resolvers
Expand Down
268 changes: 0 additions & 268 deletions category/infrastructure/fake/bindata.go

This file was deleted.

2 changes: 0 additions & 2 deletions category/infrastructure/fake/category_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"flamingo.me/flamingo-commerce/v3/category/domain"
)

//go:generate go run github.com/go-bindata/go-bindata/v3/go-bindata -nometadata -pkg fake -prefix mock/ mock/

// CategoryService returns category test data
type CategoryService struct {
testDataFiles map[string]string
Expand Down
8 changes: 6 additions & 2 deletions category/infrastructure/fake/helper.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fake

import (
"embed"
"encoding/json"
"io/ioutil"
"path/filepath"
Expand All @@ -11,6 +12,9 @@ import (
"flamingo.me/flamingo-commerce/v3/category/domain"
)

//go:embed mock
var mock embed.FS

// LoadCategoryTree returns tree data from file
func LoadCategoryTree(testDataFiles map[string]string, logger flamingo.Logger) []*domain.TreeData {
var tree []*domain.TreeData
Expand All @@ -25,7 +29,7 @@ func LoadCategoryTree(testDataFiles map[string]string, logger flamingo.Logger) [
logger.Warn(err)
}
} else {
jsonFile, err := Asset("categoryTree.json")
jsonFile, err := mock.ReadFile("mock/categoryTree.json")
if err != nil {
logger.Warn(err)
return tree
Expand Down Expand Up @@ -53,7 +57,7 @@ func LoadCategory(categoryCode string, testDataFiles map[string]string, logger f
return nil
}
} else {
jsonFile, err := Asset(categoryCode + ".json")
jsonFile, err := mock.ReadFile("mock/" + categoryCode + ".json")
if err != nil {
logger.Warn(err)
return nil
Expand Down
Loading