Documentation
¶
Overview ¶
Package httpnoctx implements a Go analysis linter that flags HTTP calls that do not accept a context.Context: (*http.Client).Get, .Head, .Post, .PostForm and the package-level http.Get/Head/Post/PostForm shortcuts. It also flags http.NewRequest inside functions that already receive context.Context, and http.DefaultClient.Do which uses a timeout-less client. The fix is to build the request with http.NewRequestWithContext and use a client with a timeout so cancellation and deadline are propagated.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Analyzer = &analysis.Analyzer{ Name: "httpnoctx", Doc: "reports context-free net/http request paths: http.Client/http package helpers without context, http.NewRequest in context-aware functions, and http.DefaultClient.Do", URL: "https://github.com/github/gh-aw/tree/main/pkg/linters/httpnoctx", Requires: []*analysis.Analyzer{inspect.Analyzer}, Run: run, }
Analyzer is the http-no-ctx analysis pass.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.