From 92e3b5ba78f683eb02422baa2543f489db8230b2 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Wed, 14 Jun 2017 23:05:04 -0400 Subject: [PATCH] Lint nginx code --- controllers/nginx/pkg/cmd/controller/nginx.go | 3 --- controllers/nginx/pkg/config/config.go | 4 ++-- controllers/nginx/pkg/template/template.go | 2 -- controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/controllers/nginx/pkg/cmd/controller/nginx.go b/controllers/nginx/pkg/cmd/controller/nginx.go index 8c3a5184b8..3821fd0732 100644 --- a/controllers/nginx/pkg/cmd/controller/nginx.go +++ b/controllers/nginx/pkg/cmd/controller/nginx.go @@ -165,9 +165,6 @@ type NGINXController struct { cmdArgs []string - watchClass string - namespace string - stats *statsCollector statusModule statusModule diff --git a/controllers/nginx/pkg/config/config.go b/controllers/nginx/pkg/config/config.go index 0c23d8a273..f555df7fbf 100644 --- a/controllers/nginx/pkg/config/config.go +++ b/controllers/nginx/pkg/config/config.go @@ -177,7 +177,7 @@ type Configuration struct { // Enable json escaping // http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format - LogFormatEscapeJson bool `json:"log-format-escape-json,omitempty"` + LogFormatEscapeJSON bool `json:"log-format-escape-json,omitempty"` // Customize upstream log_format // http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format @@ -315,7 +315,7 @@ func NewDefault() Configuration { KeepAlive: 75, KeepAliveRequests: 100, LargeClientHeaderBuffers: "4 8k", - LogFormatEscapeJson: false, + LogFormatEscapeJSON: false, LogFormatStream: logFormatStream, LogFormatUpstream: logFormatUpstream, MaxWorkerConnections: 16384, diff --git a/controllers/nginx/pkg/template/template.go b/controllers/nginx/pkg/template/template.go index 024f3ce9d4..1bdf0b8aa4 100644 --- a/controllers/nginx/pkg/template/template.go +++ b/controllers/nginx/pkg/template/template.go @@ -24,7 +24,6 @@ import ( "net" "os" "os/exec" - "regexp" "strings" text_template "text/template" @@ -392,7 +391,6 @@ func isLocationAllowed(input interface{}) bool { } var ( - nonAlpha = regexp.MustCompile("[^a-zA-Z0-9]+") denyPathSlugMap = map[string]string{} ) diff --git a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl index f3aebc447f..419e27f0d5 100644 --- a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl +++ b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl @@ -93,7 +93,7 @@ http { # disable warnings uninitialized_variable_warn off; - log_format upstreaminfo {{ if $cfg.LogFormatEscapeJson }}escape=json {{ end }}'{{ buildLogFormatUpstream $cfg }}'; + log_format upstreaminfo {{ if $cfg.LogFormatEscapeJSON }}escape=json {{ end }}'{{ buildLogFormatUpstream $cfg }}'; {{/* map urls that should not appear in access.log */}} {{/* http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log */}}