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

Code does not pass golint checks #243

Closed
aldas opened this issue Apr 9, 2021 · 2 comments · Fixed by #254
Closed

Code does not pass golint checks #243

aldas opened this issue Apr 9, 2021 · 2 comments · Fixed by #254
Milestone

Comments

@aldas
Copy link

aldas commented Apr 9, 2021

Library code does not pass Go linter checks (https://github.com/golang/lint)

it seems that golint is commented out in CI flow

# name: check go fmt

Reproduce with:

go get -u golang.org/x/lint/golint
golint ./...

Example:

x@x:~/code/influxdb-client-go$ git log -n 1
commit fa15edd8bd9549750d2f93b6ccb386434df63fbe (HEAD -> master, tag: v2.2.3, origin/master, origin/HEAD)
Author: vlastahajek <vlastimil.hajek@bonitoo.io>
Date:   Thu Apr 1 17:17:29 2021 +0200

    release version 2.2.3

x@x:~/code/influxdb-client-go$ go get -u golang.org/x/lint/golint
go: downloading golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5
go: downloading golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7
go get: added golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5
go get: upgraded golang.org/x/net v0.0.0-20191112182307-2180aed22343 => v0.0.0-20201021035429-f5854403a974
go get: upgraded golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f => v0.1.0
x@x:~/code/influxdb-client-go$ golint ./...    
version.go:15:2: exported const Version should have comment (or a comment on this block) or be unexported
api/authorizations.go:43:1: exported function NewAuthorizationsAPI should have comment or be unexported
api/buckets.go:70:1: exported function NewBucketsAPI should have comment or be unexported
api/buckets.go:115:9: if block ends with a return statement, so drop this else and outdent its block
api/delete.go:31:1: exported function NewDeleteAPI should have comment or be unexported
api/labels.go:47:1: exported function NewLabelsAPI should have comment or be unexported
api/organizations.go:66:1: exported function NewOrganizationsAPI should have comment or be unexported
api/organizations.go:104:9: if block ends with a return statement, so drop this else and outdent its block
api/paging.go:9:6: exported type PagingOption should have comment or be unexported
api/query.go:52:1: exported function NewQueryAPI should have comment or be unexported
api/tasks.go:144:1: exported function NewTasksAPI should have comment or be unexported
api/users.go:60:1: exported function NewUsersAPI should have comment or be unexported
api/write.go:57:1: exported function NewWriteAPI should have comment or be unexported
api/write.go:78:1: exported method WriteAPIImpl.Errors should have comment or be unexported
api/write.go:85:1: exported method WriteAPIImpl.Flush should have comment or be unexported
api/write.go:170:1: exported method WriteAPIImpl.Close should have comment or be unexported
api/write.go:199:1: exported method WriteAPIImpl.WriteRecord should have comment or be unexported
api/write.go:205:1: exported method WriteAPIImpl.WritePoint should have comment or be unexported
api/writeAPIBlocking.go:66:105: exported func NewWriteAPIBlocking returns unexported type *api.writeAPIBlocking, which can be annoying to use
domain/utils.go:11:1: exported function DomainErrorToError should have comment or be unexported
domain/utils.go:11:6: func name will be used as domain.DomainErrorToError by other packages, and that stutters; consider calling this ErrorToError
internal/examples/fakeclient.go:19:1: exported method Options.SetBatchSize should have comment or be unexported
internal/examples/fakeclient.go:26:1: exported function NewClient should have comment or be unexported
internal/examples/fakeclient.go:26:36: exported func NewClient returns unexported type *examples.fakeClient, which can be annoying to use
internal/examples/fakeclient.go:31:1: exported function NewClientWithOptions should have comment or be unexported
internal/examples/fakeclient.go:31:59: exported func NewClientWithOptions returns unexported type *examples.fakeClient, which can be annoying to use
internal/gzip/gzip.go:14:6: exported type ReadWaitCloser should have comment or be unexported
internal/gzip/gzip.go:19:1: exported method ReadWaitCloser.Close should have comment or be unexported
internal/log/logger.go:12:1: exported function Debugf should have comment or be unexported
internal/log/logger.go:17:1: exported function Debug should have comment or be unexported
internal/log/logger.go:23:1: exported function Infof should have comment or be unexported
internal/log/logger.go:28:1: exported function Info should have comment or be unexported
internal/log/logger.go:34:1: exported function Warnf should have comment or be unexported
internal/log/logger.go:39:1: exported function Warn should have comment or be unexported
internal/log/logger.go:45:1: exported function Errorf should have comment or be unexported
internal/log/logger.go:51:1: exported function Error should have comment or be unexported
internal/test/generators.go:11:1: exported function GenPoints should have comment or be unexported
internal/test/generators.go:39:1: exported function GenRecords should have comment or be unexported
internal/test/http_service.go:23:6: exported type HTTPService should have comment or be unexported
internal/test/http_service.go:34:1: exported method HTTPService.WasGzip should have comment or be unexported
internal/test/http_service.go:38:1: exported method HTTPService.SetWasGzip should have comment or be unexported
internal/test/http_service.go:42:1: exported method HTTPService.ServerURL should have comment or be unexported
internal/test/http_service.go:46:1: exported method HTTPService.ServerAPIURL should have comment or be unexported
internal/test/http_service.go:50:1: exported method HTTPService.Authorization should have comment or be unexported
internal/test/http_service.go:54:1: exported method HTTPService.HTTPClient should have comment or be unexported
internal/test/http_service.go:58:1: exported method HTTPService.Close should have comment or be unexported
internal/test/http_service.go:69:1: exported method HTTPService.SetReplyError should have comment or be unexported
internal/test/http_service.go:75:1: exported method HTTPService.ReplyError should have comment or be unexported
internal/test/http_service.go:81:1: exported method HTTPService.SetAuthorization should have comment or be unexported
internal/test/http_service.go:84:1: exported method HTTPService.GetRequest should have comment or be unexported
internal/test/http_service.go:87:1: exported method HTTPService.DoHTTPRequest should have comment or be unexported
internal/test/http_service.go:91:1: exported method HTTPService.DoHTTPRequestWithResponse should have comment or be unexported
internal/test/http_service.go:95:1: exported method HTTPService.DoPostRequest should have comment or be unexported
internal/test/http_service.go:120:9: if block ends with a return statement, so drop this else and outdent its block
internal/test/http_service.go:138:1: exported method HTTPService.Lines should have comment or be unexported
internal/test/http_service.go:144:1: exported function NewTestService should have comment or be unexported
internal/write/service.go:26:6: exported type Batch should have comment or be unexported
internal/write/service.go:33:1: exported function NewBatch should have comment or be unexported
internal/write/service.go:40:6: exported type Service should have comment or be unexported
internal/write/service.go:52:1: exported function NewService should have comment or be unexported
internal/write/service.go:69:1: exported method Service.HandleWrite should have comment or be unexported
internal/write/service.go:135:11: if block ends with a return statement, so drop this else and outdent its block
internal/write/service.go:148:1: exported method Service.WriteBatch should have comment or be unexported
internal/write/service.go:219:1: exported method Service.EncodePoints should have comment or be unexported
internal/write/service.go:247:1: exported method Service.WriteURL should have comment or be unexported
x@x:~/code/influxdb-client-go$
@vlastahajek
Copy link
Contributor

vlastahajek commented Apr 14, 2021

We use go vet and stylecheck. Those cover the "main pains". golint seem to be very meticulous.
For example, why to comment implementation method, when it is commented on the interface?
Or the internal stuff, which is mostly simple and self-explanatory.

But, let's fix it to get rid of such style issues.

@vlastahajek vlastahajek added this to the v2.3.0 milestone Apr 14, 2021
@aldas
Copy link
Author

aldas commented Apr 14, 2021

Best practice. Also any struct can implement any interface in Go if method matches signature. Those interfaces does not need to be even in same package (or even library). But this does not mean that what method does is the same as interface.

vlastahajek added a commit to bonitoo-io/influxdb-client-go that referenced this issue Apr 30, 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 a pull request may close this issue.

2 participants