You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently cue vet is failing if something like "strings" is imported but not used with this error message:
imported and not used: "strings"
I believe this is painful in practice as you often comments part of your configuration to debug issues. It forces you to comment back and forth your import statements as well.
Could this be a simple warning instead of an error ?
The text was updated successfully, but these errors were encountered:
PierreR
changed the title
Cue vet should emit a warning instead of failing when an import is not used
Cue vet could emit a warning instead of an error when an import is not used
Jul 19, 2021
myitcv
changed the title
Cue vet could emit a warning instead of an error when an import is not used
cmd/cue: could vet emit a warning instead of an error when an import is not used?
Jul 20, 2021
@PierreR I think the right fix here is a tooling one, because we having different error modes adds (cognitive) complexity if nothing else.
FWIW, this is exactly the same behaviour as Go; likewise, unused variables are errors, just as let declarations and aliases are in CUE.
The particular problem you refer to with import statements and commented-out code, is largely addressed in Go by the use of goimports-like behaviour. This adds/removes imports as required. See https://pkg.go.dev/golang.org/x/tools/cmd/goimports for more details.
With #142 we will add similar support within CUE. Hence, taking you example, when commenting out code that required an import, if no other code requires that import it will be removed.
So this is working as intended, and given the fix is really #142 I'll close this for now.
Currently
cue vet
is failing if something like "strings" is imported but not used with this error message:I believe this is painful in practice as you often comments part of your configuration to debug issues. It forces you to comment back and forth your import statements as well.
Could this be a simple warning instead of an error ?
The text was updated successfully, but these errors were encountered: