Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the coding style warning which report by golint and revive #131

Merged
merged 67 commits into from
Jul 17, 2021
Merged

Fixing the coding style warning which report by golint and revive #131

merged 67 commits into from
Jul 17, 2021

Conversation

haoel
Copy link
Contributor

@haoel haoel commented Jul 16, 2021

Fix the warning from golint

  • Adding the comments for exported functions and variables
  • fix the issue return an unexported type
exported func NewAPIServer returns unexported type *worker.apiServer, which can be annoying to use
  • rename the stutters
pkg/api/error.go:30:2: type name will be used as api.APIErr by other packages, and that stutters; consider calling this Err
pkg/api/server.go:46:2: type name will be used as api.APIGroup by other packages, and that stutters; consider calling this Group
pkg/api/server.go:52:2: type name will be used as api.APIEntry by other packages, and that stutters; consider calling this Entry

Fix The warning from revive

pkg/object/function/spec/fsm.go:83:13: should omit type map[State]struct{} from declaration of var validState; it will be inferred from the right-hand side
pkg/object/function/spec/fsm.go:91:13: should omit type map[Event]struct{} from declaration of var validEvent; it will be inferred from the right-hand side
pkg/object/httppipeline/httppipeline.go:150:21: should omit type sync.Map from declaration of var runningContexts; it will be inferred from the right-hand side
pkg/object/meshcontroller/registrycenter/consul.go:61:12: should omit type map[string][]string from declaration of var svcs; it will be inferred from the right-hand side
pkg/object/meshcontroller/registrycenter/discovery.go:113:15: should omit type bool from declaration of var inGlobal; it will be inferred from the right-hand side
pkg/object/meshcontroller/registrycenter/registry.go:131:21: should drop = 0 from declaration of var tryTimes; it is the zero value
pkg/common/sample.go:48:19: should drop = 0 from declaration of var idx; it is the zero value
pkg/common/stat_aggregator_test.go:39:8: should omit type string from declaration of var want; it will be inferred from the right-hand side
pkg/common/stat_aggregator_test.go:40:8: should omit type string from declaration of var got; it will be inferred from the right-hand side

@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2021

Codecov Report

Merging #131 (5975d52) into main (56b55b0) will increase coverage by 0.07%.
The diff coverage is 44.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
+ Coverage   46.48%   46.55%   +0.07%     
==========================================
  Files          38       38              
  Lines        2590     2586       -4     
==========================================
  Hits         1204     1204              
+ Misses       1305     1302       -3     
+ Partials       81       80       -1     
Impacted Files Coverage Δ
pkg/common/callback.go 0.00% <0.00%> (ø)
pkg/common/go.go 0.00% <ø> (ø)
pkg/common/lazybuf.go 0.00% <ø> (ø)
pkg/common/option.go 0.00% <0.00%> (ø)
pkg/common/os.go 0.00% <ø> (ø)
pkg/common/sample.go 0.00% <0.00%> (ø)
pkg/common/stat_aggregator.go 61.94% <ø> (ø)
pkg/common/sys_proc_linux.go 0.00% <ø> (ø)
pkg/common/sys_proc_others.go 0.00% <ø> (ø)
pkg/common/time.go 0.00% <ø> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e6abea...5975d52. Read the comment docs.

pkg/api/api.go Outdated Show resolved Hide resolved
pkg/common/callback.go Outdated Show resolved Hide resolved
pkg/cluster/syncer.go Outdated Show resolved Hide resolved
pkg/common/callback.go Outdated Show resolved Hide resolved
pkg/common/option.go Outdated Show resolved Hide resolved
pkg/util/jmxtool/jmx_controller.go Outdated Show resolved Hide resolved
pkg/util/sem/semaphore.go Outdated Show resolved Hide resolved
pkg/util/sem/semaphore.go Outdated Show resolved Hide resolved
pkg/util/sem/semaphore.go Outdated Show resolved Hide resolved
pkg/supervisor/object.go Outdated Show resolved Hide resolved
@Loyalsoldier
Copy link
Contributor

You can use these two tools to format code:

More tools can be found at https://golangci-lint.run/usage/linters/

pkg/common/callback.go Outdated Show resolved Hide resolved
pkg/common/callback.go Outdated Show resolved Hide resolved
pkg/common/callback.go Outdated Show resolved Hide resolved
pkg/common/callback.go Outdated Show resolved Hide resolved
pkg/common/callback.go Outdated Show resolved Hide resolved
pkg/common/option.go Outdated Show resolved Hide resolved
pkg/object/function/spec/function.go Outdated Show resolved Hide resolved
pkg/object/meshcontroller/spec/spec.go Outdated Show resolved Hide resolved
pkg/object/meshcontroller/spec/spec.go Outdated Show resolved Hide resolved
pkg/object/meshcontroller/spec/spec.go Outdated Show resolved Hide resolved
haoel and others added 17 commits July 16, 2021 21:19
Copy link
Contributor

@xxx7xxxx xxx7xxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the request changes are adjust third-person singular of verbs, and I just add a period for the comments by the way without doing all of them.

example/backend-service/mirror/mirror.go Outdated Show resolved Hide resolved
example/backend-service/mirror/mirror.go Outdated Show resolved Hide resolved
example/backend-service/mirror/mirror.go Outdated Show resolved Hide resolved
pkg/api/api.go Outdated Show resolved Hide resolved
pkg/cluster/syncer.go Outdated Show resolved Hide resolved
pkg/common/stat_aggregator.go Outdated Show resolved Hide resolved
pkg/common/stat_aggregator.go Outdated Show resolved Hide resolved
pkg/common/stat_aggregator.go Outdated Show resolved Hide resolved
pkg/common/stat_aggregator.go Outdated Show resolved Hide resolved
pkg/common/stat_aggregator.go Outdated Show resolved Hide resolved
@haoel haoel changed the title Added the comments for exported functions and variables Fixing the coding style warning which report by golint and revive Jul 17, 2021
@haoel haoel merged commit d36e20d into easegress-io:main Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants