Skip to content

Commit a2c0237

Browse files
Cleanup lint
1 parent a455634 commit a2c0237

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

handlers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func (h *modifyingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
232232
if fileMatcherRx.Match([]byte(fsPath)) {
233233
hasTargetConfig = true
234234
matchingModifiers = append(matchingModifiers, targetConfig.Modifier)
235-
if targetConfig.CacheResult == false {
235+
if !targetConfig.CacheResult {
236236
shouldCache = false
237237
}
238238
}
@@ -354,7 +354,7 @@ func (h *modifyingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
354354

355355
// serveContent writes the data to the response writer, setting Content-Type.
356356
func serveContent(w http.ResponseWriter, r *http.Request, filePath string, data []byte, headers http.Header) {
357-
for headerName, _ := range w.Header().Clone() {
357+
for headerName := range w.Header().Clone() {
358358
w.Header().Del(headerName)
359359
}
360360
for headerName, headerValues := range headers {

modifiers.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,7 @@ func attrListHas(attrList []html.Attribute, key string, value string) bool {
265265
}
266266
return false
267267
}
268-
func attrListHasAny(attrList []html.Attribute, key string) bool {
269-
for _, attr := range attrList {
270-
if attr.Key == key {
271-
return true
272-
}
273-
}
274-
return false
275-
}
268+
276269
func getAttr(attrList []html.Attribute, key string) (html.Attribute, bool) {
277270
for _, attr := range attrList {
278271
if attr.Key == key {
@@ -390,7 +383,7 @@ func (csp *CSPContentNonceModifier) ModifyContent(context FileModifierContext, c
390383

391384
replacedResult := buffer.String()
392385
for _, replacement := range csp.nonceStringReplacements {
393-
replacedResult = strings.Replace(replacedResult, replacement, nonce, -1)
386+
replacedResult = strings.ReplaceAll(replacedResult, replacement, nonce)
394387
}
395388
return []byte(replacedResult), nil
396389
}

0 commit comments

Comments
 (0)