Comments (13)
Interesting. Can you narrow it down to a single Go source file, and point
me at it?
from lint.
Unfortunately I can't, I tried running it on each directory individually but golint did not panic. Here is the repo for reference: https://github.com/natebrennand/twiliogo
Is there a better way to get it to execute on a whole repo with sub directories than golint **/*.go
?
from lint.
tried combining directories, it will panic when run on common
and twiml
simultaneously. This was the smallest combination of directories that I could get to panic.
golint twiml/*.go common/*.go
from lint.
I'm seeing this issue too, and it only happens when I list all the files of my project too. If I do one package at a time, or try to remove some files, it passes. It's hard to nail down which file causes the problem when there are 12k LOCs.
I added a recover()
in github.com/golang/lint.(*file).walk()
to print f.filename
at the point that it crashes, and noticed it was always the same file. I've been running while golint the/file.go; do :; done
for a while now, I can't reproduce the crash with this file alone. :-/
Also even when I do get it to crash, the crash is nondeterministic (it often but not always crashes).
from lint.
I believe I know the cause, and will try to fix it this weekend.
from lint.
The underlying problem is that golint only operates on a single package at a time, and was behaving poorly if provided with files from different packages since that horribly confused the go/types
package. I'm adding some code to fail more gracefully, but you'll need to do something like
find <path> -type d | xargs -L 1 golint
to run golint on everything in a repo.
Having golint automatically shard the input file list by package might be a reasonable feature request, but right now I'm going to fix this panic only.
from lint.
thanks for the suggestion
from lint.
After the last couple changes, it seems like golint is now confused when I pass files from multiple packages together.
$ make lint
find . -type f -name '*.go' | xargs golint &>lint; :
if test -s lint; then cat lint; rm lint; exit 1; else rm lint; fi
./foo/bar.go is in package foo, not qux
make: *** [lint] Error 1
$ grep package foo/bar.go
package foo
from lint.
That's working as intended.
$ golint -h
Usage of golint:
golint [flags] # runs on package in current directory
golint [flags] package
golint [flags] directory
golint [flags] files... # must be a single package
...
Golint operates on a single package. See #58 for the feature request issue and a workaround.
from lint.
So you don't want to break existing stuff that might not expect a return 1 when lint is found, but you don't mind breaking existing stuff that was passing a list of files in argument. :(
I'll change our Makefiles but it's annoying because there is no consistent way anymore to "lint everything" and people don't generally update their golint frequently (if at all). So what version of golint they have depends on when they first ran go get
.
from lint.
It boils down to this:
for dir in `find . -type f -name '*.go' -exec dirname {} ';' | sort -u`; do golint $dir; done
But that only works for those with the latest version of golint
. Maybe time to add a flag to recursively lint everything under a certain directory?
from lint.
On 16 September 2014 11:39, Benoit Sigoure [email protected]
wrote:
So you don't want to break existing stuff that might not expect a return 1
when lint is found, but you don't mind breaking existing stuff that was
passing a list of files in argument. :(No, that's misrepresenting my stance. Backward compatibility is not a
relevant concern on exit codes for me.
from lint.
On 16 September 2014 11:43, Benoit Sigoure [email protected] wrote:
It boils down to this:
for dir in
find . -type f -name '*.go' -exec dirname {} ';' | sort -u
; do golint $dir; doneBut that only works for those with the latest version of golint. Maybe
time to add a flag to recursively lint everything under a certain directory?
Did you read #58, like I suggested? It's simpler than that:
find . -type d | xargs -L 1 golint
from lint.
Related Issues (20)
- Check for inconsistent receiver types HOT 1
- Receiver Name Consistency HOT 2
- Reopen issue #89 HOT 8
- Disable a block of variables HOT 2
- -set_exit_status has encouraged projects to use the linter in automation HOT 2
- zsh: command not found: golint HOT 6
- Disable specific golint checks/failure in a particular file or across files. HOT 1
- Special case "third_party" as an allowed package name with underscores by convention. HOT 1
- Warn on exported field with unexported type HOT 1
- What does min-confidence mean? HOT 1
- golint seems unable to recognise constants which are typed-iota values with the comment at the end of the line HOT 7
- go:embed gives false positives about comment format HOT 1
- Is this project dead? HOT 1
- Official docker image HOT 1
- module declares its path as: golang.org/x/lint but was required as: github.com/golang/lint HOT 1
- Lint recognizes that the ”Id“ is in the wrong format
- Proposal: blank imports of the embed package should not be lint errors HOT 3
- I can find a way to custom(disable) lint rules HOT 1
- Add a lint to check for self defined type for variables. HOT 1
- no allowance for block comments HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lint.