From 14e409ef543723dbc805026e377fcdcd7fdcdd16 Mon Sep 17 00:00:00 2001 From: Nathan Coleman Date: Tue, 11 Jun 2024 15:17:12 -0500 Subject: [PATCH] Configure linter to forbid use of html/template (#21307) * Configure linter to forbid use of html/template We should never use html/template due to the performance penalty and the fact that we are highly unlikely to ever be generating HTML templates. * Link to PR explaining the format of forbidigo.forbid --- .golangci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 3a6f56ec99..e530ce70bd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -75,7 +75,9 @@ linters-settings: simplify: true forbidigo: # Forbid the following identifiers (list of regexp). + # Format includes custom message based on https://github.com/ashanbrown/forbidigo/pull/11 forbid: + - '\bhtml\/template\b(# Use text/template instead)?' - '\bioutil\b(# Use io and os packages instead of ioutil)?' - '\brequire\.New\b(# Use package-level functions with explicit TestingT)?' - '\bassert\.New\b(# Use package-level functions with explicit TestingT)?'