Skip to content

refactor: simplify headers loop by removing redundant nil check#10

Open
localnerve wants to merge 1 commit intoauthorizerdev:mainfrom
localnerve:fix-redundant-hdr-check
Open

refactor: simplify headers loop by removing redundant nil check#10
localnerve wants to merge 1 commit intoauthorizerdev:mainfrom
localnerve:fix-redundant-hdr-check

Conversation

@localnerve
Copy link
Contributor

Summary

This PR removes a redundant if headers != nil check before iterating over the headers map in ExecuteGraphQL.

Rationale

In Go, the range keyword is designed to safely handle nil maps and slices by performing zero iterations. Explicitly checking for nil before a range loop is unnecessary and deviates from idiomatic Go practices.

Changes

  • Cleaned up graphql.go by removing the outer conditional check for the headers parameter.
  • No functional change; behavior remains identical for both nil and non-nil map inputs.

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.

1 participant