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

Use Go conventions on context.Context #433

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

micahhausler
Copy link
Member

@micahhausler micahhausler commented Feb 11, 2025

Issue #, if available:

N/A

Description of changes:

Go has strong convention around passing context.Context as the first call to functions. This is called out in the context package documentation

The Context should be the first parameter, typically named ctx:

func DoSomething(ctx context.Context, arg Arg) error {
  // ... use ctx ...
}

Do not pass a nil Context, even if a function permits it. Pass context.TODO if you are unsure about which Context to use.

I intentionally did not fix auth/ and credential_provider/ misuses of context, as that will be fixed in a later PR updating the AWS Go SDK.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@micahhausler micahhausler requested a review from a team as a code owner February 11, 2025 20:54
@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 52.62%. Comparing base (e9d3aca) to head (b8204c9).

Files with missing lines Patch % Lines
provider/parameter_store_provider.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #433   +/-   ##
=======================================
  Coverage   52.62%   52.62%           
=======================================
  Files          11       11           
  Lines         952      952           
=======================================
  Hits          501      501           
  Misses        436      436           
  Partials       15       15           

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

@micahhausler micahhausler force-pushed the go-conventions-context branch from 229bb89 to 907f57b Compare February 11, 2025 23:34
@micahhausler micahhausler mentioned this pull request Feb 12, 2025
Go has strong convention around passing context.Context as the first call
to functions.

I intentionally did not fix auth/ and credential_provider/ misuses of
context, as that will be fixed in a later PR updating the AWS Go SDK.

Signed-off-by: Micah Hausler <[email protected]>
@micahhausler micahhausler force-pushed the go-conventions-context branch from 907f57b to b8204c9 Compare February 12, 2025 19:31
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.

3 participants