Skip to content

Commit

Permalink
Bump Go to 1.16, switch to go:embed (#331)
Browse files Browse the repository at this point in the history
Co-authored-by: Thorsten Essig <[email protected]>
  • Loading branch information
carstendietrich and tessig authored Aug 26, 2021
1 parent 73bc584 commit a78d5da
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 2,254 deletions.
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

0 comments on commit a78d5da

Please sign in to comment.