Skip to content

Commit

Permalink
chore: replace go-bindata with embed (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Jan 4, 2024
1 parent 5b46da6 commit 916ff8c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1,594 deletions.
1 change: 0 additions & 1 deletion .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
- name: Build
run: |
go install github.com/golang/mock/mockgen@v1.4.3
go install github.com/go-bindata/go-bindata/...@latest
ARTIFACT_DESTINATION=./builds make build
# - name: Check version
# run: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/lagoon-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
- name: Build
run: |
go install github.com/golang/mock/mockgen@v1.4.3
go install github.com/go-bindata/go-bindata/...@latest
ARTIFACT_DESTINATION=./builds make build
# - name: Check version
# run: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
- name: Build CLI
run: |
go install github.com/golang/mock/mockgen@v1.4.3
go install github.com/go-bindata/go-bindata/...@latest
make deps
make test
- name: Compile CLI
Expand Down
11 changes: 6 additions & 5 deletions internal/lagoon/client/client.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//go:generate go-bindata -pkg lgraphql -o lgraphql/lgraphql.go -nometadata _lgraphql/ _lgraphql/variables/ _lgraphql/notifications/

// Package client implements the interfaces required by the parent lagoon
// package.
package client

import (
"embed"
"encoding/json"
"fmt"
"log"
Expand All @@ -14,9 +13,11 @@ import (

"github.com/hashicorp/go-version"
"github.com/machinebox/graphql"
"github.com/uselagoon/lagoon-cli/internal/lagoon/client/lgraphql"
)

//go:embed _lgraphql/*
var lgraphql embed.FS

// Client implements the lagoon package interfaces for the Lagoon GraphQL API.
type Client struct {
userAgent string
Expand Down Expand Up @@ -57,7 +58,7 @@ func New(endpoint, token, apiVersion string, cliVersion string, debug bool) *Cli
func (c *Client) newRequest(
assetName string, varStruct interface{}) (*graphql.Request, error) {

q, err := lgraphql.Asset(assetName)
q, err := lgraphql.ReadFile(assetName)
if err != nil {
return nil, fmt.Errorf("couldn't get asset: %w", err)
}
Expand All @@ -71,7 +72,7 @@ func (c *Client) newRequest(
func (c *Client) newVersionedRequest(
assetName string, varStruct interface{}) (*graphql.Request, error) {

q, err := lgraphql.Asset(assetName)
q, err := lgraphql.ReadFile(assetName)
if err != nil {
return nil, fmt.Errorf("couldn't get asset: %w", err)
}
Expand Down
Loading

0 comments on commit 916ff8c

Please sign in to comment.