Skip to content

Commit 52fc79e

Browse files
committed
add sponge+dtm+flashSale example
1 parent 7630971 commit 52fc79e

File tree

313 files changed

+24033
-2834
lines changed

Some content is hidden

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

313 files changed

+24033
-2834
lines changed

_12_sponge-dtm-flashSale/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Sponge DTM Flash Sale
2+
3+
## Overview
4+
5+
- [**http**](http): http Flash Sale service.
6+
- [**grpc+http**](grpc+http): Flash Sale service that supports both grpc and http protocols.

__10_micro-grpc-http-protobuf/.gitignore renamed to _12_sponge-dtm-flashSale/grpc+http/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ dist/
2222
*.ipr
2323
*.iws
2424

25-
cmd/user/user
25+
cmd/flashSale/flashSale
2626

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,342 @@
1+
# This file configures flashSale.
2+
3+
run:
4+
# timeout for analysis, e.g. 30s, 5m, default is 1m
5+
timeout: 10m
6+
# default concurrency is available CPU number
7+
concurrency: 4
8+
# include test files or not, default is true
9+
tests: false
10+
# which dirs to skip: issues from them won't be reported;
11+
# can use regexp here: generated.*, regexp is applied on full path;
12+
# default value is empty list, but default dirs are skipped independently
13+
# from this option's value (see skip-dirs-use-default).
14+
skip-dirs:
15+
- docs
16+
- api
17+
# which files to skip: they will be analyzed, but issues from them
18+
# won't be reported. Default value is empty list, but there is
19+
# no need to include all autogenerated files, we confidently recognize
20+
# autogenerated files. If it's not please let us know.
21+
skip-files:
22+
- _test.go
23+
24+
# exit code when at least one issue was found, default is 1
25+
issues-exit-code: 1
26+
27+
# list of build tags, all linters use it. Default is empty list.
28+
build-tags:
29+
- mytag
30+
31+
# default is true. Enables skipping of directories:
32+
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
33+
skip-dirs-use-default: true
34+
35+
36+
linters:
37+
# please, do not use `enable-all`: it's deprecated and will be removed soon.
38+
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
39+
disable-all: true
40+
enable:
41+
- revive
42+
- goimports
43+
- gofmt
44+
- unused
45+
#- depguard
46+
- dogsled
47+
- errcheck
48+
#- gochecknoinits
49+
- goconst
50+
- gocyclo
51+
- gosimple
52+
- govet
53+
- lll
54+
- misspell
55+
- typecheck
56+
- unconvert
57+
- whitespace
58+
- staticcheck
59+
#- bodyclose
60+
#- dupl
61+
#- goprintffuncname
62+
#- gosec
63+
#- unparam
64+
#- ineffassign
65+
66+
67+
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+
121+
dogsled:
122+
# checks assignments with too many blank identifiers; default is 2
123+
max-blank-identifiers: 2
124+
125+
dupl:
126+
# tokens count to trigger issue, 150 by default
127+
threshold: 100
128+
129+
errcheck:
130+
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
131+
# default is false: such cases aren't reported by default.
132+
check-type-assertions: false
133+
134+
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
135+
# default is false: such cases aren't reported by default.
136+
check-blank: false
137+
138+
# [deprecated] comma-separated list of pairs of the form pkg:regex
139+
# the regex is used to ignore names within pkg. (default "fmt:.*").
140+
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
141+
ignore: fmt:.*,io/ioutil:^Read.*
142+
143+
# path to a file containing a list of functions to exclude from checking
144+
# see https://github.com/kisielk/errcheck#excluding-functions for details
145+
# exclude: /path/to/file.txt
146+
funlen:
147+
lines: 60
148+
statements: 40
149+
150+
gocognit:
151+
# minimal code complexity to report, 30 by default (but we recommend 10-20)
152+
min-complexity: 10
153+
154+
goconst:
155+
# minimal length of string constant, 3 by default
156+
min-len: 4
157+
# minimal occurrences count to trigger, 3 by default
158+
min-occurrences: 4
159+
160+
gocyclo:
161+
# minimal code complexity to report, 30 by default (but we recommend 10-20)
162+
min-complexity: 20
163+
164+
godox:
165+
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
166+
# might be left in the code accidentally and should be resolved before merging
167+
keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
168+
- NOTE
169+
- OPTIMIZE # marks code that should be optimized before merging
170+
- HACK # marks hack-arounds that should be removed before merging
171+
172+
gofmt:
173+
# simplify code: gofmt with `-s` option, true by default
174+
simplify: true
175+
176+
goimports:
177+
# put imports beginning with prefix after 3rd-party packages;
178+
# it's a comma-separated list of prefixes
179+
local-prefixes: flashSale
180+
181+
gomnd:
182+
settings:
183+
mnd:
184+
# the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
185+
checks: argument,case,condition,operation,return,assign
186+
187+
govet:
188+
# report about shadowed variables
189+
check-shadowing: true
190+
191+
# settings per analyzer
192+
settings:
193+
printf: # analyzer name, run `go tool vet help` to see all analyzers
194+
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
195+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
196+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
197+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
198+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
199+
200+
# enable or disable analyzers by name
201+
enable:
202+
- atomicalign
203+
enable-all: false
204+
disable:
205+
- shadow
206+
disable-all: false
207+
208+
depguard:
209+
list-type: blacklist
210+
include-go-root: false
211+
#packages:
212+
# - github.com/user/name
213+
#packages-with-error-message:
214+
# specify an error message to output when a blacklisted package is used
215+
# - github.com/user/name: "logging is allowed only by logutils.Log"
216+
217+
lll:
218+
# max line length, lines longer will be reported. Default is 120.
219+
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
220+
line-length: 200
221+
# tab width in spaces. Default to 1.
222+
tab-width: 1
223+
224+
maligned:
225+
# print struct with more effective memory layout or not, false by default
226+
suggest-new: true
227+
228+
misspell:
229+
# Correct spellings using locale preferences for US or UK.
230+
# Default is to use a neutral variety of English.
231+
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
232+
locale: US
233+
ignore-words:
234+
- someword
235+
236+
nakedret:
237+
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
238+
max-func-lines: 30
239+
240+
prealloc:
241+
# XXX: we don't recommend using this linter before doing performance profiling.
242+
# For most programs usage of prealloc will be a premature optimization.
243+
244+
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
245+
# True by default.
246+
simple: true
247+
range-loops: true # Report preallocation suggestions on range loops, true by default
248+
for-loops: false # Report preallocation suggestions on for loops, false by default
249+
250+
#rowserrcheck:
251+
# packages:
252+
# - github.com/user/name
253+
254+
unparam:
255+
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
256+
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
257+
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
258+
# with golangci-lint call it on a directory with the changed file.
259+
check-exported: false
260+
261+
unused:
262+
# treat code as a program (not a library) and report unused exported identifiers; default is false.
263+
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
264+
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
265+
# with golangci-lint call it on a directory with the changed file.
266+
check-exported: false
267+
268+
whitespace:
269+
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
270+
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
271+
272+
wsl:
273+
# If true append is only allowed to be cuddled if appending value is
274+
# matching variables, fields or types on line above. Default is true.
275+
strict-append: true
276+
# Allow calls and assignments to be cuddled as long as the lines have any
277+
# matching variables, fields or types. Default is true.
278+
allow-assign-and-call: true
279+
# Allow multiline assignments to be cuddled. Default is true.
280+
allow-multiline-assign: true
281+
# Allow declarations (var) to be cuddled.
282+
allow-cuddle-declarations: false
283+
# Allow trailing comments in ending of blocks
284+
allow-trailing-comment: false
285+
# Force newlines in end of case at this limit (0 = never).
286+
force-case-trailing-whitespace: 0
287+
288+
issues:
289+
# List of regexps of issue texts to exclude, empty list by default.
290+
# But independently from this option we use default exclude patterns,
291+
# it can be disabled by `exclude-use-default: false`. To list all
292+
# excluded by default patterns execute `golangci-lint run --help`
293+
exclude:
294+
- abcdef
295+
296+
# Excluding configuration per-path, per-linter, per-text and per-source
297+
exclude-rules:
298+
# Exclude some linters from running on tests files.
299+
- path: _test\.go
300+
linters:
301+
- gocyclo
302+
- errcheck
303+
- dupl
304+
- gosec
305+
306+
# Exclude known linters from partially hard-vendored code,
307+
# which is impossible to exclude via "nolint" comments.
308+
- path: internal/hmac/
309+
text: "weak cryptographic primitive"
310+
linters:
311+
- gosec
312+
313+
# Exclude lll issues for long lines with go:generate
314+
- linters:
315+
- lll
316+
source: "^//go:generate "
317+
318+
# Independently from option `exclude` we use default exclude patterns,
319+
# it can be disabled by this option. To list all
320+
# excluded by default patterns execute `golangci-lint run --help`.
321+
# Default value for this option is true.
322+
exclude-use-default: false
323+
324+
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
325+
max-issues-per-linter: 0
326+
327+
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
328+
max-same-issues: 0
329+
330+
# Show only new issues: if there are unstaged changes or untracked files,
331+
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
332+
# It's a super-useful option for integration of golangci-lint into existing
333+
# large codebase. It's not practical to fix all existing issues at the moment
334+
# of integration: much better don't allow issues in new code.
335+
# Default is false.
336+
new: false
337+
338+
# Show only new issues created after git revision `REV`
339+
new-from-rev: ""
340+
341+
service:
342+
golangci-lint-version: 1.48.0 # use the fixed version to not introduce new linters unexpectedly

0 commit comments

Comments
 (0)