chore: Use context.Context from InvocationContext#578
chore: Use context.Context from InvocationContext#578PeterSchafer wants to merge 1 commit intomainfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This comment has been minimized.
This comment has been minimized.
dbf05e3 to
9a1e027
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
58f300c to
85d19c3
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0212397 to
54f50e9
Compare
This comment has been minimized.
This comment has been minimized.
54f50e9 to
5fc0ff8
Compare
This comment has been minimized.
This comment has been minimized.
d8b965b to
dd5cd9e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
4a70373 to
49f15ef
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
49f15ef to
f40d778
Compare
This comment has been minimized.
This comment has been minimized.
| settings, err := apiClient.GetOrgSettings(org) | ||
| settings, err := apiClient.GetOrgSettings(context.Background(), org) | ||
| if err != nil { |
f40d778 to
10b9437
Compare
PR Reviewer Guide 🔍
|
|
|
||
| func getDefaultOrganization(apiClient api.ApiClient, logger *zerolog.Logger) (Organization, error) { | ||
| defaultOrgId, err := apiClient.GetDefaultOrgId() | ||
| defaultOrgId, err := apiClient.GetDefaultOrgId(context.Background()) |
There was a problem hiding this comment.
don't like using background. better: a time-bound deadline context that is based on an app-wide context.
| return existingValue, nil | ||
| } | ||
| slugName, err := apiClient.GetSlugFromOrgId(orgId) | ||
| slugName, err := apiClient.GetSlugFromOrgId(context.Background(), orgId) |
| org := config.GetString(configuration.ORGANIZATION) | ||
| apiClient := api.NewApi(url, httpClient) | ||
| result, err := apiClient.GetFeatureFlag(featureFlagName, org) | ||
| result, err := apiClient.GetFeatureFlag(context.Background(), featureFlagName, org) |
| } | ||
|
|
||
| response, err := c.apiClient.GetOrganizations(limit) | ||
| response, err := c.apiClient.GetOrganizations(context.Background(), limit) |

Description
This PR includes a couple of refactorings to make use of the context.Context instance provided by the InvocationContext. This requires extending a couple of interfaces.
To keep the changes incremental, it doesn't yet fully use the context and needs to fallback to context.Background() where the context is not directly available yet.
Checklist
make test)make generate)make lint)go get github.com/snyk/go-application-framework@YOUR_LATEST_GAF_COMMITin thecliv2directory.go.modto point to your local GAF code.go mod tidyin thecliv2directory.go.modandgo.sumchanges.