From 866faa35cb0f5674b9cc65207ee03b7ef4fd0cb0 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Fri, 22 Jan 2021 14:17:27 +0100 Subject: [PATCH] Add Makefile for Catlin Add vendor directory too. --- catlin/.gitignore | 1 + catlin/Makefile | 70 +++++++++++++++++++++++++++++++++++++ catlin/go.sum | 1 + catlin/pkg/parser/parser.go | 2 +- 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 catlin/.gitignore create mode 100644 catlin/Makefile diff --git a/catlin/.gitignore b/catlin/.gitignore new file mode 100644 index 000000000..36f971e32 --- /dev/null +++ b/catlin/.gitignore @@ -0,0 +1 @@ +bin/* diff --git a/catlin/Makefile b/catlin/Makefile new file mode 100644 index 000000000..a14a45f3b --- /dev/null +++ b/catlin/Makefile @@ -0,0 +1,70 @@ +BINARY_NAME = catlin + +all: bin/$(BINARY_NAME) test + +FORCE: + +.PHONY: cross +cross: amd64 386 arm arm64 s390x ppc64le ## build cross platform binaries + +.PHONY: amd64 +amd64: + GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-linux-amd64 ./cmd/$(BINARY_NAME) + GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-windows-amd64 ./cmd/$(BINARY_NAME) + GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-darwin-amd64 ./cmd/$(BINARY_NAME) + +.PHONY: 386 +386: + GOOS=linux GOARCH=386 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-linux-386 ./cmd/$(BINARY_NAME) + GOOS=windows GOARCH=386 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-windows-386 ./cmd/$(BINARY_NAME) + +.PHONY: arm +arm: + GOOS=linux GOARCH=arm go build $(LDFLAGS) -o bin/$(BINARY_NAME)-linux-arm ./cmd/$(BINARY_NAME) + +.PHONY: arm64 +arm64: + GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-linux-arm64 ./cmd/$(BINARY_NAME) + +.PHONY: s390x +s390x: + GOOS=linux GOARCH=s390x go build $(LDFLAGS) -o bin/$(BINARY_NAME)-linux-s390x ./cmd/$(BINARY_NAME) + +.PHONY: ppc64le +ppc64le: + GOOS=linux GOARCH=ppc64le go build $(LDFLAGS) -o bin/$(BINARY_NAME)-linux-ppc64le ./cmd/$(BINARY_NAME) + +bin/%: cmd/% FORCE + go build $(LDFLAGS) -v -o $@ ./$< + +check: lint test + +.PHONY: test +test: test-unit ## run all tests + +.PHONY: lint +lint: lint-go ## run all linters + +.PHONY: lint-go +lint-go: ## runs go linter on all go files + @echo "Linting go files..." + @golangci-lint run ./... --max-issues-per-linter=0 \ + --max-same-issues=0 \ + --deadline 5m + +.PHONY: test-unit +test-unit: ## run unit tests + @echo "Running unit tests..." + @go test -failfast -v -cover ./... + +.PHONY: clean +clean: ## clean build artifacts + rm -fR bin + +.PHONY: fmt ## formats the GO code(excludes vendors dir) +fmt: + @go fmt `go list ./... | grep -v /vendor/` + +.PHONY: help +help: ## print this help + @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {gsub("\\\\n",sprintf("\n%22c",""), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) diff --git a/catlin/go.sum b/catlin/go.sum index ae2cd9b1a..5633f57ba 100644 --- a/catlin/go.sum +++ b/catlin/go.sum @@ -1494,6 +1494,7 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= google.golang.org/genproto v0.0.0-20180608181217-32ee49c4dd80/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/catlin/pkg/parser/parser.go b/catlin/pkg/parser/parser.go index 2605dc163..d7baf6d38 100644 --- a/catlin/pkg/parser/parser.go +++ b/catlin/pkg/parser/parser.go @@ -35,7 +35,7 @@ import ( func registerSchema() { beta1 := runtime.NewSchemeBuilder(v1beta1.AddToScheme) - beta1.AddToScheme(scheme.Scheme) + _ = beta1.AddToScheme(scheme.Scheme) } type Resource struct {