Skip to content

Commit 9c7c175

Browse files
committed
update community-cluster
1 parent ef4ae10 commit 9c7c175

File tree

257 files changed

+7409
-2969
lines changed

Some content is hidden

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

257 files changed

+7409
-2969
lines changed

8_community-cluster/README.md

+49-69
Large diffs are not rendered by default.

8_community-cluster/community_gw/.golangci.yml

+54-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ run:
1212
# default value is empty list, but default dirs are skipped independently
1313
# from this option's value (see skip-dirs-use-default).
1414
skip-dirs:
15-
- pkg
1615
- docs
1716
- api
1817
# which files to skip: they will be analyzed, but issues from them
@@ -39,7 +38,7 @@ linters:
3938
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
4039
disable-all: true
4140
enable:
42-
- golint
41+
- revive
4342
- goimports
4443
- gofmt
4544
- unused
@@ -66,6 +65,59 @@ linters:
6665

6766

6867
linters-settings:
68+
revive:
69+
rules:
70+
- name: argument-limit
71+
arguments: [ 8 ]
72+
- name: atomic
73+
- name: bare-return
74+
- name: blank-imports
75+
- name: bool-literal-in-expr
76+
- name: call-to-gc
77+
- name: confusing-naming
78+
- name: confusing-results
79+
- name: constant-logical-expr
80+
- name: context-as-argument
81+
- name: context-keys-type
82+
- name: deep-exit
83+
- name: defer
84+
- name: dot-imports
85+
- name: duplicated-imports
86+
- name: early-return
87+
- name: empty-block
88+
#- name: empty-lines
89+
- name: error-naming
90+
- name: error-return
91+
- name: error-strings
92+
- name: errorf
93+
- name: function-result-limit
94+
arguments: [ 3 ]
95+
- name: identical-branches
96+
- name: if-return
97+
- name: import-shadowing
98+
- name: increment-decrement
99+
- name: indent-error-flow
100+
- name: modifies-parameter
101+
- name: modifies-value-receiver
102+
- name: package-comments
103+
- name: range
104+
- name: range-val-address
105+
- name: range-val-in-closure
106+
- name: receiver-naming
107+
- name: redefines-builtin-id
108+
- name: string-of-int
109+
- name: struct-tag
110+
- name: superfluous-else
111+
- name: time-naming
112+
- name: unconditional-recursion
113+
- name: unexported-naming
114+
- name: unnecessary-stmt
115+
- name: unreachable-code
116+
- name: unused-parameter
117+
- name: var-declaration
118+
- name: var-naming
119+
- name: waitgroup-by-value
120+
69121
dogsled:
70122
# checks assignments with too many blank identifiers; default is 2
71123
max-blank-identifiers: 2
@@ -126,10 +178,6 @@ linters-settings:
126178
# it's a comma-separated list of prefixes
127179
local-prefixes: community_gw
128180

129-
golint:
130-
# minimal confidence for issues, default is 0.8
131-
min-confidence: 0.8
132-
133181
gomnd:
134182
settings:
135183
mnd:

8_community-cluster/community_gw/Makefile

+53-54
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,7 @@ SHELL := /bin/bash
33
PROJECT_NAME := "community_gw"
44
PKG := "$(PROJECT_NAME)"
55
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/ | grep -v /api/)
6-
#GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
7-
8-
9-
.PHONY: install
10-
# installation of dependent tools
11-
install:
12-
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
13-
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
14-
go install github.com/envoyproxy/protoc-gen-validate@latest
15-
go install github.com/srikrsna/protoc-gen-gotag@latest
16-
go install community_gw/cmd/protoc-gen-go-gin@latest
17-
go install community_gw/cmd/protoc-gen-go-rpc-tmpl@latest
18-
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
19-
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest
20-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
21-
go install github.com/swaggo/swag/cmd/swag@latest
22-
go install github.com/ofabry/go-callvis@latest
23-
go install golang.org/x/pkgsite/cmd/pkgsite@latest
6+
247

258

269
.PHONY: mod
@@ -60,12 +43,6 @@ cover:
6043
go tool cover -html=cover.out
6144

6245

63-
.PHONY: docs
64-
# generate swagger docs, the host address can be changed via parameters, e.g. make docs HOST=192.168.3.37
65-
docs: mod fmt
66-
@bash scripts/swag-docs.sh $(HOST)
67-
68-
6946
.PHONY: graph
7047
# generate interactive visual function dependency graphs
7148
graph:
@@ -75,10 +52,16 @@ graph:
7552
@rm -f main.go community_gw.gv
7653

7754

55+
.PHONY: docs
56+
# generate swagger docs, only for ⓵ Web services created based on sql, the host address can be changed via parameters, e.g. make docs HOST=192.168.3.37
57+
docs: mod fmt
58+
@bash scripts/swag-docs.sh $(HOST)
59+
60+
7861
.PHONY: proto
79-
# generate *.pb.go codes from *.proto files
62+
# generate *.go and template code by proto files, if you do not refer to the proto file, the default is all the proto files in the api directory. you can specify the proto file, multiple files are separated by commas, e.g. make proto FILES=api/user/v1/user.proto. only for ⓶ Microservices created based on sql, ⓷ Web services created based on protobuf, ⓸ Microservices created based on protobuf, ⓹ RPC gateway service created based on protobuf
8063
proto: mod fmt
81-
@bash scripts/protoc.sh
64+
@bash scripts/protoc.sh $(FILES)
8265

8366

