fix: Add validation for nil inputs in various services by alexandear · Pull Request #3636 · google/go-github

@alexandear

Add nil checks to avoid nil pointer dereference and for consistency with other places:

  • if commit == nil {
    return nil, nil, errors.New("commit must be provided")
    }
  • if pull == nil {
    return nil, nil, errors.New("pull must be provided")
    }
  • if opts == nil {
    return nil, errors.New("opts should not be nil")
    }

@alexandear

@codecov

Codecov Report

Attention: Patch coverage is 82.22222% with 24 lines in your changes missing coverage. Please review.

Project coverage is 91.26%. Comparing base (6540c41) to head (f56e6b5).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
github/codespaces_secrets.go 27.27% 16 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3636      +/-   ##
==========================================
- Coverage   91.33%   91.26%   -0.08%     
==========================================
  Files         184      184              
  Lines       16174    16309     +135     
==========================================
+ Hits        14773    14884     +111     
- Misses       1227     1243      +16     
- Partials      174      182       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

gmlewis

gmlewis

Choose a reason for hiding this comment

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

Thank you, @alexandear!
LGTM.

Awaiting second LGTM+Approval from any other contributor to this repo before merging.

@stevehipwell - might you have time for a code review? Thank you!

stevehipwell

Choose a reason for hiding this comment

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

LGTM