Skip to content

Commit cc657ae

Browse files
committed
Initial release of grpc-rest-proxy.
0 parents  commit cc657ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+6366
-0
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.git*
2+
.vscode
3+
readme*
4+
README*
5+
Dockerfile

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/grpc-rest-proxy*
2+
/example-grpc-server
3+
/vendor

.golangci.yml

+184
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# golangci-lint is a Go linters aggregator, https://golangci-lint.run/
2+
#
3+
# instalation: binary will be $(go env GOPATH)/bin/golangci-lint
4+
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0
5+
# golangci-lint --version
6+
#
7+
# run linter:
8+
# golangci-lint run
9+
#
10+
# integrate with vscode:
11+
# "go.lintTool":"golangci-lint",
12+
# "go.lintFlags": [
13+
# "--fast"
14+
# ]
15+
16+
run:
17+
modules-download-mode: readonly
18+
19+
issues:
20+
exclude:
21+
- Using the variable on range scope `tt` in function literal
22+
- paramTypeCombine
23+
exclude-dirs:
24+
- tests
25+
- vendor
26+
- testapp
27+
exclude-rules:
28+
- linters:
29+
- contextcheck
30+
path: "."
31+
32+
- linters:
33+
- lll
34+
source: "Output: "
35+
36+
- linters:
37+
- gosec
38+
source: opts.SkipTLSVerify
39+
40+
- linters:
41+
- gosec
42+
source: "randomDelayMs := rand.Int63n"
43+
44+
- linters:
45+
- errcheck
46+
text: "formatter.Print"
47+
48+
- linters:
49+
- stylecheck
50+
text: "ST1023: should omit type"
51+
52+
- linters:
53+
- funlen
54+
- revive
55+
- goconst
56+
- lll
57+
- gosec
58+
path: _test\.go
59+
60+
linters:
61+
enable:
62+
- bodyclose
63+
- dogsled
64+
- dupl
65+
- errcheck
66+
- exhaustive
67+
- funlen
68+
- gochecknoinits
69+
- goconst
70+
- gocritic
71+
- gocyclo
72+
- gofmt
73+
- goimports
74+
- gomnd
75+
- gomodguard #
76+
- goprintffuncname
77+
- gosec
78+
- gosimple
79+
- govet
80+
- ineffassign
81+
- lll
82+
- megacheck #
83+
- misspell
84+
- nakedret
85+
- noctx
86+
- nolintlint
87+
- revive
88+
- rowserrcheck
89+
- staticcheck
90+
- stylecheck
91+
- typecheck
92+
- unconvert
93+
- unparam
94+
- whitespace
95+
disable:
96+
- depguard
97+
- asciicheck
98+
- gochecknoglobals
99+
- gocognit
100+
- godot
101+
- godox
102+
- goerr113 #
103+
- interfacer
104+
- maligned #
105+
- nestif #
106+
- prealloc #
107+
- scopelint
108+
- testpackage #
109+
- wsl #
110+
presets:
111+
- bugs
112+
- unused
113+
fast: false
114+
115+
linters-settings:
116+
shadow: true
117+
dupl:
118+
threshold: 100
119+
errcheck:
120+
check-type-assertions: true
121+
check-blank: true
122+
exhaustive:
123+
default-signifies-exhaustive: false
124+
funlen:
125+
lines: 100
126+
statements: 50
127+
nestif:
128+
min-complexity: 4
129+
goconst:
130+
min-len: 2
131+
min-occurrences: 2
132+
gocritic:
133+
enabled-tags:
134+
- diagnostic
135+
- experimental
136+
- opinionated
137+
- performance
138+
- style
139+
disabled-checks:
140+
- dupImport # https://github.com/go-critic/go-critic/issues/845
141+
- ifElseChain
142+
- octalLiteral
143+
- whyNoLint
144+
- wrapperFunc
145+
gocyclo:
146+
min-complexity: 15
147+
goimports:
148+
local-prefixes: github.com/eset/grpc-rest-proxy
149+
golint:
150+
min-confidence: 0
151+
gomnd:
152+
settings:
153+
mnd:
154+
# don't include the "operation" and "assign"
155+
checks: argument,case,condition,return
156+
govet:
157+
settings:
158+
printf:
159+
funcs:
160+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
161+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
162+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
163+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
164+
depguard:
165+
list-type: blacklist
166+
include-go-root: false
167+
packages:
168+
- github.com/prometheus/common/log
169+
packages-with-error-message:
170+
# specify an error message to output when a blacklisted package is used
171+
- github.com/prometheus/common/log: "logging is allowed only by github.com/sirupsen/logrus"
172+
lll:
173+
line-length: 140
174+
maligned:
175+
suggest-new: true
176+
misspell:
177+
locale: US
178+
ignore-words:
179+
- bal
180+
nolintlint:
181+
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
182+
allow-unused: false # report any unused nolint directives
183+
require-explanation: false # don't require an explanation for nolint directives
184+
require-specific: false # don't require nolint directives to be specific about which linter is being skipped

LICENSE

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright (c) 2024 ESET spol. s r.o.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
APP_NAME := grpc-rest-proxy
2+
VERSION := $(shell git describe --tags 2> /dev/null || echo dev)
3+
COMMIT := $(shell git rev-parse HEAD)
4+
BUILD := $(shell date +%FT%T%z)
5+
PATH := $(GOPATH)/bin:/usr/local/bin:/usr/local/go/bin:$(PATH)
6+
7+
VERSION_FILE := main
8+
LDFLAGS=-ldflags "-X=$(VERSION_FILE).Version=$(VERSION) -X=$(VERSION_FILE).Commit=$(COMMIT) -X=$(VERSION_FILE).Build=$(BUILD)"
9+
10+
all: vulncheck build test race cover
11+
default: build
12+
build: fmt lint build-only
13+
test: fmt lint test-only
14+
15+
fmt:
16+
go fmt ./...
17+
18+
lint:
19+
@golangci-lint --version > /dev/null 2>&1 || { echo >&2 "golangci-lint not installed. See: https://golangci-lint.run/usage/install/#linux-and-windows."; exit 1; }
20+
golangci-lint run
21+
22+
vulncheck:
23+
govulncheck ./...
24+
25+
build-only: build-service
26+
27+
build-service:
28+
CGO_ENABLED=0 GOOS=linux go build $(LDFLAGS) -o $(APP_NAME) ./cmd/service/
29+
30+
build-example-grpc-server:
31+
CGO_ENABLED=0 GOOS=linux go build $(LDFLAGS) -o example-grpc-server ./cmd/examples/grpcserver
32+
33+
test-only:
34+
go test ./...
35+
36+
race:
37+
go test -race ./...
38+
39+
cover:
40+
go test -cover ./...
41+
42+
coverprofile:
43+
go test -coverprofile=coverage.out ./...
44+
go tool cover -html=coverage.out
45+
46+
clean:
47+
rm -f $(APP_NAME)
48+
49+
docker:
50+
go mod vendor
51+
docker build . -t grpc-rest-proxy-test
52+
53+
.PHONY: all default build test fmt lint build-only test-only race cover coverprofile clean

0 commit comments

Comments
 (0)