-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Enable golint
on the code base
#4098
Comments
one problem is that golint explicitly states that the tool shouldn’t be used in automated build processes: https://github.com/golang/lint#purpose "do not expect or require code to be completely "lint-free". In short, this tool is not, and will never be, So there is no ability to specify ANY ignores for exceptions to the rules, like there is with other tools like pylint. And they reject PRs by people trying to change that... you could always just enforce that the number of lint errors is less than the number of exceptions with a |
Just to get things going I will start with root and client. |
Issue: Enable `golint` on the code base influxdata#4098 - [X] CHANGELOG.md updated - [X] Rebased/mergable - [X] Tests pass - [X] Sign [CLA](http://influxdb.com/community/cla.html) (if not already signed)
Issue: Enable golint on the code base influxdata#4098
Issue: Enable golint on the code base influxdata#4098 (changes only for the cluster subpackage) - [ ] CHANGELOG.md updated - [X] Rebased/mergable - [X] Tests pass - [X] Sign [CLA](http://influxdb.com/community/cla.html) (if not already signed)
So far it looks like root, uuid, and cluster are merged. @corylanou could you update the todo list? |
#4173 is still open, but I updated the other ones. Thanks! |
Please let me know if I should make more changes to #4173 or close it? Thanks. |
I will start working on influxql and influxd |
@corylanou client is merged. |
Starting work on cluster/internal. |
I run a little script on the codebase to count the warnings.
So following packages can be marked as done and enabled in ci
|
@wind0r can you share a gist of the script then we can use it here as well and all stay on the same page. Thanks! |
Sure. Need to be executed in the influxdb/influxdb folder. |
Awesome, thanks! |
Added some comments to the udp service so golint passes. Ref #4098
@corylanou services/udp is done and passes. ref commit is 434d060 |
I wanted to spend this weekend a couple of hours and make a few of these packages lintable. Regarding influxdb/services/graphite package. In the parser.go file the exported function NewTemplate returns a pointer to an unexported type *graphite.template. To make it also testable it is idiomatic to return an exported interface if not an exported struct, then the returned satisfying struct of that interface can be unexported. That would make the linter pass for that specific line. What you think? |
@corylanou I was looking at tackling |
@jrbury I'm no longer with Influx but hopefully someone else can give you direction on the issue from the team. |
@corylanou Thanks! Maybe @e-dard would know and/or point me towards who would |
@jrbury can you give me some example struct/methods you're talking about? |
For example in httpd/requests.go there is
Currently, neither of these structs are accessed outside of the httpd package, so I could make them private, but if they were designed with the intent to be able to access them, then I'll just comment them. |
I think before we continue working on this, we need a way to make sure that packages that have been made golintable stay golinted. That usually means the build has to fail. So I would say if you want to start somewhere, updating the build system so that it runs golint on a subset of directories that have been golinted already is the first thing that has to be done before we bother accepting more PR's for this issue. Without that, this issue will have no end since we will just continue writing code and forgetting to run golint to check it. |
Can we get the latest state? I see that the updating is about 10 months ago. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity. Please reopen if this issue is still important to you. Thank you for your contributions. |
Description
We want to enable golint on our codebase.
First, get golint:
Then run it on any package you want to lint:
Also, you can use this script to get an output of how many lint errors are in each package, and which packages are currently passing (thanks @wind0r):
We want to do this for several reasons:
How to
Following is the list of all
github.com/influxdb/influxdb
subpackages. For each we need to:We also need to make it easy for contributors to easily give golint a local run before submitting the PR. We should probably have that script only cover a hardcoded list of packages that we can augment over time.
Packages:
This PR is modeled after Dockers initiative to do the same with their project: moby/moby#14756
Updated List October, 2016
The text was updated successfully, but these errors were encountered: