Skip to content

KUBESAW-201: Replace go-bindata with go:embed #1158

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

Merged
merged 6 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions deploy/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ var NotificationTemplateFS embed.FS

//go:embed templates/toolchaincluster/*
var ToolchainClusterTemplateFS embed.FS

//go:embed registration-service/*
var RegistrationServiceFS embed.FS
3 changes: 0 additions & 3 deletions make/go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ generate-assets: go-bindata
@rm ./test/templates/usertiers/usertier_assets.go 2>/dev/null || true
@$(GO_BINDATA) -pkg usertiers_test -o ./test/templates/usertiers/usertier_assets.go -nometadata -nocompress -prefix $(USERTEMPLATES_TEST_BASEDIR) -ignore doc.go $(USERTEMPLATES_TEST_BASEDIR)/...

@echo "generating registration service template data..."
@$(GO_BINDATA) -pkg registrationservice -o ./pkg/templates/registrationservice/template_assets.go -nocompress -prefix $(REGISTRATION_SERVICE_DIR) $(REGISTRATION_SERVICE_DIR)

.PHONY: verify-dependencies
## Runs commands to verify after the updated dependecies of toolchain-common/API(go mod replace), if the repo needs any changes to be made
verify-dependencies: tidy vet build test lint-go-code
Expand Down
3 changes: 2 additions & 1 deletion pkg/templates/registrationservice/template.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package registrationservice

import (
"github.com/codeready-toolchain/host-operator/deploy"
templatev1 "github.com/openshift/api/template/v1"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/client-go/kubernetes/scheme"
Expand All @@ -13,7 +14,7 @@ const ResourceName = "registration-service"
const ProxyRouteName = "api"

func GetDeploymentTemplate() (*templatev1.Template, error) {
deployment, err := Asset("registration-service.yaml")
deployment, err := deploy.RegistrationServiceFS.ReadFile("registration-service/registration-service.yaml")
if err != nil {
return nil, err
}
Expand Down
Loading