Comments (3)
They were intentionally omitted because they don't occur very much in
practice, and the var x = ...
form can occur at package-level, which
might matter more.
from lint.
I did some searching and found two occurrences in the Go source:
http://golang.org/src/pkg/encoding/json/decode.go#L808 -> this is the usual case where make can be removed
http://golang.org/src/pkg/regexp/exec.go#L415 -> Looks to me that this is an optimization because of the API. Every caller of Regexp.doExecute returns nil if there is no match. If there are 0 captures in a regex it can still match and it therefore needs to be not nil. It simply saves the slice header allocation for 0-capture regexes. This looks to me like the big exception.
from lint.
Ultimately this comes down to avoiding too many false positives. Golint can't deduce whether a nil slice can truly be an adequate substitute for an allocated empty slice, so lintMake only looks for constructions that relatively new Go programmers seem to commonly write. It's not intended to capture every possible situation. In my experience of reviewing millions of lines of Go code, I think we've got the balance on this approximately right.
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.