Comments (9)
@HartBlanc with PR #4653, if you run only a "fast" linter like gci
only the syntax errors will be checked.
Bonus: the performance will be better.
from golangci-lint.
This sounds like a significant improvement! Thanks @ldez!
from golangci-lint.
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.
from golangci-lint.
Hello,
in v1.57.0, we introduced the flag --enable-only
.
This option overrides enable/disable/preset/fast
section from the file configuration but uses the linters-settings from the file configuration.
Then you can use golangci-lint run --enable-only=gci --fix
.
The --fast
flag is ignored when using --enable-only
.
When typecheck errors occur, most linters (107 linters on 117) cannot perform the analysis because they need type information.
I will force this behavior on all linters.
Another element, golangci-lint is made to handle packages, I recommend avoiding the usage on file because side effects can appear (e.g. typecheck)
from golangci-lint.
Hello,
If there is no interest in file-level formatting or modifying/disabling the typechecking process then I think the applicability of golangci-lint for this use case will always be a little lacking.
In my particular case, using gci directly is probably the best solution.
Thanks for considering the issue! (and the advice on the flags)
from golangci-lint.
Just a precision, typecheck is not a linter or specific golangci-lint process: https://golangci-lint.run/welcome/faq/#why-do-you-have-typecheck-errors
So it's not really because "no interest modifying/disabling the typechecking process" but because typecheck
is used to display those blocking errors in the "issue style".
The loading of the code is performed in a way that we can't skip.
I highly recommend using golangci-lint on a package instead of a file.
from golangci-lint.
Do you have a minimal reproducible example?
Because gci
, as a standalone app, has the same "problem" as golangci-lint with typecheck
errors:
$ gci print main.go
Error: main.go:15:9: expected 'IDENT', found '{' (and 1 more errors)
from golangci-lint.
For example, with the following file:
# gciexample.go
package gciexample
var a = b
Running gci
directly:
$ gci print gciexample.go
package gciexample
var a = b
Running gci via golangci-lint
:
$ golangci-lint run --fix --enable-only=gci a.go
a.go:3:9: undefined: b (typecheck)
var a = b
^
from golangci-lint.
thank you
if you use this sample:
package gciexample
func () {
}
The behavior will be different: an error will be reported by gci
.
gci detects syntax errors only, and golangci-lint detects syntax errors and type checking error.
Related to #2914
Side note: I know that the name typecheck
is not really accurate, I plan to change that at some point.
from golangci-lint.
Related Issues (20)
- Add options to include/exclude paths HOT 4
- Offline config validation HOT 2
- New errors when upgrading bumping google.golang.org/protobuf from 1.31.0 to 1.33.0 in argo workflow related code HOT 2
- Custom plugin version is not actually supported HOT 1
- linters_context generating typechecking error about malformed import path for files and folders in issues.exclude-dirs HOT 5
- staticcheck: unhandled type *ir.ArrayConst HOT 5
- --out-format no longer overrides output->format in config file HOT 2
- Hope to add detection of overflow during integer conversion HOT 1
- staticcheck has false positives HOT 2
- docs: support sorting / filtering linters table HOT 2
- typecheck: lacks support of import path with version suffix (gopkg.in/yaml.v3) HOT 6
- Could not find file '/tmp/golangci-lint-action-problem-matchers.json' HOT 21
- gochecknoinits using undocumented name init HOT 1
- plugins: support passing environment variables for the custom command HOT 4
- with directive go 1.22.3 in go.mod docker golangci-lint failed HOT 1
- Intrange: panic HOT 3
- Support go.work file HOT 5
- Warning for option that has not been set (`linters.errcheck.ignore`) HOT 7
- gosec: impact on performances (v1.58.2) 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 golangci-lint.