8467
.PHONY: proto-doc
@@ -91,9 +74,7 @@ proto-doc:
9174
# build community_gw for linux amd64 binary
9275
build:
9376
@echo "building 'community_gw', linux binary file will output to 'cmd/community_gw'"
94-
@cd cmd/community_gw && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOPROXY=https://goproxy.cn,direct go build
95-
96-
77+
@cd cmd/community_gw && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
9778

9879

9980

@@ -109,12 +90,30 @@ run-nohup:
10990
@bash scripts/run-nohup.sh $(CMD)
11091

11192

112-
.PHONY: docker-image
93+
.PHONY: binary-package
94+
# packaged binary files
95+
binary-package: build
96+
@bash scripts/binary-package.sh
97+
98+
99+
.PHONY: deploy-binary
100+
# deploy binary to remote linux server, e.g. make deploy-binary USER=root PWD=123456 IP=192.168.1.10
101+
deploy-binary: binary-package
102+
@expect scripts/deploy-binary.sh $(USER) $(PWD) $(IP)
103+
104+
105+
.PHONY: image-build-local
113106
# build image for local docker, tag=latest, use binary files to build
114-
docker-image: build
107+
image-build-local: build
115108
@bash scripts/image-build-local.sh
116109

117110

111+
.PHONY: deploy-docker
112+
# deploy service to local docker, if you want to update the service, run the make deploy-docker command again.
113+
deploy-docker: image-build-local
114+
@bash scripts/deploy-docker.sh
115+
116+
118117
.PHONY: image-build
119118
# build image for remote repositories, use binary files to build, e.g. make image-build REPO_HOST=addr TAG=latest
120119
image-build:
@@ -127,12 +126,6 @@ image-build2:
127126
@bash scripts/image-build2.sh $(REPO_HOST) $(TAG)
128127

129128

130-
.PHONY: image-build-rpc-test
131-
# build rpc test image for remote repositories, e.g. make image-build-rpc-test REPO_HOST=addr TAG=latest
132-
image-build-rpc-test:
133-
@bash scripts/image-rpc-test.sh $(REPO_HOST) $(TAG)
134-
135-
136129
.PHONY: image-push
137130
# push docker image to remote repositories, e.g. make image-push REPO_HOST=addr TAG=latest
138131
image-push:
@@ -145,22 +138,28 @@ deploy-k8s:
145138
@bash scripts/deploy-k8s.sh
146139

147140

148-
.PHONY: deploy-docker
149-
# deploy service to local docker, you must first run 'make docker-image' to generate a docker image, if you want to stop the server, pass the parameter stop, e.g. make deploy-docker CMD=stop
150-
deploy-docker:
151-
@bash scripts/deploy-docker.sh $(CMD)
141+
.PHONY: image-build-rpc-test
142+
# build rpc test image for remote repositories, e.g. make image-build-rpc-test REPO_HOST=addr TAG=latest
143+
image-build-rpc-test:
144+
@bash scripts/image-rpc-test.sh $(REPO_HOST) $(TAG)
152145

153146

154-
.PHONY: binary-package
155-
# packaged binary files
156-
binary-package: build
157-
@bash scripts/binary-package.sh
147+
.PHONY: patch
148+
# patch some dependent code, such as types.proto, mysql initialization code. e.g. make patch TYPE=types-pb , make patch TYPE=mysql-init
149+
patch:
150+
@bash scripts/patch.sh $(TYPE)
158151

159152

160-
.PHONY: deploy-binary
161-
# deploy binary, e.g. make deploy-binary USER=root PWD=123456 IP=192.168.1.10
162-
deploy-binary: binary-package
163-
@expect scripts/deploy-binary.sh $(USER) $(PWD) $(IP)
153+
.PHONY: copy-proto
154+
# copy proto file from the rpc server directory, multiple directories separated by commas. e.g. make copy-proto SERVER=yourServerDir
155+
copy-proto:
156+
@sponge patch copy-proto --server-dir=$(SERVER)
157+
158+
159+
.PHONY: update-config
160+
# update internal/config code base on yaml file
161+
update-config:
162+
@sponge config --server-dir=.
164163

165164

166165
.PHONY: clean
@@ -169,10 +168,10 @@ clean:
169168
@rm -vrf cmd/community_gw/community_gw
170169
@rm -vrf cover.out
171170
@rm -vrf main.go community_gw.gv
172-
@rm -vrf internal/ecode/*go.gen.*
173-
@rm -vrf internal/routers/*go.gen.*
174-
@rm -vrf internal/handler/*go.gen.*
175-
@rm -vrf internal/service/*go.gen.*
171+
@rm -vrf internal/ecode/*.go.gen*
172+
@rm -vrf internal/routers/*.go.gen*
173+
@rm -vrf internal/handler/*.go.gen*
174+
@rm -vrf internal/service/*.go.gen*
176175
@rm -rf community_gw-binary.tar.gz
177176
@echo "clean finished"
178177

@@ -184,7 +183,7 @@ help:
184183
@echo ' make [target]'
185184
@echo ''
186185
@echo 'Targets:'
187-
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
186+
@awk '/^[a-zA-Z\-_0-9]+:/ { \
188187
helpMessage = match(lastLine, /^# (.*)/); \
189188
if (helpMessage) { \
190189
helpCommand = substr($$1, 0, index($$1, ":")-1); \

8_community-cluster/community_gw/api/community_gw/v1/collect_gw_router.pb.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

8_community-cluster/community_gw/api/community_gw/v1/comment_gw_router.pb.go

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)