xanzy / go-gitlab

GitLab Go SDK
Apache License 2.0
2.39k stars 947 forks source link

Requires a set of APIs that support context #1944

Closed TIEDPAG closed 4 months ago

TIEDPAG commented 4 months ago

In the implementation of golang, context should be supported to be passed in to cancel the api call.

For example

// Current
project, _, err := git.Projects.CreateProject(p)
// Context API
project, _, err := git.Projects.CreateProjectContext(context.Backgroup(), p)
svanharmelen commented 4 months ago

Hi @TIEDPAG while I understand that in some cases this format makes sense, I'm not really open to changing that throughout the package.

Especially since there already is a way (through maybe a little bit less ergonomic) to make use of contexts by passing this request option: https://github.com/xanzy/go-gitlab/blob/main/request_options.go#L30

Hope you can use that approach instead...

svanharmelen commented 4 months ago

I'm going to close this issue assuming you can use the request options to achieve your goal.