Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable errcheck everywhere and fix or silent remaining issues #1987

Merged
merged 30 commits into from
Dec 11, 2024

Conversation

denik
Copy link
Contributor

@denik denik commented Dec 9, 2024

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.

@denik denik temporarily deployed to test-trigger-is December 9, 2024 12:28 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 12:28 — with GitHub Actions Inactive
Base automatically changed from errcheck-tests to main December 9, 2024 12:56
@denik denik force-pushed the aider-fix-errcheck-squashed branch from 5b90bc7 to 16ae671 Compare December 9, 2024 12:58
@denik denik temporarily deployed to test-trigger-is December 9, 2024 12:58 — with GitHub Actions Inactive
@denik denik marked this pull request as ready for review December 9, 2024 12:58
@denik denik temporarily deployed to test-trigger-is December 9, 2024 12:59 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:05 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:05 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:12 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:12 — with GitHub Actions Inactive
@denik denik changed the title Enable errcheck everywhere and fix remaining issues Enable errcheck everywhere and fix or silent remaining issues Dec 9, 2024
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:22 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:22 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:24 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:24 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:30 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:30 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:33 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:33 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:41 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:41 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:45 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 9, 2024 13:46 — with GitHub Actions Inactive
cmd/root/io.go Outdated Show resolved Hide resolved
cmd/root/logger.go Outdated Show resolved Hide resolved
libs/dyn/mapping.go Outdated Show resolved Hide resolved
libs/dyn/mapping.go Outdated Show resolved Hide resolved
Copy link
Contributor

@andrewnester andrewnester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pietern can you take a look specifically at dyn library changes?

cmd/auth/describe.go Show resolved Hide resolved
cmd/root/io.go Outdated Show resolved Hide resolved
cmd/root/logger.go Outdated Show resolved Hide resolved
libs/dyn/convert/from_typed.go Outdated Show resolved Hide resolved
libs/dyn/convert/from_typed.go Outdated Show resolved Hide resolved
libs/dyn/jsonloader/json.go Outdated Show resolved Hide resolved
@denik denik temporarily deployed to test-trigger-is December 10, 2024 10:17 — with GitHub Actions Inactive
@denik denik force-pushed the aider-fix-errcheck-squashed branch from 8eadf5c to 883a1c3 Compare December 11, 2024 08:56
@denik denik temporarily deployed to test-trigger-is December 11, 2024 08:56 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is December 11, 2024 08:56 — with GitHub Actions Inactive
Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 1987
  • Commit SHA: 883a1c3b11e3155388400547f71a2d1b7d4cd3f0

Checks will be approved automatically on success.

@eng-dev-ecosystem-bot
Copy link
Collaborator

Test Details: go/deco-tests/12272889993

@denik denik merged commit 8d5351c into main Dec 11, 2024
10 of 11 checks passed
@denik denik deleted the aider-fix-errcheck-squashed branch December 11, 2024 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants