databricks-cli/libs/process
Denis Bilenko 8d5351c1c3
Enable errcheck everywhere and fix or silent remaining issues (#1987)
## Changes
Enable errcheck linter for the whole codebase.

Fix remaining complaints:
- If we can propagate error to caller, do that
- If we writing to stdout, continue ignoring errors (to avoid crashing
in "cli | head" case)
- Add exception for cobra non-critical API such as
MarkHidden/MarkDeprecated/RegisterFlagCompletionFunc. This keeps current
code and behaviour, to be decided later if we want to change this.
- Continue ignoring errors where that is desired behaviour (e.g.
git.loadConfig).
- Continue ignoring errors where panicking seems riskier than ignoring
the error.
- Annotate cases in libs/dyn with //nolint:errcheck - to be addressed
later.

Note, this PR is not meant to come up with the best strategy for each
case, but to be a relative safe change to enable errcheck linter.
  
## Tests
Existing tests.
2024-12-11 13:26:00 +01:00
..
background.go Added process stubbing for easier testing of launched subprocesses (#963) 2023-11-09 14:24:05 +00:00
background_test.go Use Go 1.22 to build and test (#1562) 2024-07-04 06:54:41 +00:00
forwarded.go Added process stubbing for easier testing of launched subprocesses (#963) 2023-11-09 14:24:05 +00:00
forwarded_test.go Added `process.Background()` and `process.Forwarded()` (#804) 2023-09-27 09:04:44 +00:00
opts.go Attempt to reduce test flakiness on Windows (#1845) 2024-10-24 12:03:12 +00:00
opts_test.go Added `process.Background()` and `process.Forwarded()` (#804) 2023-09-27 09:04:44 +00:00
stub.go Enable errcheck everywhere and fix or silent remaining issues (#1987) 2024-12-11 13:26:00 +01:00
stub_test.go Add error checking in tests and enable errcheck there (#1980) 2024-12-09 13:56:41 +01:00