httpnoctx

package
v0.82.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 8 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL