Skip to content

Commit 1057b4c

Browse files
authored
Provide golang proto bindings for the GRPC API of FeOS (#98)
* Provide golong proto bindings for the GRPC API of FeOS Signed-off-by: Guvenc Gulce <[email protected]> * Do not use mixed case name in go module name Signed-off-by: Guvenc Gulce <[email protected]> --------- Signed-off-by: Guvenc Gulce <[email protected]>
1 parent 9dee271 commit 1057b4c

File tree

19 files changed

+11236
-0
lines changed

19 files changed

+11236
-0
lines changed

go/feos-go/Makefile

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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 gen/*
58+
rm -rf bin
59+
60+
.PHONY: add-license
61+
add-license: addlicense ## Add license headers to all go files.
62+
find . -name '*.go' -exec go run github.com/google/addlicense -c 'IronCore authors' {} +
63+
64+
.PHONY: check-license
65+
check-license: addlicense ## Check that every file has a license header present.
66+
find . -name '*.go' -exec $(ADDLICENSE) -check -c 'IronCore authors' {} +
67+
68+
.PHONY: check
69+
check: generate check-license lint test # Generate manifests, code, lint, check licenses, test
70+
71+
.PHONY: test
72+
test: ## Tests the code in this repository.
73+
go test -v ./... -coverprofile cover.out -ginkgo.label-filter=$(labels) -ginkgo.randomize-all
74+
75+
##@ Tools
76+
77+
## Location to install dependencies to
78+
LOCALBIN ?= $(shell pwd)/bin
79+
$(LOCALBIN):
80+
mkdir -p $(LOCALBIN)
81+
82+
## Tool Binaries
83+
ADDLICENSE ?= $(LOCALBIN)/addlicense
84+
GOIMPORTS ?= $(LOCALBIN)/goimports
85+
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
86+
PROTOC_GEN_GO ?= $(LOCALBIN)/protoc-gen-go
87+
PROTOC_GEN_GO_GRPC ?= $(LOCALBIN)/protoc-gen-go-grpc
88+
89+
## Tool Versions
90+
ADDLICENSE_VERSION ?= v1.1.1
91+
GOIMPORTS_VERSION ?= v0.13.0
92+
GOLANGCI_LINT_VERSION ?= v1.55.2
93+
PROTOC_GEN_GO_VERSION ?= v1.31.0
94+
PROTOC_GEN_GO_GRPC_VERSION ?= v1.3.0
95+
96+
.PHONY: protoc-gen-go
97+
protoc-gen-go: $(PROTOC_GEN_GO) ## Download protoc-gen-go locally if necessary.
98+
$(PROTOC_GEN_GO): $(LOCALBIN)
99+
test -s $(LOCALBIN)/protoc-gen-go || GOBIN=$(LOCALBIN) go install google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GEN_GO_VERSION)
100+
101+
.PHONY: protoc-gen-go-grpc
102+
protoc-gen-go-grpc: $(PROTOC_GEN_GO_GRPC) ## Download protoc-gen-go-grpc locally if necessary.
103+
$(PROTOC_GEN_GO_GRPC): $(LOCALBIN)
104+
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)
105+
106+
.PHONY: addlicense
107+
addlicense: $(ADDLICENSE) ## Download addlicense locally if necessary.
108+
$(ADDLICENSE): $(LOCALBIN)
109+
test -s $(LOCALBIN)/addlicense || GOBIN=$(LOCALBIN) go install github.com/google/addlicense@$(ADDLICENSE_VERSION)
110+
111+
.PHONY: goimports
112+
goimports: $(GOIMPORTS) ## Download goimports locally if necessary.
113+
$(GOIMPORTS): $(LOCALBIN)
114+
test -s $(LOCALBIN)/goimports || GOBIN=$(LOCALBIN) go install golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION)
115+
116+
.PHONY: golangci-lint
117+
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
118+
$(GOLANGCI_LINT): $(LOCALBIN)
119+
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)