Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiMartynenko committed Feb 22, 2024
1 parent 57f2440 commit d3c7e64
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
52 changes: 52 additions & 0 deletions grpc/.golangci.pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# More info on config here: https://golangci-lint.run/usage/configuration/#config-file
run:
concurrency: 8
timeout: 10m
issues-exit-code: 1
tests: true
skip-dirs:
- bin
- vendor
- var
- tmp
- .cache
skip-files:
- \.pb\.go$
- \.pb\.gw\.go$

output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true

linters-settings:
govet:
check-shadowing: true
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2

linters:
disable-all: true
enable:
- errcheck
- goconst
- goimports
- gosec
- govet
- ineffassign
- megacheck
- revive
- typecheck
- unused

issues:
exclude-use-default: false
exclude:
# _ instead of err checks
- G104
- exported func .* returns unexported type .*, which can be annoying to use
- should have a package comment
- don't use an underscore in package name
44 changes: 44 additions & 0 deletions grpc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
LOCAL_BIN:=$(CURDIR)/bin

install-golangci-lint:
GOBIN=$(LOCAL_BIN) go install github.com/golangci/golangci-lint/cmd/[email protected]

lint:
GOBIN=$(LOCAL_BIN) golangci-lint run ./... --config .golangci.pipeline.yaml

install-deps:
GOBIN=$(LOCAL_BIN) go install google.golang.org/protobuf/cmd/[email protected]
GOBIN=$(LOCAL_BIN) go install -mod=mod google.golang.org/grpc/cmd/[email protected]

get-deps:
go get -u google.golang.org/protobuf/cmd/protoc-gen-go
go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc


generate:
make generate-chat-api

generate-chat-api:
mkdir -p pkg/chat_v1
protoc --proto_path api/chat_v1 \
--go_out=pkg/chat_v1 --go_opt=paths=source_relative \
--plugin=protoc-gen-go=bin/protoc-gen-go \
--go-grpc_out=pkg/chat_v1 --go-grpc_opt=paths=source_relative \
--plugin=protoc-gen-go-grpc=bin/protoc-gen-go-grpc \
api/chat_v1/chat_api.proto

build:
GOOS=linux GOARCH=amd64 go build -o service_linux cmd/grpc_server/main.go

copy-to-server:
scp service_linux [email protected]:

docker-build-and-push:
docker buildx build --no-cache --platform linux/amd64 -t cr.selcloud.ru/andy/test-server:v0.0.1 .
docker login -u token -p CRgAAAAAoQE7iwALBafCWa6tUmvJiqqLwWk4Z6PY cr.selcloud.ru/andy
docker push cr.selcloud.ru/andy/test-server:v0.0.1

# docker-build-and-push:
# docker buildx build --no-cache --platform linux/amd64 -t <REGESTRY>/test-server:v0.0.1 .
# docker login -u <USERNAME> -p <PASSWORD> <REGESTRY>
# docker push <REGESTRY>/test-server:v0.0.1

0 comments on commit d3c7e64

Please sign in to comment.