Skip to content

Commit e2b122e

Browse files
committed
Provide golong proto bindings for the GRPC API of FeOS
Signed-off-by: Guvenc Gulce <[email protected]>
1 parent 9dee271 commit e2b122e

File tree

19 files changed

+11231
-0
lines changed

19 files changed

+11231
-0
lines changed

go/feos-go/Makefile

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
2+
ifeq (,$(shell go env GOBIN))
3+
GOBIN=$(shell go env GOPATH)/bin
4+
else
5+
GOBIN=$(shell go env GOBIN)
6+
endif
7+
8+
# Setting SHELL to bash allows bash commands to be executed by recipes.
9+
# This is a requirement for 'setup-envtest.sh' in the test target.
10+
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
11+
SHELL = /usr/bin/env bash -o pipefail
12+
.SHELLFLAGS = -ec
13+
14+
.PHONY: all
15+
all: build
16+
17+
##@ General
18+
19+
# The help target prints out all targets with their descriptions organized
20+
# beneath their categories. The categories are represented by '##@' and the
21+
# target descriptions by '##'. The awk commands is responsible for reading the
22+
# entire set of makefiles included in this invocation, looking for lines of the
23+
# file as xyz: ## something, and then pretty-format the target and help. Then,
24+
# if there's a line with ##@ something, that gets pretty-printed as a category.
25+
# More info on the usage of ANSI control characters for terminal formatting:
26+
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
27+
# More info on the awk command:
28+
# http://linuxcommand.org/lc3_adv_awk.php
29+
30+
.PHONY: help
31+
help: ## Display this help.
32+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
33+
34+
##@ Development
35+
36+
.PHONY: generate
37+
generate: goimports protoc-gen-go protoc-gen-go-grpc
38+
PROTOC_GEN_GO=$(PROTOC_GEN_GO) \
39+
PROTOC_GEN_GO_GRPC=$(PROTOC_GEN_GO_GRPC) \
40+
./hack/generate-proto.sh
41+
$(GOIMPORTS) -w ./gen
42+
43+
.PHONY: fmt
44+
fmt: goimports ## Run goimports against code.
45+
$(GOIMPORTS) -w .
46+
47+
.PHONY: vet
48+
vet: ## Run go vet against code.
49+
go vet ./...
50+
51+
.PHONY: lint
52+
lint: golangci-lint ## Run golangci-lint on the code.
53+
$(GOLANGCI_LINT) run ./...
54+
55+
.PHONY: clean
56+
clean: ## Clean any artifacts that can be regenerated.
57+
rm -rf proto/*.pb.go
58+
59+
.PHONY: add-license
60+
add-license: addlicense ## Add license headers to all go files.
61+
find . -name '*.go' -exec go run github.com/google/addlicense -c 'IronCore authors' {} +
62+
63+
.PHONY: check-license
64+
check-license: addlicense ## Check that every file has a license header present.
65+
find . -name '*.go' -exec $(ADDLICENSE) -check -c 'IronCore authors' {} +
66+
67+
.PHONY: check
68+
check: generate check-license lint test # Generate manifests, code, lint, check licenses, test
69+
70+
.PHONY: test
71+
test: ## Tests the code in this repository.
72+
go test -v ./... -coverprofile cover.out -ginkgo.label-filter=$(labels) -ginkgo.randomize-all
73+
74+
##@ Tools
75+
76+
## Location to install dependencies to
77+
LOCALBIN ?= $(shell pwd)/bin
78+
$(LOCALBIN):
79+
mkdir -p $(LOCALBIN)
80+
81+
## Tool Binaries
82+
ADDLICENSE ?= $(LOCALBIN)/addlicense
83+
GOIMPORTS ?= $(LOCALBIN)/goimports
84+
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
85+
PROTOC_GEN_GO ?= $(LOCALBIN)/protoc-gen-go
86+
PROTOC_GEN_GO_GRPC ?= $(LOCALBIN)/protoc-gen-go-grpc
87+
88+
## Tool Versions
89+
ADDLICENSE_VERSION ?= v1.1.1
90+
GOIMPORTS_VERSION ?= v0.13.0
91+
GOLANGCI_LINT_VERSION ?= v1.55.2
92+
PROTOC_GEN_GO_VERSION ?= v1.31.0
93+
PROTOC_GEN_GO_GRPC_VERSION ?= v1.3.0
94+
95+
.PHONY: protoc-gen-go
96+
protoc-gen-go: $(PROTOC_GEN_GO) ## Download protoc-gen-go locally if necessary.
97+
$(PROTOC_GEN_GO): $(LOCALBIN)
98+
test -s $(LOCALBIN)/protoc-gen-go || GOBIN=$(LOCALBIN) go install google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GEN_GO_VERSION)
99+
100+
.PHONY: protoc-gen-go-grpc
101+
protoc-gen-go-grpc: $(PROTOC_GEN_GO_GRPC) ## Download protoc-gen-go-grpc locally if necessary.
102+
$(PROTOC_GEN_GO_GRPC): $(LOCALBIN)
103+
test -s $(LOCALBIN)/protoc-gen-go-grpc || GOBIN=$(LOCALBIN) go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(PROTOC_GEN_GO_GRPC_VERSION)
104+
105+
.PHONY: addlicense
106+
addlicense: $(ADDLICENSE) ## Download addlicense locally if necessary.
107+
$(ADDLICENSE): $(LOCALBIN)
108+
test -s $(LOCALBIN)/addlicense || GOBIN=$(LOCALBIN) go install github.com/google/addlicense@$(ADDLICENSE_VERSION)
109+
110+
.PHONY: goimports
111+
goimports: $(GOIMPORTS) ## Download goimports locally if necessary.
112+
$(GOIMPORTS): $(LOCALBIN)
113+
test -s $(LOCALBIN)/goimports || GOBIN=$(LOCALBIN) go install golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION)
114+
115+
.PHONY: golangci-lint
116+
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
117+
$(GOLANGCI_LINT): $(LOCALBIN)
118+
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)

0 commit comments

Comments
 (0)