lint: enable forbidigo context rules

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2024-11-19 18:21:44 -08:00
parent c0fd64f4f8
commit e7a53fb829
23 changed files with 81 additions and 63 deletions

View File

@ -7,6 +7,7 @@ import (
"net/http"
"testing"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
)
@ -25,7 +26,7 @@ func WithAccessToken(token string) GitServeOpt {
func GitServeHTTP(c *Git, t testing.TB, opts ...GitServeOpt) (url string) {
t.Helper()
gitUpdateServerInfo(c, t)
ctx, cancel := context.WithCancel(context.TODO())
ctx, cancel := context.WithCancelCause(context.TODO())
gs := &gitServe{}
for _, opt := range opts {
@ -38,7 +39,7 @@ func GitServeHTTP(c *Git, t testing.TB, opts ...GitServeOpt) (url string) {
name := "test.git"
dir, err := c.GitDir()
if err != nil {
cancel()
cancel(err)
}
var addr string
@ -84,7 +85,7 @@ func GitServeHTTP(c *Git, t testing.TB, opts ...GitServeOpt) (url string) {
<-ready
t.Cleanup(func() {
cancel()
cancel(errors.Errorf("cleanup"))
<-done
})
return fmt.Sprintf("http://%s/%s", addr, name)