Repository: kedacore/http-add-on
Pull request #584 (2023-01-26 00:50:56)

chore: add golangci-lint
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

Enable static checks for the code using pre-commit to manage execute all of them. Added checks are:
- golancgi-lint
- trailing-whitespace
- detect-private-key
- end-of-file-fixer
- check-merge-conflict
- mixed-line-ending

### Checklist

- [x] Commits are signed with Developer Certificate of Origin (DCO)
- [x] Any necessary documentation is added, such as:
  - [`README.md`](/README.md)
  - [The `docs/` directory](./docs)
  - [The docs repo](https://github.com/kedacore/keda-docs)

Fixes #



Patch:
diff --git a/.devcontainer/.devcontainer.json b/.devcontainer/.devcontainer.json
index 5b4901f..e552cf5 100644
--- a/.devcontainer/.devcontainer.json
+++ b/.devcontainer/.devcontainer.json
@@ -1,4 +1,4 @@
-// inspired from 
+// inspired from
 // https://github.com/microsoft/vscode-dev-containers/blob/main/containers/go/.devcontainer/devcontainer.json
 {
     "name": "Go",
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 05b5153..3073bce 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -19,7 +19,7 @@ RUN apt-get update && \
     apt-get install -y apt-transport-https ca-certificates curl && \
     sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg && \
     echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \
-    sudo apt-get update && \ 
+    sudo apt-get update && \
     sudo apt-get install -y kubectl
 
 # [Optional] Uncomment this section to install additional OS packages.
diff --git a/.github/stale.yml b/.github/stale.yml
index 979cb1a..c55e83e 100644
--- a/.github/stale.yml
+++ b/.github/stale.yml
@@ -40,4 +40,4 @@ closeComment: >
 limitPerRun: 30
 
 # Limit to only `issues` or `pulls`
-only: issues
\ No newline at end of file
+only: issues
diff --git a/.github/workflows/build_canary.yml b/.github/workflows/build_canary.yml
index d20b43e..1380bcd 100644
--- a/.github/workflows/build_canary.yml
+++ b/.github/workflows/build_canary.yml
@@ -31,4 +31,4 @@ jobs:
       - name: Publish on GitHub Container Registry
         run: make publish-multiarch
         env:
-          VERSION: canary
\ No newline at end of file
+          VERSION: canary
diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml
index 99837eb..d004f2e 100644
--- a/.github/workflows/build_release.yml
+++ b/.github/workflows/build_release.yml
@@ -35,4 +35,4 @@ jobs:
       - name: Publish on GitHub Container Registry
         run: make publish-multiarch
         env:
-          VERSION: ${{ steps.get_version.outputs.VERSION }}
\ No newline at end of file
+          VERSION: ${{ steps.get_version.outputs.VERSION }}
diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml
index dae39cb..9971d61 100644
--- a/.github/workflows/images.yaml
+++ b/.github/workflows/images.yaml
@@ -15,7 +15,7 @@ jobs:
         run: |
           COMMIT=$(git rev-parse --short HEAD)
           VERSION=${COMMIT} make docker-build-scaler
-  
+
   build_operator:
     runs-on: ubuntu-latest
     container: ghcr.io/kedacore/build-tools:1.19.5
diff --git a/.gitignore b/.gitignore
index 3abc3de..7c7c0a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -354,4 +354,4 @@ admin/target
 admin/Cargo.lock
 
 /target
-.envrc
\ No newline at end of file
+.envrc
diff --git a/.golangci.yml b/.golangci.yml
new file mode 100644
index 0000000..758d0c3
--- /dev/null
+++ b/.golangci.yml
@@ -0,0 +1,60 @@
+# options for analysis running
+run:
+  # default concurrency is a available CPU number
+  concurrency: 4
+  # timeout for analysis, e.g. 30s, 5m, default is 1m
+  timeout: 10m
+linters:
+  # please, do not use `enable-all`: it's deprecated and will be removed soon.
+  # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
+  disable-all: true
+  enable:
+    - typecheck
+    - dupl
+    - goprintffuncname
+    - govet
+    - nolintlint
+    #- rowserrcheck
+    - gofmt
+    - revive
+    - goimports
+    - misspell
+    - bodyclose
+    - unconvert
+    - ineffassign
+    - staticcheck
+    - exportloopref
+    - depguard
+    - dogsled
+    - errcheck
+    #- funlen
+    - gci
+    - goconst
+    - gocritic
+    - gocyclo
+    - gosimple
+    - stylecheck
+    - unused
+    - unparam
+    - unconvert
+    - whitespace
+
+issues:
+  include:
+  - EXC0002 # disable excluding of issues about comments from golint
+  # Excluding configuration per-path, per-linter, per-text and per-source
+  exclude-rules:
+    - path: _test\.go
+      linters:
+        - gomnd
+        - dupl
+        - unparam
+linters-settings:
+  funlen:
+    lines: 80
+    statements: 40
+  gci:
+    sections:
+      - standard
+      - default
+      - prefix(github.com/kedacore/http-add-on)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..7be7eb6
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,39 @@
+default_stages: [commit, push]
+minimum_pre_commit_version: "1.20.0"
+repos:
+  - repo: https://github.com/dnephin/pre-commit-golang
+    rev: v0.3.5
+    hooks:
+      - id: go-fmt
+        name: Run go fmt against the code
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v3.4.0
+    hooks:
+      - id: trailing-whitespace
+      - id: detect-private-key
+      - id: end-of-file-fixer
+      - id: check-merge-conflict
+      - id: mixed-line-ending
+  - repo: https://github.com/thlorenz/doctoc.git
+    rev: v2.0.0
+    hooks:
+      - id: doctoc
+        name: Add TOC for md files
+        files: ^README\.md$|^CONTRIBUTING\.md$
+        args:
+          - "--maxlevel"
+          - "3"
+  - repo: local
+    hooks:
+    - id: language-matters
+      language: pygrep
+      name: Check for language that we do not accept as community
+      description: Please use "deny_list" or "allow_list"  instead.
+      entry: "(?i)(black|white)[_-]?(list|List)"
+      pass_filenames: true
+    - id: golangci-lint
+      language: golang
+      name: Run golangci against the code
+      entry: golangci-lint run
+      types: [go]
+      pass_filenames: false
diff --git a/.whitesource b/.whitesource
index 55b922e..96443ed 100644
--- a/.whitesource
+++ b/.whitesource
@@ -9,4 +9,4 @@
   "issueSettings": {
     "minSeverityLevel": "LOW"
   }
-}
\ No newline at end of file
+}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b0d630f..a231e38 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -8,19 +8,17 @@ There are many areas we can use contributions - ranging from code, documentation
 <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
 ## Table of contents
 
-- [Contributing to KEDA](#contributing-to-keda)
-  - [Table of contents](#table-of-contents)
-  - [Project governance](#project-governance)
-  - [Including Documentation Changes](#including-documentation-changes)
-  - [Development Environment Setup](#development-environment-setup)
-  - [Locally Build & Deploy KEDA HTTP Addon](#locally-build--deploy-keda-http-addon)
-    - [Pre-requisite](#pre-requisite)
-    - [Building](#building)
-    - [Deploying](#deploying)
-    - [Load testing with k9s](#load-testing-with-k9s)
-  - [Developer Certificate of Origin: Signing your work](#developer-certificate-of-origin-signing-your-work)
-    - [Every commit needs to be signed](#every-commit-needs-to-be-signed)
-    - [I didn't sign my commit, now what?!](#i-didnt-sign-my-commit-now-what)
+- [Project governance](#project-governance)
+- [Including Documentation Changes](#including-documentation-changes)
+- [Development Environment Setup](#development-environment-setup)
+- [Locally Build & Deploy KEDA HTTP Addon](#locally-build--deploy-keda-http-addon)
+  - [Pre-requisite:](#pre-requisite)
+  - [Building:](#building)
+  - [Deploying:](#deploying)
+  - [Load testing with k9s:](#load-testing-with-k9s)
+- [Developer Certificate of Origin: Signing your work](#developer-certificate-of-origin-signing-your-work)
+  - [Every commit needs to be signed](#every-commit-needs-to-be-signed)
+  - [I didn't sign my commit, now what?!](#i-didnt-sign-my-commit-now-what)
 
 <!-- END doctoc generated TOC please keep comment here to allow auto update -->
 
diff --git a/Makefile b/Makefile
index f760796..d088717 100644
--- a/Makefile
+++ b/Makefile
@@ -44,13 +44,13 @@ e2e-test:
 	./tests/e2e-test.sh
 
 # Docker targets
-docker-build-operator: 
+docker-build-operator:
 	DOCKER_BUILDKIT=1 docker build . -t ${IMAGE_OPERATOR} -f operator/Dockerfile --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=${GIT_COMMIT}
 
-docker-build-interceptor: 
+docker-build-interceptor:
 	DOCKER_BUILDKIT=1 docker build . -t ${IMAGE_INTERCEPTOR} -f interceptor/Dockerfile --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=${GIT_COMMIT}
 
-docker-build-scaler: 
+docker-build-scaler:
 	DOCKER_BUILDKIT=1 docker build . -t ${IMAGE_SCALER} -f scaler/Dockerfile --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=${GIT_COMMIT}
 
 docker-build: docker-build-operator docker-build-interceptor docker-build-scaler
@@ -76,7 +76,7 @@ publish-multiarch: publish-operator-multiarch publish-interceptor-multiarch publ
 manifests: controller-gen ## Generate ClusterRole and CustomResourceDefinition objects for core componenets.
 	$(CONTROLLER_GEN) crd:crdVersions=v1 rbac:roleName=keda-http-add-on paths="./..." output:crd:artifacts:config=config/crd/bases
 
-verify-manifests: 
+verify-manifests:
 	./hack/verify-manifests.sh
 
 fmt: ## Run go fmt against code.
@@ -85,8 +85,8 @@ fmt: ## Run go fmt against code.
 vet: ## Run go vet against code.
 	go vet ./...
 
-golangci: ## Run golangci against code.
-	golangci-lint run
+pre-commit: ## Run static-checks.
+	pre-commit run --all-files
 
 proto-gen: protoc-gen-go ## Scaler protobuffers
 	protoc --proto_path=proto scaler.proto --go_out=proto --go-grpc_out=proto
@@ -118,4 +118,4 @@ deploy: manifests kustomize ## Deploy to the K8s cluster specified in ~/.kube/co
 	$(KUSTOMIZE) build config/default | kubectl apply -f -
 
 undeploy:
-	$(KUSTOMIZE) build config/default | kubectl delete -f -
\ No newline at end of file
+	$(KUSTOMIZE) build config/default | kubectl delete -f -
diff --git a/README.md b/README.md
index 19860d4..e4e3410 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,18 @@
+<!-- START doctoc generated TOC please keep comment here to allow auto update -->
+<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
+**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*
+
+- [HTTP Autoscaling Made Simple](#http-autoscaling-made-simple)
+- [Adopters - Become a listed KEDA user!](#adopters---become-a-listed-keda-user)
+- [Walkthrough](#walkthrough)
+- [Design](#design)
+- [Installation](#installation)
+- [Roadmap](#roadmap)
+- [Contributing](#contributing)
+- [Code of Conduct](#code-of-conduct)
+
+<!-- END doctoc generated TOC please keep comment here to allow auto update -->
+
 <p align="center"><img src="https://github.com/kedacore/keda/raw/main/images/logos/keda-word-colour.png" width="300"/></p>
 
 <p style="font-size: 25px" align="center"><b>Kubernetes-based Event Driven Autoscaling - HTTP Add-on</b></p>
@@ -47,7 +62,7 @@ customizable installations while allowing us to ship reasonable defaults.
 ## Installation
 
 Please see the [complete installation instructions](./docs/install.md).
-  
+
 ## Roadmap
 We use GitHub issues to build our backlog, a complete overview of all open items and our planning.
 
diff --git a/RELEASE-PROCESS.md b/RELEASE-PROCESS.md
index f23eacd..eb9f942 100644
--- a/RELEASE-PROCESS.md
+++ b/RELEASE-PROCESS.md
@@ -35,10 +35,10 @@ appVersion: 1.2.3
 ```yaml
 images:
   # tag is the image tag to use for all images.
-  # for example, if the operator image is "myoperator" and 
+  # for example, if the operator image is "myoperator" and
   # tag is "mytag", the operator image used will be
   # "myoperator:mytag". `latest` is used to indicate the latest
-  # stable release in the official images, `canary` is 
+  # stable release in the official images, `canary` is
   # the build for the latest commit to the `main` branch,
   # and you can target any other commit with `sha-<GIT_SHA[0:7]>`
   tag: 1.2.3
diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml
index de97b00..698b5e3 100644
--- a/config/crd/kustomization.yaml
+++ b/config/crd/kustomization.yaml
@@ -4,4 +4,4 @@
 resources:
 - bases/http.keda.sh_httpscaledobjects.yaml
 
-# +kubebuilder:scaffold:crdkustomizeresource
\ No newline at end of file
+# +kubebuilder:scaffold:crdkustomizeresource
diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml
index 8bc94d6..8f95826 100644
--- a/config/default/kustomization.yaml
+++ b/config/default/kustomization.yaml
@@ -30,4 +30,3 @@ resources:
 - ../scaler
 - ../service_account
 - ../shared
-
diff --git a/config/interceptor/interceptor.yaml b/config/interceptor/interceptor.yaml
index 367cc3d..3594a3e 100644
--- a/config/interceptor/interceptor.yaml
+++ b/config/interceptor/interceptor.yaml
@@ -31,7 +31,7 @@ spec:
         - name: interceptor
           image: ghcr.io/kedacore/http-add-on-interceptor:latest
           command:
-            - /interceptor          
+            - /interceptor
           imagePullPolicy: IfNotPresent
           resources:
             requests:
@@ -39,7 +39,7 @@ spec:
               memory: 100Mi
             limits:
               cpu: 1000m
-              memory: 1000Mi          
+              memory: 1000Mi
           ports:
           - containerPort: 9090
             name: inter-admin
diff --git a/config/interceptor/service-admin.yaml b/config/interceptor/service-admin.yaml
index f38629e..314a433 100644
--- a/config/interceptor/service-admin.yaml
+++ b/config/interceptor/service-admin.yaml
@@ -15,4 +15,4 @@ spec:
     targetPort: inter-admin
   selector:
     control-plane: interceptor
-    app: keda-http-add-on
\ No newline at end of file
+    app: keda-http-add-on
diff --git a/config/operator/operator.yaml b/config/operator/operator.yaml
index c2983c0..995107e 100644
--- a/config/operator/operator.yaml
+++ b/config/operator/operator.yaml
@@ -23,7 +23,7 @@ spec:
         control-plane: controller-manager
         app: keda-http-add-on
       name: keda-http-add-on-operator
-    spec:      
+    spec:
       serviceAccountName: keda-http-add-on
       containers:
         - name: kube-rbac-proxy
@@ -48,7 +48,7 @@ spec:
         - name: operator
           image: ghcr.io/kedacore/http-add-on-operator:latest
           command:
-            - /operator          
+            - /operator
           args:
             - --metrics-addr=127.0.0.1:8080
             - --enable-leader-election
diff --git a/config/operator/service-admin.yaml b/config/operator/service-admin.yaml
index e7b6b33..232453f 100644
--- a/config/operator/service-admin.yaml
+++ b/config/operator/service-admin.yaml
@@ -15,4 +15,4 @@ spec:
     targetPort: admin-http
   selector:
     control-plane: controller-manager
-    app: keda-http-add-on
\ No newline at end of file
+    app: keda-http-add-on
diff --git a/config/scaler/scaler.yaml b/config/scaler/scaler.yaml
index be362a1..df15861 100644
--- a/config/scaler/scaler.yaml
+++ b/config/scaler/scaler.yaml
@@ -27,11 +27,11 @@ spec:
       securityContext:
         runAsNonRoot: true
       serviceAccountName: keda-http-add-on
-      containers:        
+      containers:
         - name: external-scaler
           image: ghcr.io/kedacore/http-add-on-scaler:latest
           command:
-            - /scaler          
+            - /scaler
           imagePullPolicy: IfNotPresent
           resources:
             requests:
diff --git a/config/scaler/service.yaml b/config/scaler/service.yaml
index 690363d..324acc1 100644
--- a/config/scaler/service.yaml
+++ b/config/scaler/service.yaml
@@ -18,4 +18,4 @@ spec:
     targetPort: scaler-health
   selector:
     control-plane: external-scaler
-    app: keda-http-add-on
\ No newline at end of file
+    app: keda-http-add-on
diff --git a/docs/developing.md b/docs/developing.md
index 4e08fa6..ebfa5c9 100644
--- a/docs/developing.md
+++ b/docs/developing.md
@@ -9,6 +9,7 @@ to have the following tools installed:
 
 - [Golang](http://golang.org/) for development
 - [Docker](https://docker.com) for building the images and testing it locally
+- [Pre-commit](https://pre-commit.com/) for static checks (_optional_)
 
 ## Prerequisites
 
@@ -48,10 +49,11 @@ The Makefile located in the root directory has targets useful for the whole proj
 - `make publish-multiarch`: Build and push all Docker images for `linux/arm64` and `linux/amd64`
 - `make manifests`: Generate all the manifest files for Kubernetes, it's important to build after every change
 - `make deploy`: Deploys the HTTP Add-on to the cluster selected in `~/.kube/config` using `config` folder manifests
+- `make pre-commit`: Execute static checks
 
 ### Required Environment Variables
 
-Some of the above commands support changes in the default values: 
+Some of the above commands support changes in the default values:
 
 - `IMAGE_REGISTRY`: Image registry to be used for docker images
 - `IMAGE_REPO`: Repository to be used for docker images
diff --git a/docs/images/arch.excalidraw b/docs/images/arch.excalidraw
index 89cba58..9d36ef8 100644
--- a/docs/images/arch.excalidraw
+++ b/docs/images/arch.excalidraw
@@ -1450,4 +1450,4 @@
     "gridSize": null,
     "viewBackgroundColor": "#ffffff"
   }
-}
\ No newline at end of file
+}
diff --git a/examples/xkcd/values.yaml b/examples/xkcd/values.yaml
index 010a18a..716eb9d 100644
--- a/examples/xkcd/values.yaml
+++ b/examples/xkcd/values.yaml
@@ -2,10 +2,10 @@ replicaCount: 1
 host: myhost.com
 targetPendingRequests: 200
 # This is the namespace that the ingress should be installed
-# into. It should be set to the same namespace as the 
+# into. It should be set to the same namespace as the
 # KEDA HTTP componentry is installed in. Defaults to the Helm
 # chart release namespace
-ingressNamespace: 
+ingressNamespace:
 image:
   repository: arschles/xkcd
   pullPolicy: Always
@@ -46,4 +46,3 @@ autoscaling:
   http:
     minReplicas: 0
     maxReplicas: 10
-
diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt
index 767efde..c38248e 100644
--- a/hack/boilerplate.go.txt
+++ b/hack/boilerplate.go.txt
@@ -12,4 +12,4 @@ distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-*/
\ No newline at end of file
+*/
diff --git a/interceptor/config/validate.go b/interceptor/config/validate.go
index 9093eac..c819ae9 100644
--- a/interceptor/config/validate.go
+++ b/interceptor/config/validate.go
@@ -13,7 +13,6 @@ func Validate(srvCfg Serving, timeoutsCfg Timeouts) error {
 			timeoutsCfg.DeploymentReplicas,
 			deplCachePollInterval,
 		)
-
 	}
 	return nil
 }
diff --git a/interceptor/forward_wait_func.go b/interceptor/forward_wait_func.go
index 4746e7d..749970d 100644
--- a/interceptor/forward_wait_func.go
+++ b/interceptor/forward_wait_func.go
@@ -5,8 +5,9 @@ import (
 	"fmt"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/k8s"
 	appsv1 "k8s.io/api/apps/v1"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
 )
 
 // forwardWaitFunc is a function that waits for a condition
diff --git a/interceptor/main.go b/interceptor/main.go
index d1bca23..6cd3b4c 100644
--- a/interceptor/main.go
+++ b/interceptor/main.go
@@ -10,6 +10,10 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
+	"golang.org/x/sync/errgroup"
+	"k8s.io/client-go/kubernetes"
+	"k8s.io/client-go/rest"
+
 	"github.com/kedacore/http-add-on/interceptor/config"
 	"github.com/kedacore/http-add-on/pkg/build"
 	kedahttp "github.com/kedacore/http-add-on/pkg/http"
@@ -18,9 +22,6 @@ import (
 	kedanet "github.com/kedacore/http-add-on/pkg/net"
 	"github.com/kedacore/http-add-on/pkg/queue"
 	"github.com/kedacore/http-add-on/pkg/routing"
-	"golang.org/x/sync/errgroup"
-	"k8s.io/client-go/kubernetes"
-	"k8s.io/client-go/rest"
 )
 
 func init() {
diff --git a/interceptor/middleware.go b/interceptor/middleware.go
index 9eecb23..8a0ef24 100644
--- a/interceptor/middleware.go
+++ b/interceptor/middleware.go
@@ -3,13 +3,14 @@ package main
 import (
 	"fmt"
 	"log"
-	nethttp "net/http"
+	"net/http"
 
 	"github.com/go-logr/logr"
+
 	"github.com/kedacore/http-add-on/pkg/queue"
 )
 
-func getHost(r *nethttp.Request) (string, error) {
+func getHost(r *http.Request) (string, error) {
 	// check the host header first, then the request host
 	// field (which may contain the actual URL if there is no
 	// host header)
@@ -27,14 +28,16 @@ func getHost(r *nethttp.Request) (string, error) {
 func countMiddleware(
 	lggr logr.Logger,
 	q queue.Counter,
-	next nethttp.Handler,
-) nethttp.Handler {
-	return nethttp.HandlerFunc(func(w nethttp.ResponseWriter, r *nethttp.Request) {
+	next http.Handler,
+) http.Handler {
+	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		host, err := getHost(r)
 		if err != nil {
 			lggr.Error(err, "not forwarding request")
 			w.WriteHeader(400)
-			w.Write([]byte("Host not found, not forwarding request"))
+			if _, err := w.Write([]byte("Host not found, not forwarding request")); err != nil {
+				lggr.Error(err, "could not write error message to client")
+			}
 			return
 		}
 		if err := q.Resize(host, +1); err != nil {
diff --git a/interceptor/proxy_handlers.go b/interceptor/proxy_handlers.go
index 1d38600..ac94c9e 100644
--- a/interceptor/proxy_handlers.go
+++ b/interceptor/proxy_handlers.go
@@ -7,6 +7,7 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
+
 	"github.com/kedacore/http-add-on/interceptor/config"
 	kedanet "github.com/kedacore/http-add-on/pkg/net"
 	"github.com/kedacore/http-add-on/pkg/routing"
@@ -62,13 +63,17 @@ func newForwardingHandler(
 		host, err := getHost(r)
 		if err != nil {
 			w.WriteHeader(400)
-			w.Write([]byte("Host not found in request"))
+			if _, err := w.Write([]byte("Host not found in request")); err != nil {
+				lggr.Error(err, "could not write error response to client")
+			}
 			return
 		}
 		routingTarget, err := routingTable.Lookup(host)
 		if err != nil {
 			w.WriteHeader(404)
-			w.Write([]byte(fmt.Sprintf("Host %s not found", r.Host)))
+			if _, err := w.Write([]byte(fmt.Sprintf("Host %s not found", r.Host))); err != nil {
+				lggr.Error(err, "could not send error message to client")
+			}
 			return
 		}
 
@@ -82,14 +87,18 @@ func newForwardingHandler(
 		if err != nil {
 			lggr.Error(err, "wait function failed, not forwarding request")
 			w.WriteHeader(502)
-			w.Write([]byte(fmt.Sprintf("error on backend (%s)", err)))
+			if _, err := w.Write([]byte(fmt.Sprintf("error on backend (%s)", err))); err != nil {
+				lggr.Error(err, "could not write error response to client")
+			}
 			return
 		}
 		targetSvcURL, err := targetSvcURL(routingTarget)
 		if err != nil {
 			lggr.Error(err, "forwarding failed")
 			w.WriteHeader(500)
-			w.Write([]byte("error getting backend service URL"))
+			if _, err := w.Write([]byte("error getting backend service URL")); err != nil {
+				lggr.Error(err, "could not write error response to client")
+			}
 			return
 		}
 		isColdStart := "false"
@@ -97,6 +106,6 @@ func newForwardingHandler(
 			isColdStart = "true"
 		}
 		w.Header().Add("X-KEDA-HTTP-Cold-Start", isColdStart)
-		forwardRequest(w, r, roundTripper, targetSvcURL)
+		forwardRequest(lggr, w, r, roundTripper, targetSvcURL)
 	})
 }
diff --git a/interceptor/request_forwarder.go b/interceptor/request_forwarder.go
index 1ceef2f..3a4afae 100644
--- a/interceptor/request_forwarder.go
+++ b/interceptor/request_forwarder.go
@@ -5,9 +5,12 @@ import (
 	"net/http"
 	"net/http/httputil"
 	"net/url"
+
+	"github.com/go-logr/logr"
 )
 
 func forwardRequest(
+	lggr logr.Logger,
 	w http.ResponseWriter,
 	r *http.Request,
 	roundTripper http.RoundTripper,
@@ -30,7 +33,12 @@ func forwardRequest(
 		// not Sprintf or anything similar. this means we have to create the
 		// failure string in this slightly convoluted way.
 		errMsg := fmt.Errorf("error on backend (%w)", err).Error()
-		w.Write([]byte(errMsg))
+		if _, err := w.Write([]byte(errMsg)); err != nil {
+			lggr.Error(
+				err,
+				"could not write error response to client",
+			)
+		}
 	}
 
 	proxy.ServeHTTP(w, r)
diff --git a/operator/api/v1alpha1/httpscaledobject_types.go b/operator/api/v1alpha1/httpscaledobject_types.go
index 4d8a0ae..7c3aa45 100644
--- a/operator/api/v1alpha1/httpscaledobject_types.go
+++ b/operator/api/v1alpha1/httpscaledobject_types.go
@@ -96,13 +96,13 @@ type HTTPScaledObjectSpec struct {
 	// or Image must be set
 	ScaleTargetRef *ScaleTargetRef `json:"scaleTargetRef"`
 	// (optional) Replica information
-	//+optional
+	// +optional
 	Replicas ReplicaStruct `json:"replicas,omitempty"`
-	//(optional) Target metric value
-	//+optional
+	// (optional) Target metric value
+	// +optional
 	TargetPendingRequests int32 `json:"targetPendingRequests,omitempty" description:"The target metric value for the HPA (Default 100)"`
-	//(optional) Cooldown period value
-	//+optional
+	// (optional) Cooldown period value
+	// +optional
 	CooldownPeriod int32 `json:"scaledownPeriod,omitempty" description:"Cooldown period (seconds) for resources to scale down(Default x)"`
 }
 
diff --git a/operator/controllers/app.go b/operator/controllers/app.go
index 0fead35..fd7bd67 100644
--- a/operator/controllers/app.go
+++ b/operator/controllers/app.go
@@ -4,14 +4,15 @@ import (
 	"context"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/operator/api/v1alpha1"
-	"github.com/kedacore/http-add-on/operator/controllers/config"
-	"github.com/kedacore/http-add-on/pkg/routing"
 	apierrs "k8s.io/apimachinery/pkg/api/errors"
 	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
 	"k8s.io/apimachinery/pkg/runtime/schema"
 	"sigs.k8s.io/controller-runtime/pkg/client"
+
+	"github.com/kedacore/http-add-on/operator/api/v1alpha1"
+	"github.com/kedacore/http-add-on/operator/controllers/config"
+	"github.com/kedacore/http-add-on/pkg/routing"
 )
 
 // +kubebuilder:rbac:groups="",namespace=keda,resources=configmaps,verbs="*"
@@ -24,7 +25,6 @@ func removeApplicationResources(
 	baseConfig config.Base,
 	httpso *v1alpha1.HTTPScaledObject,
 ) error {
-
 	defer httpso.SaveStatus(context.Background(), logger, cl)
 	// Set initial statuses
 	httpso.AddCondition(*v1alpha1.CreateCondition(
diff --git a/operator/controllers/config/config.go b/operator/controllers/config/config.go
index 1b0564e..2eac129 100644
--- a/operator/controllers/config/config.go
+++ b/operator/controllers/config/config.go
@@ -4,8 +4,9 @@ import (
 	"fmt"
 	"strconv"
 
-	"github.com/kedacore/http-add-on/pkg/env"
 	"github.com/kelseyhightower/envconfig"
+
+	"github.com/kedacore/http-add-on/pkg/env"
 )
 
 // Interceptor holds static configuration info for the interceptor
diff --git a/operator/controllers/finalizer.go b/operator/controllers/finalizer.go
index ef16fa5..ec5679f 100644
--- a/operator/controllers/finalizer.go
+++ b/operator/controllers/finalizer.go
@@ -4,8 +4,9 @@ import (
 	"context"
 
 	"github.com/go-logr/logr"
-	httpv1alpha1 "github.com/kedacore/http-add-on/operator/api/v1alpha1"
 	"sigs.k8s.io/controller-runtime/pkg/client"
+
+	httpv1alpha1 "github.com/kedacore/http-add-on/operator/api/v1alpha1"
 )
 
 const (
@@ -44,7 +45,6 @@ func finalizeScaledObject(
 	client client.Client,
 	httpso *httpv1alpha1.HTTPScaledObject) error {
 	if contains(httpso.GetFinalizers(), httpScaledObjectFinalizer) {
-
 		httpso.SetFinalizers(remove(httpso.GetFinalizers(), httpScaledObjectFinalizer))
 		if err := client.Update(ctx, httpso); err != nil {
 			logger.Error(
diff --git a/operator/controllers/ping.go b/operator/controllers/ping.go
index ee7285d..a5487bb 100644
--- a/operator/controllers/ping.go
+++ b/operator/controllers/ping.go
@@ -5,10 +5,11 @@ import (
 	"fmt"
 	"net/http"
 
-	"github.com/kedacore/http-add-on/pkg/k8s"
 	"github.com/pkg/errors"
 	"golang.org/x/sync/errgroup"
 	"sigs.k8s.io/controller-runtime/pkg/client"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
 )
 
 func pingInterceptors(
@@ -34,8 +35,12 @@ func pingInterceptors(
 		endpointStr := endpointURL.String()
 		errGrp.Go(func() error {
 			fullAddr := fmt.Sprintf("%s/routing_ping", endpointStr)
-			_, err := httpCl.Get(fullAddr)
-			return err
+			resp, err := httpCl.Get(fullAddr)
+			if err != nil {
+				return err
+			}
+			resp.Body.Close()
+			return nil
 		})
 	}
 	return errGrp.Wait()
diff --git a/operator/controllers/routing_table.go b/operator/controllers/routing_table.go
index 8ca2629..6d3e6a4 100644
--- a/operator/controllers/routing_table.go
+++ b/operator/controllers/routing_table.go
@@ -4,10 +4,11 @@ import (
 	"context"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/k8s"
-	"github.com/kedacore/http-add-on/pkg/routing"
 	pkgerrs "github.com/pkg/errors"
 	"sigs.k8s.io/controller-runtime/pkg/client"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
+	"github.com/kedacore/http-add-on/pkg/routing"
 )
 
 func removeAndUpdateRoutingTable(
diff --git a/operator/controllers/scaled_object.go b/operator/controllers/scaled_object.go
index e8ed9a5..b3eb825 100644
--- a/operator/controllers/scaled_object.go
+++ b/operator/controllers/scaled_object.go
@@ -5,11 +5,12 @@ import (
 	"fmt"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/operator/api/v1alpha1"
-	"github.com/kedacore/http-add-on/pkg/k8s"
 	"k8s.io/apimachinery/pkg/api/errors"
 	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"sigs.k8s.io/controller-runtime/pkg/client"
+
+	"github.com/kedacore/http-add-on/operator/api/v1alpha1"
+	"github.com/kedacore/http-add-on/pkg/k8s"
 )
 
 // createOrUpdateScaledObject attempts to create a new ScaledObject
@@ -23,7 +24,6 @@ func createOrUpdateScaledObject(
 	externalScalerHostName string,
 	httpso *v1alpha1.HTTPScaledObject,
 ) error {
-
 	logger.Info("Creating scaled objects", "external scaler host name", externalScalerHostName)
 
 	appScaledObject, appErr := k8s.NewScaledObject(
diff --git a/operator/main.go b/operator/main.go
index 6fbbaf2..e821421 100644
--- a/operator/main.go
+++ b/operator/main.go
@@ -23,6 +23,7 @@ import (
 	"net/http"
 	"os"
 
+	"github.com/go-logr/logr"
 	"golang.org/x/sync/errgroup"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
@@ -31,7 +32,6 @@ import (
 	ctrl "sigs.k8s.io/controller-runtime"
 	"sigs.k8s.io/controller-runtime/pkg/log/zap"
 
-	"github.com/go-logr/logr"
 	httpv1alpha1 "github.com/kedacore/http-add-on/operator/api/v1alpha1"
 	"github.com/kedacore/http-add-on/operator/controllers"
 	"github.com/kedacore/http-add-on/operator/controllers/config"
diff --git a/pkg/env/env.go b/pkg/env/env.go
index b0306f3..9848e4c 100644
--- a/pkg/env/env.go
+++ b/pkg/env/env.go
@@ -21,7 +21,7 @@ func GetOr(envName, otherwise string) string {
 func Get(envName string) (string, error) {
 	fromEnv := os.Getenv(envName)
 	if fromEnv == "" {
-		return "", fmt.Errorf("Environnment variable %s not found", envName)
+		return "", fmt.Errorf("environnment variable %s not found", envName)
 	}
 	return fromEnv, nil
 }
diff --git a/pkg/http/config_endpoint.go b/pkg/http/config_endpoint.go
index 2423a3d..d574da2 100644
--- a/pkg/http/config_endpoint.go
+++ b/pkg/http/config_endpoint.go
@@ -5,6 +5,7 @@ import (
 	"net/http"
 
 	"github.com/go-logr/logr"
+
 	"github.com/kedacore/http-add-on/pkg/build"
 )
 
@@ -15,7 +16,8 @@ func AddConfigEndpoint(lggr logr.Logger, mux *http.ServeMux, configs ...interfac
 		}); err != nil {
 			lggr.Error(err, "failed to encode configs")
 			w.WriteHeader(http.StatusInternalServerError)
-			w.Write([]byte(err.Error()))
+			_, err := w.Write([]byte(err.Error()))
+			lggr.Error(err, "failed sending encode version error")
 		}
 	})
 }
@@ -27,7 +29,8 @@ func AddVersionEndpoint(lggr logr.Logger, mux *http.ServeMux) {
 		}); err != nil {
 			lggr.Error(err, "failed to encode version")
 			w.WriteHeader(http.StatusInternalServerError)
-			w.Write([]byte(err.Error()))
+			_, err := w.Write([]byte(err.Error()))
+			lggr.Error(err, "failed sending encode version error")
 		}
 	})
 }
diff --git a/pkg/http/server.go b/pkg/http/server.go
index 07c2110..de1beff 100644
--- a/pkg/http/server.go
+++ b/pkg/http/server.go
@@ -2,6 +2,7 @@ package http
 
 import (
 	"context"
+	"fmt"
 	"net/http"
 )
 
@@ -13,7 +14,9 @@ func ServeContext(ctx context.Context, addr string, hdl http.Handler) error {
 
 	go func() {
 		<-ctx.Done()
-		srv.Shutdown(ctx)
+		if err := srv.Shutdown(ctx); err != nil {
+			fmt.Println("failed shutting down server:", err)
+		}
 	}()
 	return srv.ListenAndServe()
 }
diff --git a/pkg/k8s/config_map.go b/pkg/k8s/config_map.go
index abd32d0..9335f43 100644
--- a/pkg/k8s/config_map.go
+++ b/pkg/k8s/config_map.go
@@ -70,7 +70,6 @@ func GetConfigMap(
 	namespace string,
 	name string,
 ) (*corev1.ConfigMap, error) {
-
 	configMap := &corev1.ConfigMap{}
 	err := cl.Get(ctx, client.ObjectKey{Name: name, Namespace: namespace}, configMap)
 	if err != nil {
diff --git a/pkg/k8s/config_map_cache_informer.go b/pkg/k8s/config_map_cache_informer.go
index 94036cf..b1ccc64 100644
--- a/pkg/k8s/config_map_cache_informer.go
+++ b/pkg/k8s/config_map_cache_informer.go
@@ -85,7 +85,10 @@ func (i *InformerConfigMapUpdater) addEvtHandler(obj interface{}) {
 		)
 		return
 	}
-	i.bcaster.Action(watch.Added, cm)
+
+	if err := i.bcaster.Action(watch.Added, cm); err != nil {
+		i.lggr.Error(err, "informer expected configMap")
+	}
 }
 
 func (i *InformerConfigMapUpdater) updateEvtHandler(oldObj, newObj interface{}) {
@@ -97,7 +100,10 @@ func (i *InformerConfigMapUpdater) updateEvtHandler(oldObj, newObj interface{})
 		)
 		return
 	}
-	i.bcaster.Action(watch.Modified, cm)
+
+	if err := i.bcaster.Action(watch.Modified, cm); err != nil {
+		i.lggr.Error(err, "informer expected configMap")
+	}
 }
 
 func (i *InformerConfigMapUpdater) deleteEvtHandler(obj interface{}) {
@@ -109,7 +115,10 @@ func (i *InformerConfigMapUpdater) deleteEvtHandler(obj interface{}) {
 		)
 		return
 	}
-	i.bcaster.Action(watch.Deleted, cm)
+
+	if err := i.bcaster.Action(watch.Deleted, cm); err != nil {
+		i.lggr.Error(err, "informer expected configMap")
+	}
 }
 
 func NewInformerConfigMapUpdater(
@@ -127,10 +136,13 @@ func NewInformerConfigMapUpdater(
 		bcaster:    watch.NewBroadcaster(0, watch.WaitIfChannelFull),
 		cmInformer: cmInformer,
 	}
-	ret.cmInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
+	_, err := ret.cmInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
 		AddFunc:    ret.addEvtHandler,
 		UpdateFunc: ret.updateEvtHandler,
 		DeleteFunc: ret.deleteEvtHandler,
 	})
+	if err != nil {
+		lggr.Error(err, "error creating config informer")
+	}
 	return ret
 }
diff --git a/pkg/k8s/deployment_cache_informer.go b/pkg/k8s/deployment_cache_informer.go
index 8e60556..38ee17b 100644
--- a/pkg/k8s/deployment_cache_informer.go
+++ b/pkg/k8s/deployment_cache_informer.go
@@ -76,7 +76,10 @@ func (i *InformerBackedDeploymentCache) addEvtHandler(obj interface{}) {
 		)
 		return
 	}
-	i.bcaster.Action(watch.Added, depl)
+
+	if err := i.bcaster.Action(watch.Added, depl); err != nil {
+		i.lggr.Error(err, "informer expected deployment")
+	}
 }
 
 func (i *InformerBackedDeploymentCache) updateEvtHandler(oldObj, newObj interface{}) {
@@ -88,7 +91,10 @@ func (i *InformerBackedDeploymentCache) updateEvtHandler(oldObj, newObj interfac
 		)
 		return
 	}
-	i.bcaster.Action(watch.Modified, depl)
+
+	if err := i.bcaster.Action(watch.Modified, depl); err != nil {
+		i.lggr.Error(err, "informer expected deployment")
+	}
 }
 
 func (i *InformerBackedDeploymentCache) deleteEvtHandler(obj interface{}) {
@@ -100,7 +106,10 @@ func (i *InformerBackedDeploymentCache) deleteEvtHandler(obj interface{}) {
 		)
 		return
 	}
-	i.bcaster.Action(watch.Deleted, depl)
+
+	if err := i.bcaster.Action(watch.Deleted, depl); err != nil {
+		i.lggr.Error(err, "informer expected deployment")
+	}
 }
 
 func NewInformerBackedDeploymentCache(
@@ -118,10 +127,13 @@ func NewInformerBackedDeploymentCache(
 		bcaster:      watch.NewBroadcaster(0, watch.WaitIfChannelFull),
 		deplInformer: deplInformer,
 	}
-	ret.deplInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
+	_, err := ret.deplInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
 		AddFunc:    ret.addEvtHandler,
 		UpdateFunc: ret.updateEvtHandler,
 		DeleteFunc: ret.deleteEvtHandler,
 	})
+	if err != nil {
+		lggr.Error(err, "error creating backend informer")
+	}
 	return ret
 }
diff --git a/pkg/net/backoff.go b/pkg/net/backoff.go
index 5082b3b..5909719 100644
--- a/pkg/net/backoff.go
+++ b/pkg/net/backoff.go
@@ -13,7 +13,7 @@ func MinTotalBackoffDuration(backoff wait.Backoff) time.Duration {
 	retMS := backoff.Duration.Milliseconds()
 	numSteps := backoff.Steps
 	for i := 2; i <= numSteps; i++ {
-		retMS += int64(initial) * int64(i)
+		retMS += initial * int64(i)
 	}
 	return time.Duration(retMS) * time.Millisecond
 }
diff --git a/pkg/net/dial_context.go b/pkg/net/dial_context.go
index c92fef0..519dd63 100644
--- a/pkg/net/dial_context.go
+++ b/pkg/net/dial_context.go
@@ -4,7 +4,6 @@ import (
 	"context"
 	"fmt"
 	"net"
-	stdnet "net"
 	"time"
 
 	"k8s.io/apimachinery/pkg/util/wait"
@@ -12,7 +11,7 @@ import (
 
 // DialContextFunc is a function that matches the (net).Dialer.DialContext functions's
 // signature
-type DialContextFunc func(ctx context.Context, network, addr string) (stdnet.Conn, error)
+type DialContextFunc func(ctx context.Context, network, addr string) (net.Conn, error)
 
 // DialContextWithRetry creates a new DialContextFunc --
 // which has the same signature as the net.Conn.DialContext function --
@@ -29,7 +28,7 @@ type DialContextFunc func(ctx context.Context, network, addr string) (stdnet.Con
 // https://github.com/knative/serving/blob/20815258c92d0f26100031c71a91d0bef930a475/vendor/knative.dev/pkg/network/transports.go#L70
 func DialContextWithRetry(coreDialer *net.Dialer, backoff wait.Backoff) DialContextFunc {
 	numDialTries := backoff.Steps
-	return func(ctx context.Context, network, addr string) (stdnet.Conn, error) {
+	return func(ctx context.Context, network, addr string) (net.Conn, error) {
 		// note that we could test for backoff.Steps >= 0 here, but every call to backoff.Step()
 		// (below) decrements the backoff.Steps value. If you accidentally call that function
 		// more than once inside the loop, you will reduce the number of times the loop
@@ -58,7 +57,7 @@ func DialContextWithRetry(coreDialer *net.Dialer, backoff wait.Backoff) DialCont
 
 // NewNetDialer creates a new (net).Dialer with the given connection timeout and
 // keep alive duration.
-func NewNetDialer(connectTimeout, keepAlive time.Duration) *stdnet.Dialer {
+func NewNetDialer(connectTimeout, keepAlive time.Duration) *net.Dialer {
 	return &net.Dialer{
 		Timeout:   connectTimeout,
 		KeepAlive: keepAlive,
diff --git a/pkg/queue/queue_rpc.go b/pkg/queue/queue_rpc.go
index 318692c..542ebbd 100644
--- a/pkg/queue/queue_rpc.go
+++ b/pkg/queue/queue_rpc.go
@@ -5,7 +5,6 @@ import (
 	"encoding/json"
 	"fmt"
 	"net/http"
-	nethttp "net/http"
 	"net/url"
 
 	"github.com/go-logr/logr"
@@ -14,7 +13,7 @@ import (
 
 const countsPath = "/queue"
 
-func AddCountsRoute(lggr logr.Logger, mux *nethttp.ServeMux, q CountReader) {
+func AddCountsRoute(lggr logr.Logger, mux *http.ServeMux, q CountReader) {
 	lggr = lggr.WithName("pkg.queue.AddCountsRoute")
 	lggr.Info("adding queue counts route", "path", countsPath)
 	mux.Handle(countsPath, newSizeHandler(lggr, q))
@@ -26,24 +25,33 @@ func AddCountsRoute(lggr logr.Logger, mux *nethttp.ServeMux, q CountReader) {
 func newSizeHandler(
 	lggr logr.Logger,
 	q CountReader,
-) nethttp.Handler {
-	return http.HandlerFunc(func(w nethttp.ResponseWriter, r *nethttp.Request) {
-
+) http.Handler {
+	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		cur, err := q.Current()
 		if err != nil {
 			lggr.Error(err, "getting queue size")
 			w.WriteHeader(500)
-			w.Write([]byte(
+			if _, err := w.Write([]byte(
 				"error getting queue size",
-			))
+			)); err != nil {
+				lggr.Error(
+					err,
+					"could not send error message to client",
+				)
+			}
 			return
 		}
 		if err := json.NewEncoder(w).Encode(cur); err != nil {
 			lggr.Error(err, "encoding QueueCounts")
 			w.WriteHeader(500)
-			w.Write([]byte(
+			if _, err := w.Write([]byte(
 				"error encoding queue counts",
-			))
+			)); err != nil {
+				lggr.Error(
+					err,
+					"could not send error message to client",
+				)
+			}
 			return
 		}
 	})
@@ -55,7 +63,7 @@ func newSizeHandler(
 func GetCounts(
 	ctx context.Context,
 	lggr logr.Logger,
-	httpCl *nethttp.Client,
+	httpCl *http.Client,
 	interceptorURL url.URL,
 ) (*Counts, error) {
 	interceptorURL.Path = countsPath
diff --git a/pkg/routing/config_map.go b/pkg/routing/config_map.go
index ee47f6c..6f3ce40 100644
--- a/pkg/routing/config_map.go
+++ b/pkg/routing/config_map.go
@@ -5,11 +5,12 @@ import (
 	"fmt"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/k8s"
-	"github.com/kedacore/http-add-on/pkg/queue"
 	"github.com/pkg/errors"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
+	"github.com/kedacore/http-add-on/pkg/queue"
 )
 
 const (
diff --git a/pkg/routing/config_map_updater.go b/pkg/routing/config_map_updater.go
index ab21252..50a5ac6 100644
--- a/pkg/routing/config_map_updater.go
+++ b/pkg/routing/config_map_updater.go
@@ -4,10 +4,11 @@ import (
 	"context"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/k8s"
 	"github.com/pkg/errors"
 	"golang.org/x/sync/errgroup"
 	corev1 "k8s.io/api/core/v1"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
 )
 
 // StartConfigMapRoutingTableUpdater starts a loop that does the following:
diff --git a/pkg/routing/table_rpc.go b/pkg/routing/table_rpc.go
index 8fcd141..4afb0c3 100644
--- a/pkg/routing/table_rpc.go
+++ b/pkg/routing/table_rpc.go
@@ -5,6 +5,7 @@ import (
 	"net/http"
 
 	"github.com/go-logr/logr"
+
 	"github.com/kedacore/http-add-on/pkg/k8s"
 	"github.com/kedacore/http-add-on/pkg/queue"
 )
@@ -50,9 +51,14 @@ func AddPingRoute(
 		if err != nil {
 			lggr.Error(err, "fetching new routing table")
 			w.WriteHeader(500)
-			w.Write([]byte(
+			if _, err := w.Write([]byte(
 				"error fetching routing table",
-			))
+			)); err != nil {
+				lggr.Error(
+					err,
+					"could not write error response to client",
+				)
+			}
 			return
 		}
 		w.WriteHeader(200)
@@ -74,9 +80,14 @@ func newTableHandler(
 		if err != nil {
 			w.WriteHeader(500)
 			lggr.Error(err, "encoding logging table JSON")
-			w.Write([]byte(
+			if _, err := w.Write([]byte(
 				"error encoding and transmitting the routing table",
-			))
+			)); err != nil {
+				lggr.Error(
+					err,
+					"could not send error message to client",
+				)
+			}
 		}
 	})
 }
diff --git a/scaler/handlers.go b/scaler/handlers.go
index 58b9e4b..f616fc2 100644
--- a/scaler/handlers.go
+++ b/scaler/handlers.go
@@ -11,15 +11,20 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
+	"google.golang.org/protobuf/types/known/emptypb"
+
 	"github.com/kedacore/http-add-on/pkg/routing"
 	externalscaler "github.com/kedacore/http-add-on/proto"
-	"google.golang.org/protobuf/types/known/emptypb"
 )
 
 func init() {
 	rand.Seed(time.Now().UnixNano())
 }
 
+const (
+	interceptor = "interceptor"
+)
+
 type impl struct {
 	lggr                    logr.Logger
 	pinger                  *queuePinger
@@ -60,7 +65,7 @@ func (e *impl) IsActive(
 		lggr.Error(err, "returning immediately from IsActive RPC call", "ScaledObject", scaledObject)
 		return nil, err
 	}
-	if host == "interceptor" {
+	if host == interceptor {
 		return &externalscaler.IsActiveResponse{
 			Result: true,
 		}, nil
@@ -107,9 +112,16 @@ func (e *impl) StreamIsActive(
 				)
 				return err
 			}
-			server.Send(&externalscaler.IsActiveResponse{
+			err = server.Send(&externalscaler.IsActiveResponse{
 				Result: active.Result,
 			})
+			if err != nil {
+				e.lggr.Error(
+					err,
+					"error sending the active result in stream",
+				)
+				return err
+			}
 		}
 	}
 }
@@ -126,7 +138,7 @@ func (e *impl) GetMetricSpec(
 		return nil, err
 	}
 	var targetPendingRequests int64
-	if host == "interceptor" {
+	if host == interceptor {
 		targetPendingRequests = e.targetMetricInterceptor
 	} else {
 		target, err := e.routingTable.Lookup(host)
@@ -171,7 +183,7 @@ func (e *impl) GetMetrics(
 		e.routingTable,
 	)
 	if !ok {
-		if host == "interceptor" {
+		if host == interceptor {
 			hostCount = e.pinger.aggregate()
 		} else {
 			err := fmt.Errorf("host '%s' not found in counts", host)
diff --git a/scaler/main.go b/scaler/main.go
index 3ed8353..49f997e 100644
--- a/scaler/main.go
+++ b/scaler/main.go
@@ -15,15 +15,16 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
+	"golang.org/x/sync/errgroup"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/reflection"
+
 	"github.com/kedacore/http-add-on/pkg/build"
 	kedahttp "github.com/kedacore/http-add-on/pkg/http"
 	"github.com/kedacore/http-add-on/pkg/k8s"
 	pkglog "github.com/kedacore/http-add-on/pkg/log"
 	"github.com/kedacore/http-add-on/pkg/routing"
 	externalscaler "github.com/kedacore/http-add-on/proto"
-	"golang.org/x/sync/errgroup"
-	"google.golang.org/grpc"
-	"google.golang.org/grpc/reflection"
 )
 
 func main() {
@@ -34,7 +35,7 @@ func main() {
 	ctx, done := context.WithCancel(
 		context.Background(),
 	)
-	defer done()
+
 	cfg := mustParseConfig()
 	grpcPort := cfg.GRPCPort
 	healthPort := cfg.HealthPort
@@ -48,6 +49,7 @@ func main() {
 	k8sCl, _, err := k8s.NewClientset()
 	if err != nil {
 		lggr.Error(err, "getting a Kubernetes client")
+		done()
 		os.Exit(1)
 	}
 	pinger, err := newQueuePinger(
@@ -61,8 +63,10 @@ func main() {
 	)
 	if err != nil {
 		lggr.Error(err, "creating a queue pinger")
+		done()
 		os.Exit(1)
 	}
+	defer done()
 
 	// This callback function is used to fetch and save
 	// the current queue counts from the interceptor immediately
@@ -141,7 +145,6 @@ func main() {
 			cfg,
 			healthPort,
 			pinger,
-			table,
 		)
 	})
 	build.PrintComponentInfo(lggr, "Scaler")
@@ -157,7 +160,6 @@ func startGrpcServer(
 	targetPendingRequests int64,
 	targetPendingRequestsInterceptor int64,
 ) error {
-
 	addr := fmt.Sprintf("0.0.0.0:%d", port)
 	lggr.Info("starting grpc server", "address", addr)
 	lis, err := net.Listen("tcp", addr)
@@ -190,7 +192,6 @@ func startAdminServer(
 	cfg *config,
 	port int,
 	pinger *queuePinger,
-	routingTable *routing.Table,
 ) error {
 	lggr = lggr.WithName("startHealthcheckServer")
 
@@ -216,7 +217,8 @@ func startAdminServer(
 		if err := pinger.fetchAndSaveCounts(ctx); err != nil {
 			lggr.Error(err, "requesting counts failed")
 			w.WriteHeader(500)
-			w.Write([]byte("error requesting counts from interceptors"))
+			_, err := w.Write([]byte("error requesting counts from interceptors"))
+			lggr.Error(err, "failed sending equesting counts failed")
 			return
 		}
 		cts := pinger.counts()
@@ -224,7 +226,8 @@ func startAdminServer(
 		if err := json.NewEncoder(w).Encode(&cts); err != nil {
 			lggr.Error(err, "writing counts data to caller")
 			w.WriteHeader(500)
-			w.Write([]byte("error writing counts data to caller"))
+			_, err := w.Write([]byte("error writing counts data to caller"))
+			lggr.Error(err, "failed sending writing counts data to caller")
 		}
 	})
 
diff --git a/scaler/queue_pinger.go b/scaler/queue_pinger.go
index 5ae8439..d74463d 100644
--- a/scaler/queue_pinger.go
+++ b/scaler/queue_pinger.go
@@ -9,11 +9,12 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
+	"github.com/pkg/errors"
+	"golang.org/x/sync/errgroup"
+
 	"github.com/kedacore/http-add-on/pkg/k8s"
 	"github.com/kedacore/http-add-on/pkg/queue"
 	"github.com/kedacore/http-add-on/pkg/routing"
-	"github.com/pkg/errors"
-	"golang.org/x/sync/errgroup"
 )
 
 // queuePinger has functionality to ping all interceptors
@@ -172,7 +173,6 @@ func (q *queuePinger) fetchAndSaveCounts(ctx context.Context) error {
 	q.lastPingTime = time.Now()
 
 	return nil
-
 }
 
 // fetchCounts fetches all counts from every endpoint returned
@@ -273,5 +273,4 @@ func fetchCounts(
 	}
 
 	return totalCounts, agg, nil
-
 }
diff --git a/scaler/queue_pinger_fake.go b/scaler/queue_pinger_fake.go
index f31b98e..ef8428b 100644
--- a/scaler/queue_pinger_fake.go
+++ b/scaler/queue_pinger_fake.go
@@ -8,10 +8,11 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
+	v1 "k8s.io/api/core/v1"
+
 	"github.com/kedacore/http-add-on/pkg/k8s"
 	kedanet "github.com/kedacore/http-add-on/pkg/net"
 	"github.com/kedacore/http-add-on/pkg/queue"
-	v1 "k8s.io/api/core/v1"
 )
 
 // startFakeQueuePinger starts a fake server that simulates
@@ -24,7 +25,6 @@ import (
 // returns nil for the first 3 return value and a non-nil error in
 // case of a failure.
 func startFakeQueueEndpointServer(
-	ns,
 	svcName string,
 	q queue.CountReader,
 	numEndpoints int,
@@ -35,7 +35,7 @@ func startFakeQueueEndpointServer(
 	if err != nil {
 		return nil, nil, nil, err
 	}
-	endpoints, err := k8s.FakeEndpointsForURL(srvURL, ns, svcName, numEndpoints)
+	endpoints, err := k8s.FakeEndpointsForURL(srvURL, "testns", svcName, numEndpoints)
 	if err != nil {
 		return nil, nil, nil, err
 	}


Test patch:
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index cbda002..6b139b9 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -52,3 +52,18 @@ jobs:
 
     - name: Test
       run: ARCH=${{ matrix.name }} make test
+
+  statics:
+    name: Static Checks
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4.5.0
+        with:
+          python-version: 3.x
+      - uses: actions/setup-go@v3
+        with:
+          go-version: 1.19
+      - name: Get golangci
+        run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0
+      - uses: pre-commit/action@v3.0.0
diff --git a/e2e/e2e_test.go b/e2e/e2e_test.go
index 9dcc35d..d87cf24 100644
--- a/e2e/e2e_test.go
+++ b/e2e/e2e_test.go
@@ -68,9 +68,9 @@ func TestE2E(t *testing.T) {
 
 	// ensure that the interceptor and XKCD scaledobjects
 	// exist
-	_, err = getScaledObject(ctx, cl, ns, "keda-add-ons-http-interceptor")
+	err = getScaledObject(ctx, cl, ns, "keda-add-ons-http-interceptor")
 	r.NoError(err)
-	_, err = getScaledObject(ctx, cl, ns, "xkcd-app")
+	err = getScaledObject(ctx, cl, ns, "xkcd-app")
 	r.NoError(err)
 
 	// issue requests to the XKCD service directly to make
diff --git a/e2e/k8s.go b/e2e/k8s.go
index ebdc9a6..7657193 100644
--- a/e2e/k8s.go
+++ b/e2e/k8s.go
@@ -2,16 +2,14 @@ package e2e
 
 import (
 	"context"
-	"strconv"
 
 	"github.com/codeskyblue/go-sh"
-	"github.com/kedacore/http-add-on/pkg/k8s"
 	"github.com/pkg/errors"
-	corev1 "k8s.io/api/core/v1"
-	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
 	"k8s.io/client-go/rest"
 	"sigs.k8s.io/controller-runtime/pkg/client"
 	clientconfig "sigs.k8s.io/controller-runtime/pkg/client/config"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
 )
 
 func getClient() (
@@ -34,20 +32,12 @@ func deleteNS(ns string) error {
 	return sh.Command("kubectl", "delete", "namespace", ns).Run()
 }
 
-func getPortStrings(svc *corev1.Service) []string {
-	ret := []string{}
-	for _, port := range svc.Spec.Ports {
-		ret = append(ret, strconv.Itoa(int(port.Port)))
-	}
-	return ret
-}
-
 func getScaledObject(
 	ctx context.Context,
 	cl client.Client,
 	ns,
 	name string,
-) (*unstructured.Unstructured, error) {
+) error {
 	scaledObject, err := k8s.NewScaledObject(
 		ns,
 		name,
@@ -59,10 +49,10 @@ func getScaledObject(
 		30,
 	)
 	if err != nil {
-		return nil, err
+		return err
 	}
 	if err := cl.Get(ctx, k8s.ObjKey(ns, name), scaledObject); err != nil {
-		return nil, err
+		return err
 	}
-	return scaledObject, nil
+	return nil
 }
diff --git a/e2e/wait_deployment.go b/e2e/wait_deployment.go
index 7d268b9..f1f1dae 100644
--- a/e2e/wait_deployment.go
+++ b/e2e/wait_deployment.go
@@ -5,10 +5,11 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/kedacore/http-add-on/pkg/k8s"
 	"golang.org/x/sync/errgroup"
 	appsv1 "k8s.io/api/apps/v1"
 	"sigs.k8s.io/controller-runtime/pkg/client"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
 )
 
 func waitUntilDeployment(
diff --git a/interceptor/forward_wait_func_test.go b/interceptor/forward_wait_func_test.go
index 21959ba..96be8be 100644
--- a/interceptor/forward_wait_func_test.go
+++ b/interceptor/forward_wait_func_test.go
@@ -6,11 +6,12 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/k8s"
 	"github.com/stretchr/testify/require"
 	"golang.org/x/sync/errgroup"
 	corev1 "k8s.io/api/core/v1"
 	"k8s.io/apimachinery/pkg/watch"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
 )
 
 // Test to make sure the wait function returns a nil error if there is immediately
@@ -102,7 +103,8 @@ func TestWaitFuncWaitsUntilReplicas(t *testing.T) {
 	cache.AddDeployment(*deployment)
 	// create a watcher first so that the goroutine
 	// can later fetch it and send a message on it
-	cache.Watch(ns, deployName)
+	_, err := cache.Watch(ns, deployName)
+	r.NoError(err)
 
 	ctx, done := context.WithTimeout(ctx, totalWaitDur)
 	waitFunc := newDeployReplicasForwardWaitFunc(
@@ -121,7 +123,7 @@ func TestWaitFuncWaitsUntilReplicas(t *testing.T) {
 		watcher.Action(watch.Modified, modifiedDeployment)
 		close(replicasIncreasedCh)
 	}()
-	_, err := waitFunc(ctx, ns, deployName)
+	_, err = waitFunc(ctx, ns, deployName)
 	r.NoError(err)
 	done()
 }
diff --git a/interceptor/k8s_objects_util_test.go b/interceptor/k8s_objects_util_test.go
index 7777ba2..a71c0f1 100644
--- a/interceptor/k8s_objects_util_test.go
+++ b/interceptor/k8s_objects_util_test.go
@@ -1,10 +1,11 @@
 package main
 
 import (
-	"github.com/kedacore/http-add-on/pkg/k8s"
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
 )
 
 // newDeployment creates a new deployment object
diff --git a/interceptor/main_test.go b/interceptor/main_test.go
index c75c077..ac9bb39 100644
--- a/interceptor/main_test.go
+++ b/interceptor/main_test.go
@@ -11,17 +11,18 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
+	"github.com/stretchr/testify/require"
+	"golang.org/x/sync/errgroup"
+	appsv1 "k8s.io/api/apps/v1"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/apimachinery/pkg/util/rand"
+
 	"github.com/kedacore/http-add-on/interceptor/config"
 	"github.com/kedacore/http-add-on/pkg/k8s"
 	kedanet "github.com/kedacore/http-add-on/pkg/net"
 	"github.com/kedacore/http-add-on/pkg/queue"
 	"github.com/kedacore/http-add-on/pkg/routing"
 	"github.com/kedacore/http-add-on/pkg/test"
-	"github.com/stretchr/testify/require"
-	"golang.org/x/sync/errgroup"
-	appsv1 "k8s.io/api/apps/v1"
-	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-	"k8s.io/apimachinery/pkg/util/rand"
 )
 
 func TestRunProxyServerCountMiddleware(t *testing.T) {
@@ -54,19 +55,17 @@ func TestRunProxyServerCountMiddleware(t *testing.T) {
 	// so that the proxy calculates a URL for that
 	// host that points to the (above) fake origin
 	// server.
-	routingTable.AddTarget(
+	r.NoError(routingTable.AddTarget(
 		host,
 		targetFromURL(
-			ns,
 			originURL,
 			originPort,
 			"testdepl",
-			123,
 		),
-	)
+	))
 	timeouts := &config.Timeouts{}
 	waiterCh := make(chan struct{})
-	waitFunc := func(ctx context.Context, ns, name string) (int, error) {
+	waitFunc := func(_ context.Context, _, _ string) (int, error) {
 		<-waiterCh
 		return 1, nil
 	}
@@ -100,6 +99,7 @@ func TestRunProxyServerCountMiddleware(t *testing.T) {
 		if err != nil {
 			return err
 		}
+		defer resp.Body.Close()
 		if resp.StatusCode != http.StatusOK {
 			return fmt.Errorf(
 				"unexpected status code: %d",
diff --git a/interceptor/middleware_test.go b/interceptor/middleware_test.go
index 0f3968a..52224ca 100644
--- a/interceptor/middleware_test.go
+++ b/interceptor/middleware_test.go
@@ -10,9 +10,10 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/queue"
 	"github.com/stretchr/testify/require"
 	"golang.org/x/sync/errgroup"
+
+	"github.com/kedacore/http-add-on/pkg/queue"
 )
 
 func TestCountMiddleware(t *testing.T) {
@@ -23,9 +24,10 @@ func TestCountMiddleware(t *testing.T) {
 	middleware := countMiddleware(
 		logr.Discard(),
 		queueCounter,
-		http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-			w.WriteHeader(200)
-			w.Write([]byte("OK"))
+		http.HandlerFunc(func(wr http.ResponseWriter, req *http.Request) {
+			wr.WriteHeader(200)
+			_, err := wr.Write([]byte("OK"))
+			r.NoError(err)
 		}),
 	)
 
diff --git a/interceptor/proxy_handlers_integration_test.go b/interceptor/proxy_handlers_integration_test.go
index 0e36659..4e14564 100644
--- a/interceptor/proxy_handlers_integration_test.go
+++ b/interceptor/proxy_handlers_integration_test.go
@@ -3,7 +3,6 @@ package main
 import (
 	"context"
 	"fmt"
-	"io"
 	"net"
 	"net/http"
 	"net/http/httptest"
@@ -14,9 +13,6 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/k8s"
-	kedanet "github.com/kedacore/http-add-on/pkg/net"
-	"github.com/kedacore/http-add-on/pkg/routing"
 	"github.com/pkg/errors"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
@@ -24,6 +20,10 @@ import (
 	appsv1 "k8s.io/api/apps/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/util/wait"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
+	kedanet "github.com/kedacore/http-add-on/pkg/net"
+	"github.com/kedacore/http-add-on/pkg/routing"
 )
 
 // happy path - deployment is scaled to 1 and host in routing table
@@ -36,8 +36,8 @@ func TestIntegrationHappyPath(t *testing.T) {
 	)
 	r := require.New(t)
 	h, err := newHarness(
+		t,
 		deploymentReplicasTimeout,
-		responseHeaderTimeout,
 	)
 	r.NoError(err)
 	defer h.close()
@@ -59,24 +59,21 @@ func TestIntegrationHappyPath(t *testing.T) {
 
 	originPort, err := strconv.Atoi(h.originURL.Port())
 	r.NoError(err)
-	h.routingTable.AddTarget(hostForTest(t), targetFromURL(
-		namespace,
+	r.NoError(h.routingTable.AddTarget(hostForTest(t), targetFromURL(
 		h.originURL,
 		originPort,
 		deplName,
-		123,
-	))
+	)))
 
 	// happy path
 	res, err := doRequest(
 		http.DefaultClient,
-		"GET",
 		h.proxyURL.String(),
 		hostForTest(t),
-		nil,
 	)
 	r.NoError(err)
 	r.Equal(200, res.StatusCode)
+	res.Body.Close()
 }
 
 // deployment scaled to 1 but host not in routing table
@@ -91,7 +88,7 @@ func TestIntegrationNoRoutingTableEntry(t *testing.T) {
 	)
 	host := fmt.Sprintf("%s.integrationtest.interceptor.kedahttp.dev", t.Name())
 	r := require.New(t)
-	h, err := newHarness(time.Second, time.Second)
+	h, err := newHarness(t, time.Second)
 	r.NoError(err)
 	defer h.close()
 	h.deplCache.Set(ns, host, appsv1.Deployment{
@@ -104,13 +101,13 @@ func TestIntegrationNoRoutingTableEntry(t *testing.T) {
 	// not in the routing table
 	res, err := doRequest(
 		http.DefaultClient,
-		"GET",
 		h.proxyURL.String(),
 		"not-in-the-table",
-		nil,
 	)
+	res.Body.Close()
 	r.NoError(err)
 	r.Equal(404, res.StatusCode)
+	res.Body.Close()
 }
 
 // host in the routing table but deployment has no replicas
@@ -122,18 +119,16 @@ func TestIntegrationNoReplicas(t *testing.T) {
 	host := hostForTest(t)
 	deployName := "testdeployment"
 	r := require.New(t)
-	h, err := newHarness(deployTimeout, time.Second)
+	h, err := newHarness(t, deployTimeout)
 	r.NoError(err)
 
 	originPort, err := strconv.Atoi(h.originURL.Port())
 	r.NoError(err)
-	h.routingTable.AddTarget(hostForTest(t), targetFromURL(
-		ns,
+	r.NoError(h.routingTable.AddTarget(hostForTest(t), targetFromURL(
 		h.originURL,
 		originPort,
 		deployName,
-		123,
-	))
+	)))
 
 	// 0 replicas
 	h.deplCache.Set(ns, deployName, appsv1.Deployment{
@@ -146,14 +141,12 @@ func TestIntegrationNoReplicas(t *testing.T) {
 	start := time.Now()
 	res, err := doRequest(
 		http.DefaultClient,
-		"GET",
 		h.proxyURL.String(),
 		host,
-		nil,
 	)
-
 	r.NoError(err)
 	r.Equal(502, res.StatusCode)
+	res.Body.Close()
 	elapsed := time.Since(start)
 	// we should have slept more than the deployment replicas wait timeout
 	r.GreaterOrEqual(elapsed, deployTimeout)
@@ -171,22 +164,20 @@ func TestIntegrationWaitReplicas(t *testing.T) {
 	)
 	ctx := context.Background()
 	r := require.New(t)
-	h, err := newHarness(deployTimeout, responseTimeout)
+	h, err := newHarness(t, deployTimeout)
 	r.NoError(err)
 
 	// add host to routing table
 	originPort, err := strconv.Atoi(h.originURL.Port())
 	r.NoError(err)
-	h.routingTable.AddTarget(
+	r.NoError(h.routingTable.AddTarget(
 		hostForTest(t),
 		targetFromURL(
-			ns,
 			h.originURL,
 			originPort,
 			deployName,
-			123,
 		),
-	)
+	))
 
 	// set up a deployment with zero replicas and create
 	// a watcher we can use later to fake-send a deployment
@@ -208,16 +199,14 @@ func TestIntegrationWaitReplicas(t *testing.T) {
 	grp.Go(func() error {
 		resp, err := doRequest(
 			http.DefaultClient,
-			"GET",
 			h.proxyURL.String(),
 			hostForTest(t),
-			nil,
 		)
 		if err != nil {
 			return err
 		}
 		response = resp
-
+		resp.Body.Close()
 		return nil
 	})
 	const sleepDur = deployTimeout / 4
@@ -253,10 +242,8 @@ func TestIntegrationWaitReplicas(t *testing.T) {
 
 func doRequest(
 	cl *http.Client,
-	method,
 	urlStr,
 	host string,
-	body io.ReadCloser,
 ) (*http.Response, error) {
 	req, err := http.NewRequest("GET", urlStr, nil)
 	if err != nil {
@@ -285,9 +272,10 @@ type harness struct {
 }
 
 func newHarness(
-	deployReplicasTimeout,
-	responseHeaderTimeout time.Duration,
+	t *testing.T,
+	deployReplicasTimeout time.Duration,
 ) (*harness, error) {
+	t.Helper()
 	lggr := logr.Discard()
 	routingTable := routing.NewTable()
 	dialContextFunc := kedanet.DialContextWithRetry(
@@ -308,7 +296,10 @@ func newHarness(
 
 	originHdl := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		w.WriteHeader(http.StatusOK)
-		w.Write([]byte("hello!"))
+		_, err := w.Write([]byte("hello!"))
+		if err != nil {
+			t.Fatalf("error writing message from origin: %s", err)
+		}
 	})
 	testOriginSrv, originSrvURL, err := kedanet.StartTestServer(originHdl)
 	if err != nil {
@@ -325,7 +316,7 @@ func newHarness(
 		},
 		forwardingConfig{
 			waitTimeout:       deployReplicasTimeout,
-			respHeaderTimeout: responseHeaderTimeout,
+			respHeaderTimeout: time.Second,
 		},
 	)
 
diff --git a/interceptor/proxy_handlers_test.go b/interceptor/proxy_handlers_test.go
index 788f10c..25bf7d6 100644
--- a/interceptor/proxy_handlers_test.go
+++ b/interceptor/proxy_handlers_test.go
@@ -11,21 +11,22 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
+	"github.com/stretchr/testify/require"
+
 	kedanet "github.com/kedacore/http-add-on/pkg/net"
 	"github.com/kedacore/http-add-on/pkg/routing"
-	"github.com/stretchr/testify/require"
 )
 
 // the proxy should successfully forward a request to a running server
 func TestImmediatelySuccessfulProxy(t *testing.T) {
-	const ns = "testns"
 	host := fmt.Sprintf("%s.testing", t.Name())
 	r := require.New(t)
 
 	originHdl := kedanet.NewTestHTTPHandlerWrapper(
-		http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+		http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 			w.WriteHeader(200)
-			w.Write([]byte("test response"))
+			_, err := w.Write([]byte("test response"))
+			r.NoError(err)
 		}),
 	)
 	srv, originURL, err := kedanet.StartTestServer(originHdl)
@@ -35,13 +36,11 @@ func TestImmediatelySuccessfulProxy(t *testing.T) {
 	originPort, err := strconv.Atoi(originURL.Port())
 	r.NoError(err)
 	target := targetFromURL(
-		ns,
 		originURL,
 		originPort,
 		"testdepl",
-		123,
 	)
-	routingTable.AddTarget(host, target)
+	r.NoError(routingTable.AddTarget(host, target))
 
 	timeouts := defaultTimeouts()
 	dialCtxFunc := retryDialContextFunc(timeouts, timeouts.DefaultBackoff())
@@ -90,13 +89,13 @@ func TestWaitFailedConnection(t *testing.T) {
 		return 1, nil
 	}
 	routingTable := routing.NewTable()
-	routingTable.AddTarget(host, routing.NewTarget(
+	r.NoError(routingTable.AddTarget(host, routing.NewTarget(
 		"testns",
 		"nosuchdepl",
 		8081,
 		"nosuchdepl",
 		1234,
-	))
+	)))
 
 	hdl := newForwardingHandler(
 		logr.Discard(),
@@ -137,13 +136,13 @@ func TestTimesOutOnWaitFunc(t *testing.T) {
 	noSuchHost := fmt.Sprintf("%s.testing", t.Name())
 
 	routingTable := routing.NewTable()
-	routingTable.AddTarget(noSuchHost, routing.NewTarget(
+	r.NoError(routingTable.AddTarget(noSuchHost, routing.NewTarget(
 		"testns",
 		"nosuchsvc",
 		9091,
 		"nosuchdepl",
 		1234,
-	))
+	)))
 	hdl := newForwardingHandler(
 		logr.Discard(),
 		routingTable,
@@ -216,13 +215,13 @@ func TestWaitsForWaitFunc(t *testing.T) {
 	originHost, originPort, err := splitHostPort(testSrvURL.Host)
 	r.NoError(err)
 	routingTable := routing.NewTable()
-	routingTable.AddTarget(noSuchHost, routing.NewTarget(
+	r.NoError(routingTable.AddTarget(noSuchHost, routing.NewTarget(
 		namespace,
 		originHost,
 		originPort,
 		"nosuchdepl",
 		1234,
-	))
+	)))
 	hdl := newForwardingHandler(
 		logr.Discard(),
 		routingTable,
@@ -273,10 +272,11 @@ func TestWaitHeaderTimeout(t *testing.T) {
 	// proxy
 	originHdlCh := make(chan struct{})
 	originHdl := kedanet.NewTestHTTPHandlerWrapper(
-		http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+		http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 			<-originHdlCh
 			w.WriteHeader(200)
-			w.Write([]byte("test response"))
+			_, err := w.Write([]byte("test response"))
+			r.NoError(err)
 		}),
 	)
 	srv, originURL, err := kedanet.StartTestServer(originHdl)
@@ -296,7 +296,7 @@ func TestWaitHeaderTimeout(t *testing.T) {
 		"testdepl",
 		1234,
 	)
-	routingTable.AddTarget(originURL.Host, target)
+	r.NoError(routingTable.AddTarget(originURL.Host, target))
 	hdl := newForwardingHandler(
 		logr.Discard(),
 		routingTable,
@@ -373,18 +373,16 @@ func notifyingFunc() (forwardWaitFunc, <-chan struct{}, func()) {
 }
 
 func targetFromURL(
-	ns string,
 	u *url.URL,
 	port int,
 	deployment string,
-	targetPendingReqs int32,
 ) routing.Target {
 	svc := strings.Split(u.Host, ":")[0]
 	return routing.NewTarget(
-		ns,
+		"testns",
 		svc,
 		port,
 		deployment,
-		targetPendingReqs,
+		123,
 	)
 }
diff --git a/interceptor/request_forwarder_test.go b/interceptor/request_forwarder_test.go
index fe51c55..51d749a 100644
--- a/interceptor/request_forwarder_test.go
+++ b/interceptor/request_forwarder_test.go
@@ -8,10 +8,12 @@ import (
 	"testing"
 	"time"
 
-	"github.com/kedacore/http-add-on/interceptor/config"
-	kedanet "github.com/kedacore/http-add-on/pkg/net"
+	"github.com/go-logr/logr"
 	"github.com/stretchr/testify/require"
 	"k8s.io/apimachinery/pkg/util/wait"
+
+	"github.com/kedacore/http-add-on/interceptor/config"
+	kedanet "github.com/kedacore/http-add-on/pkg/net"
 )
 
 func newRoundTripper(
@@ -65,10 +67,11 @@ func TestForwarderSuccess(t *testing.T) {
 	const respCode = 302
 	const respBody = "TestForwardingHandler"
 	originHdl := kedanet.NewTestHTTPHandlerWrapper(
-		http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+		http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 			close(reqRecvCh)
 			w.WriteHeader(respCode)
-			w.Write([]byte(respBody))
+			_, err := w.Write([]byte(respBody))
+			r.NoError(err)
 		}),
 	)
 	testServer := httptest.NewServer(originHdl)
@@ -82,6 +85,7 @@ func TestForwarderSuccess(t *testing.T) {
 	timeouts := defaultTimeouts()
 	dialCtxFunc := retryDialContextFunc(timeouts, timeouts.DefaultBackoff())
 	forwardRequest(
+		logr.Discard(),
 		res,
 		req,
 		newRoundTripper(dialCtxFunc, timeouts.ResponseHeader),
@@ -129,6 +133,7 @@ func TestForwarderHeaderTimeout(t *testing.T) {
 	res, req, err := reqAndRes("/testfwd")
 	r.NoError(err)
 	forwardRequest(
+		logr.Discard(),
 		res,
 		req,
 		newRoundTripper(dialCtxFunc, timeouts.ResponseHeader),
@@ -151,10 +156,11 @@ func TestForwarderWaitsForSlowOrigin(t *testing.T) {
 	const originRespCode = 200
 	const originRespBodyStr = "Hello World!"
 	hdl := kedanet.NewTestHTTPHandlerWrapper(
-		http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+		http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 			<-originWaitCh
 			w.WriteHeader(originRespCode)
-			w.Write([]byte(originRespBodyStr))
+			_, err := w.Write([]byte(originRespBodyStr))
+			r.NoError(err)
 		}),
 	)
 	srv, originURL, err := kedanet.StartTestServer(hdl)
@@ -180,6 +186,7 @@ func TestForwarderWaitsForSlowOrigin(t *testing.T) {
 	res, req, err := reqAndRes(path)
 	r.NoError(err)
 	forwardRequest(
+		logr.Discard(),
 		res,
 		req,
 		newRoundTripper(dialCtxFunc, timeouts.ResponseHeader),
@@ -189,7 +196,6 @@ func TestForwarderWaitsForSlowOrigin(t *testing.T) {
 	ensureSignalBeforeTimeout(originWaitCh, originDelay*2)
 	r.Equal(originRespCode, res.Code)
 	r.Equal(originRespBodyStr, res.Body.String())
-
 }
 
 func TestForwarderConnectionRetryAndTimeout(t *testing.T) {
@@ -208,6 +214,7 @@ func TestForwarderConnectionRetryAndTimeout(t *testing.T) {
 
 	start := time.Now()
 	forwardRequest(
+		logr.Discard(),
 		res,
 		req,
 		newRoundTripper(dialCtxFunc, timeouts.ResponseHeader),
@@ -243,12 +250,13 @@ func TestForwardRequestRedirectAndHeaders(t *testing.T) {
 
 	srv, srvURL, err := kedanet.StartTestServer(
 		kedanet.NewTestHTTPHandlerWrapper(
-			http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 				w.Header().Set("Content-Type", "text/html; charset=utf-8")
 				w.Header().Set("X-Custom-Header", "somethingcustom")
 				w.Header().Set("Location", "abc123.com")
 				w.WriteHeader(301)
-				w.Write([]byte("Hello from srv"))
+				_, err := w.Write([]byte("Hello from srv"))
+				r.NoError(err)
 			}),
 		),
 	)
@@ -263,6 +271,7 @@ func TestForwardRequestRedirectAndHeaders(t *testing.T) {
 	res, req, err := reqAndRes("/testfwd")
 	r.NoError(err)
 	forwardRequest(
+		logr.Discard(),
 		res,
 		req,
 		newRoundTripper(dialCtxFunc, timeouts.ResponseHeader),
diff --git a/operator/controllers/config/app_info_test.go b/operator/controllers/config/app_info_test.go
index 70fb370..1527148 100644
--- a/operator/controllers/config/app_info_test.go
+++ b/operator/controllers/config/app_info_test.go
@@ -4,8 +4,9 @@ import (
 	"fmt"
 	"testing"
 
-	"github.com/kedacore/http-add-on/operator/api/v1alpha1"
 	"github.com/stretchr/testify/require"
+
+	"github.com/kedacore/http-add-on/operator/api/v1alpha1"
 )
 
 func TestAppScaledObjectName(t *testing.T) {
diff --git a/operator/controllers/config/config_test.go b/operator/controllers/config/config_test.go
index bfccfe4..2fe2af7 100644
--- a/operator/controllers/config/config_test.go
+++ b/operator/controllers/config/config_test.go
@@ -20,5 +20,4 @@ func TestExternalScalerHostName(t *testing.T) {
 	r.Equal(2, len(spl), "HostName should return a hostname with 2 parts")
 	r.Equal(sc.ServiceName, spl[0])
 	r.Equal(fmt.Sprintf("%s:%d", ns, sc.Port), spl[1])
-
 }
diff --git a/operator/controllers/ping_test.go b/operator/controllers/ping_test.go
index 6156716..101281b 100644
--- a/operator/controllers/ping_test.go
+++ b/operator/controllers/ping_test.go
@@ -5,10 +5,11 @@ import (
 	"net/http"
 	"testing"
 
-	"github.com/kedacore/http-add-on/pkg/k8s"
-	kedanet "github.com/kedacore/http-add-on/pkg/net"
 	"github.com/stretchr/testify/require"
 	"sigs.k8s.io/controller-runtime/pkg/client/fake"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
+	kedanet "github.com/kedacore/http-add-on/pkg/net"
 )
 
 func TestPingInterceptors(t *testing.T) {
diff --git a/operator/controllers/routing_table_test.go b/operator/controllers/routing_table_test.go
index 492c5d3..8820501 100644
--- a/operator/controllers/routing_table_test.go
+++ b/operator/controllers/routing_table_test.go
@@ -5,11 +5,12 @@ import (
 	"testing"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/k8s"
-	"github.com/kedacore/http-add-on/pkg/routing"
 	"github.com/stretchr/testify/require"
 	corev1 "k8s.io/api/core/v1"
 	"sigs.k8s.io/controller-runtime/pkg/client"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
+	"github.com/kedacore/http-add-on/pkg/routing"
 )
 
 func TestRoutingTable(t *testing.T) {
diff --git a/operator/controllers/scaled_object_test.go b/operator/controllers/scaled_object_test.go
index 5ec96c6..a3b6fcb 100644
--- a/operator/controllers/scaled_object_test.go
+++ b/operator/controllers/scaled_object_test.go
@@ -6,13 +6,14 @@ import (
 	"testing"
 	"time"
 
-	"github.com/kedacore/http-add-on/operator/api/v1alpha1"
-	"github.com/kedacore/http-add-on/operator/controllers/config"
-	"github.com/kedacore/http-add-on/pkg/k8s"
 	"github.com/stretchr/testify/require"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
 	"sigs.k8s.io/controller-runtime/pkg/client"
+
+	"github.com/kedacore/http-add-on/operator/api/v1alpha1"
+	"github.com/kedacore/http-add-on/operator/controllers/config"
+	"github.com/kedacore/http-add-on/pkg/k8s"
 )
 
 func TestCreateOrUpdateScaledObject(t *testing.T) {
@@ -128,5 +129,4 @@ func getKeyAsMap(m map[string]interface{}, key string) (map[string]interface{},
 		return nil, fmt.Errorf("key %s was not a map[string]interface{}", key)
 	}
 	return val, nil
-
 }
diff --git a/operator/controllers/suite_test.go b/operator/controllers/suite_test.go
index c9fcfb6..deded4b 100644
--- a/operator/controllers/suite_test.go
+++ b/operator/controllers/suite_test.go
@@ -57,7 +57,7 @@ type commonTestInfra struct {
 
 func newCommonTestInfra(namespace, appName string) *commonTestInfra {
 	ctx := context.Background()
-	cl := fake.NewFakeClient()
+	cl := fake.NewClientBuilder().Build()
 	logger := logr.Discard()
 
 	httpso := v1alpha1.HTTPScaledObject{
@@ -103,12 +103,11 @@ var _ = BeforeSuite(func(done Done) {
 	// 	UseExistingCluster: &useExistingCluster,
 	// }
 
-	var err error
 	// cfg, err = testEnv.Start()
 	// Expect(err).ToNot(HaveOccurred())
 	// Expect(cfg).ToNot(BeNil())
 
-	err = v1alpha1.AddToScheme(scheme.Scheme)
+	err := v1alpha1.AddToScheme(scheme.Scheme)
 	Expect(err).NotTo(HaveOccurred())
 
 	// +kubebuilder:scaffold:scheme
diff --git a/operator/main_test.go b/operator/main_test.go
index 1892126..33aeab7 100644
--- a/operator/main_test.go
+++ b/operator/main_test.go
@@ -10,12 +10,13 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/operator/controllers/config"
-	"github.com/kedacore/http-add-on/pkg/routing"
-	"github.com/kedacore/http-add-on/pkg/test"
 	"github.com/stretchr/testify/require"
 	"golang.org/x/sync/errgroup"
 	"k8s.io/apimachinery/pkg/util/rand"
+
+	"github.com/kedacore/http-add-on/operator/controllers/config"
+	"github.com/kedacore/http-add-on/pkg/routing"
+	"github.com/kedacore/http-add-on/pkg/test"
 )
 
 func TestRunAdminServerConfig(t *testing.T) {
@@ -75,5 +76,4 @@ func TestRunAdminServerConfig(t *testing.T) {
 
 	done()
 	r.Error(errgrp.Wait())
-
 }
diff --git a/pkg/http/server_test.go b/pkg/http/server_test.go
index 2dc4245..2cea3d8 100644
--- a/pkg/http/server_test.go
+++ b/pkg/http/server_test.go
@@ -17,7 +17,10 @@ func TestServeContext(t *testing.T) {
 	)
 	hdl := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		w.Header().Set("foo", "bar")
-		w.Write([]byte("hello world"))
+		_, err := w.Write([]byte("hello world"))
+		if err != nil {
+			t.Fatalf("error writing message to client from handler")
+		}
 	})
 	addr := "localhost:1234"
 	const cancelDur = 500 * time.Millisecond
diff --git a/pkg/k8s/endpoints_test.go b/pkg/k8s/endpoints_test.go
index 846822f..0faebd3 100644
--- a/pkg/k8s/endpoints_test.go
+++ b/pkg/k8s/endpoints_test.go
@@ -57,6 +57,7 @@ func TestGetEndpoints(t *testing.T) {
 	addrLookup := map[string]*v1.EndpointAddress{}
 	for _, subset := range endpoints.Subsets {
 		for _, addr := range subset.Addresses {
+			addr := addr
 			key := fmt.Sprintf("http://%s:%s", addr.IP, svcPort)
 			addrLookup[key] = &addr
 		}
diff --git a/pkg/queue/queue_rpc_test.go b/pkg/queue/queue_rpc_test.go
index 10cdec4..48887e6 100644
--- a/pkg/queue/queue_rpc_test.go
+++ b/pkg/queue/queue_rpc_test.go
@@ -7,9 +7,10 @@ import (
 	"testing"
 
 	"github.com/go-logr/logr"
+	"github.com/stretchr/testify/require"
+
 	pkghttp "github.com/kedacore/http-add-on/pkg/http"
 	kedanet "github.com/kedacore/http-add-on/pkg/net"
-	"github.com/stretchr/testify/require"
 )
 
 func TestQueueSizeHandlerSuccess(t *testing.T) {
@@ -74,5 +75,4 @@ func TestQueueSizeHandlerIntegration(t *testing.T) {
 	}
 	reqs := hdl.IncomingRequests()
 	r.Equal(1, len(reqs))
-
 }
diff --git a/pkg/routing/config_map_updater_test.go b/pkg/routing/config_map_updater_test.go
index f4d5b3d..b635ac6 100644
--- a/pkg/routing/config_map_updater_test.go
+++ b/pkg/routing/config_map_updater_test.go
@@ -8,16 +8,16 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/k8s"
-	"github.com/kedacore/http-add-on/pkg/queue"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 	"golang.org/x/sync/errgroup"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-	"k8s.io/apimachinery/pkg/watch"
 	"k8s.io/client-go/kubernetes/fake"
 	clgotesting "k8s.io/client-go/testing"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
+	"github.com/kedacore/http-add-on/pkg/queue"
 )
 
 // fake adapters for the k8s.GetterWatcher interface.
@@ -43,17 +43,6 @@ import (
 //
 // (https://pkg.go.dev/k8s.io/apimachinery@v0.21.3/pkg/watch#NewFake),
 
-type fakeConfigMapWatcher struct {
-	watchIface watch.Interface
-}
-
-func (c fakeConfigMapWatcher) Watch(
-	ctx context.Context,
-	opts metav1.ListOptions,
-) (watch.Interface, error) {
-	return c.watchIface, nil
-}
-
 func TestStartUpdateLoop(t *testing.T) {
 	r := require.New(t)
 	a := assert.New(t)
@@ -69,20 +58,20 @@ func TestStartUpdateLoop(t *testing.T) {
 
 	q := queue.NewFakeCounter()
 	table := NewTable()
-	table.AddTarget("host1", NewTarget(
+	r.NoError(table.AddTarget("host1", NewTarget(
 		"testns",
 		"svc1",
 		8080,
 		"depl1",
 		100,
-	))
-	table.AddTarget("host2", NewTarget(
+	)))
+	r.NoError(table.AddTarget("host2", NewTarget(
 		"testns",
 		"svc2",
 		8080,
 		"depl2",
 		100,
-	))
+	)))
 
 	cm := &corev1.ConfigMap{
 		ObjectMeta: metav1.ObjectMeta{
@@ -212,5 +201,4 @@ func TestStartUpdateLoop(t *testing.T) {
 			qHost,
 		)
 	}
-
 }
diff --git a/pkg/routing/table_rpc_test.go b/pkg/routing/table_rpc_test.go
index 00dbab2..6297ff0 100644
--- a/pkg/routing/table_rpc_test.go
+++ b/pkg/routing/table_rpc_test.go
@@ -5,17 +5,18 @@ import (
 	"testing"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/queue"
 	"github.com/stretchr/testify/require"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/client-go/kubernetes/fake"
+
+	"github.com/kedacore/http-add-on/pkg/queue"
 )
 
-func newTableFromMap(m map[string]Target) *Table {
+func newTableFromMap(r *require.Assertions, m map[string]Target) *Table {
 	table := NewTable()
 	for host, target := range m {
-		table.AddTarget(host, target)
+		r.NoError(table.AddTarget(host, target))
 	}
 	return table
 }
@@ -59,7 +60,7 @@ func TestRPCIntegration(t *testing.T) {
 
 	retTable = NewTable()
 	k8sCl, err = fakeConfigMapClientForTable(
-		newTableFromMap(targetMap),
+		newTableFromMap(r, targetMap),
 		ns,
 		ConfigMapRoutingTableName,
 	)
diff --git a/pkg/routing/table_test.go b/pkg/routing/table_test.go
index 0cbce63..668dd28 100644
--- a/pkg/routing/table_test.go
+++ b/pkg/routing/table_test.go
@@ -21,7 +21,7 @@ func TestTableJSONRoundTrip(t *testing.T) {
 		"testdepl",
 		1234,
 	)
-	tbl.AddTarget(host, tgt)
+	r.NoError(tbl.AddTarget(host, tgt))
 
 	b, err := json.Marshal(&tbl)
 	r.NoError(err)
@@ -53,7 +53,7 @@ func TestTableRemove(t *testing.T) {
 	tbl := NewTable()
 
 	// add the target to the table and ensure that you can look it up
-	tbl.AddTarget(host, tgt)
+	r.NoError(tbl.AddTarget(host, tgt))
 	retTgt, err := tbl.Lookup(host)
 	r.Equal(tgt, retTgt)
 	r.NoError(err)
@@ -86,9 +86,9 @@ func TestTableReplace(t *testing.T) {
 	)
 	// create two routing tables, each with different targets
 	tbl1 := NewTable()
-	tbl1.AddTarget(host1, tgt1)
+	r.NoError(tbl1.AddTarget(host1, tgt1))
 	tbl2 := NewTable()
-	tbl2.AddTarget(host2, tgt2)
+	r.NoError(tbl2.AddTarget(host2, tgt2))
 
 	// replace the second table with the first and ensure that the tables
 	// are now equal
diff --git a/scaler/handlers_test.go b/scaler/handlers_test.go
index fd28954..8c0d954 100644
--- a/scaler/handlers_test.go
+++ b/scaler/handlers_test.go
@@ -8,12 +8,14 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/queue"
-	"github.com/kedacore/http-add-on/pkg/routing"
-	externalscaler "github.com/kedacore/http-add-on/proto"
 	"github.com/stretchr/testify/require"
 	"google.golang.org/grpc"
+	"google.golang.org/grpc/credentials/insecure"
 	"google.golang.org/grpc/test/bufconn"
+
+	"github.com/kedacore/http-add-on/pkg/queue"
+	"github.com/kedacore/http-add-on/pkg/routing"
+	externalscaler "github.com/kedacore/http-add-on/proto"
 )
 
 func standardTarget() routing.Target {
@@ -34,7 +36,7 @@ func TestStreamIsActive(t *testing.T) {
 		expectedErr bool
 		setup       func(*routing.Table, *queuePinger)
 	}
-
+	r := require.New(t)
 	testCases := []testCase{
 		{
 			name:        "Simple host inactive",
@@ -42,7 +44,7 @@ func TestStreamIsActive(t *testing.T) {
 			expected:    false,
 			expectedErr: false,
 			setup: func(table *routing.Table, q *queuePinger) {
-				table.AddTarget(t.Name(), standardTarget())
+				r.NoError(table.AddTarget(t.Name(), standardTarget()))
 				q.pingMut.Lock()
 				defer q.pingMut.Unlock()
 				q.allCounts[t.Name()] = 0
@@ -61,7 +63,7 @@ func TestStreamIsActive(t *testing.T) {
 			expected:    true,
 			expectedErr: false,
 			setup: func(table *routing.Table, q *queuePinger) {
-				table.AddTarget(t.Name(), standardTarget())
+				r.NoError(table.AddTarget(t.Name(), standardTarget()))
 				q.pingMut.Lock()
 				defer q.pingMut.Unlock()
 				q.allCounts[t.Name()] = 1
@@ -73,7 +75,7 @@ func TestStreamIsActive(t *testing.T) {
 			expected:    false,
 			expectedErr: false,
 			setup: func(table *routing.Table, q *queuePinger) {
-				table.AddTarget(t.Name(), standardTarget())
+				r.NoError(table.AddTarget(t.Name(), standardTarget()))
 			},
 		},
 		{
@@ -112,13 +114,15 @@ func TestStreamIsActive(t *testing.T) {
 				grpcServer,
 				hdl,
 			)
-			go grpcServer.Serve(lis)
+			go func() {
+				r.NoError(grpcServer.Serve(lis))
+			}()
 
 			bufDialFunc := func(context.Context, string) (net.Conn, error) {
 				return lis.Dial()
 			}
 
-			conn, err := grpc.DialContext(ctx, "bufnet", grpc.WithContextDialer(bufDialFunc), grpc.WithInsecure())
+			conn, err := grpc.DialContext(ctx, "bufnet", grpc.WithContextDialer(bufDialFunc), grpc.WithTransportCredentials(insecure.NewCredentials()))
 			if err != nil {
 				t.Fatalf("Failed to dial bufnet: %v", err)
 			}
@@ -164,7 +168,7 @@ func TestIsActive(t *testing.T) {
 		expectedErr bool
 		setup       func(*routing.Table, *queuePinger)
 	}
-
+	r := require.New(t)
 	testCases := []testCase{
 		{
 			name:        "Simple host inactive",
@@ -172,7 +176,7 @@ func TestIsActive(t *testing.T) {
 			expected:    false,
 			expectedErr: false,
 			setup: func(table *routing.Table, q *queuePinger) {
-				table.AddTarget(t.Name(), standardTarget())
+				r.NoError(table.AddTarget(t.Name(), standardTarget()))
 				q.pingMut.Lock()
 				defer q.pingMut.Unlock()
 				q.allCounts[t.Name()] = 0
@@ -191,7 +195,7 @@ func TestIsActive(t *testing.T) {
 			expected:    true,
 			expectedErr: false,
 			setup: func(table *routing.Table, q *queuePinger) {
-				table.AddTarget(t.Name(), standardTarget())
+				r.NoError(table.AddTarget(t.Name(), standardTarget()))
 				q.pingMut.Lock()
 				defer q.pingMut.Unlock()
 				q.allCounts[t.Name()] = 1
@@ -203,7 +207,7 @@ func TestIsActive(t *testing.T) {
 			expected:    false,
 			expectedErr: false,
 			setup: func(table *routing.Table, q *queuePinger) {
-				table.AddTarget(t.Name(), standardTarget())
+				r.NoError(table.AddTarget(t.Name(), standardTarget()))
 			},
 		},
 		{
@@ -263,7 +267,7 @@ func TestGetMetricSpecTable(t *testing.T) {
 		newRoutingTableFn              func() *routing.Table
 		checker                        func(*testing.T, *externalscaler.GetMetricSpecResponse, error)
 	}
-
+	r := require.New(t)
 	cases := []testCase{
 		{
 			name:                           "valid host as host value in scaler metadata",
@@ -275,13 +279,13 @@ func TestGetMetricSpecTable(t *testing.T) {
 			},
 			newRoutingTableFn: func() *routing.Table {
 				ret := routing.NewTable()
-				ret.AddTarget("validHost", routing.NewTarget(
+				r.NoError(ret.AddTarget("validHost", routing.NewTarget(
 					ns,
 					"testsrv",
 					8080,
 					"testdepl",
 					123,
-				))
+				)))
 				return ret
 			},
 			checker: func(t *testing.T, res *externalscaler.GetMetricSpecResponse, err error) {
@@ -305,13 +309,13 @@ func TestGetMetricSpecTable(t *testing.T) {
 			},
 			newRoutingTableFn: func() *routing.Table {
 				ret := routing.NewTable()
-				ret.AddTarget("validHost", routing.NewTarget(
+				r.NoError(ret.AddTarget("validHost", routing.NewTarget(
 					ns,
 					"testsrv",
 					8080,
 					"testdepl",
 					123,
-				))
+				)))
 				return ret
 			},
 			checker: func(t *testing.T, res *externalscaler.GetMetricSpecResponse, err error) {
@@ -390,7 +394,6 @@ func TestGetMetrics(t *testing.T) {
 		// create the HTTP server to encode and serve
 		// the host map
 		fakeSrv, fakeSrvURL, endpoints, err := startFakeQueueEndpointServer(
-			"testns",
 			"testSvc",
 			q,
 			1,
@@ -552,10 +555,11 @@ func TestGetMetrics(t *testing.T) {
 				lggr logr.Logger,
 			) (*routing.Table, *queuePinger, func(), error) {
 				table := routing.NewTable()
-				table.AddTarget(
+				r := require.New(t)
+				r.NoError(table.AddTarget(
 					"myhost.com",
 					standardTarget(),
-				)
+				))
 				pinger, done, err := startFakeInterceptorServer(ctx, lggr, map[string]int{
 					"host1": 201,
 					"host2": 202,
diff --git a/scaler/host_counts_test.go b/scaler/host_counts_test.go
index f5e1643..f8b1c34 100644
--- a/scaler/host_counts_test.go
+++ b/scaler/host_counts_test.go
@@ -3,8 +3,9 @@ package main
 import (
 	"testing"
 
-	"github.com/kedacore/http-add-on/pkg/routing"
 	"github.com/stretchr/testify/require"
+
+	"github.com/kedacore/http-add-on/pkg/routing"
 )
 
 type testCase struct {
@@ -14,11 +15,11 @@ type testCase struct {
 	retCounts map[string]int
 }
 
-func cases() []testCase {
+func cases(r *require.Assertions) []testCase {
 	return []testCase{
 		{
 			name: "empty queue",
-			table: newRoutingTable([]hostAndTarget{
+			table: newRoutingTable(r, []hostAndTarget{
 				{
 					host:   "www.example.com",
 					target: routing.Target{},
@@ -36,7 +37,7 @@ func cases() []testCase {
 		},
 		{
 			name: "one entry in queue, same entry in routing table",
-			table: newRoutingTable([]hostAndTarget{
+			table: newRoutingTable(r, []hostAndTarget{
 				{
 					host:   "example.com",
 					target: routing.Target{},
@@ -51,7 +52,7 @@ func cases() []testCase {
 		},
 		{
 			name: "one entry in queue, two in routing table",
-			table: newRoutingTable([]hostAndTarget{
+			table: newRoutingTable(r, []hostAndTarget{
 				{
 					host:   "example.com",
 					target: routing.Target{},
@@ -70,10 +71,10 @@ func cases() []testCase {
 			},
 		},
 	}
-
 }
 func TestGetHostCount(t *testing.T) {
-	for _, tc := range cases() {
+	r := require.New(t)
+	for _, tc := range cases(r) {
 		for host, retCount := range tc.retCounts {
 			t.Run(tc.name, func(t *testing.T) {
 				r := require.New(t)
@@ -94,10 +95,10 @@ type hostAndTarget struct {
 	target routing.Target
 }
 
-func newRoutingTable(entries []hostAndTarget) *routing.Table {
+func newRoutingTable(r *require.Assertions, entries []hostAndTarget) *routing.Table {
 	ret := routing.NewTable()
 	for _, entry := range entries {
-		ret.AddTarget(entry.host, entry.target)
+		r.NoError(ret.AddTarget(entry.host, entry.target))
 	}
 	return ret
 }
diff --git a/scaler/main_test.go b/scaler/main_test.go
index 19d5324..ce7addd 100644
--- a/scaler/main_test.go
+++ b/scaler/main_test.go
@@ -34,7 +34,6 @@ func TestHealthChecks(t *testing.T) {
 	errgrp, ctx := errgroup.WithContext(ctx)
 
 	ticker, pinger, err := newFakeQueuePinger(ctx, lggr)
-	table := newRoutingTable([]hostAndTarget{})
 	r.NoError(err)
 	defer ticker.Stop()
 	srvFunc := func() error {
@@ -44,7 +43,6 @@ func TestHealthChecks(t *testing.T) {
 			cfg,
 			port,
 			pinger,
-			table,
 		)
 	}
 
diff --git a/scaler/queue_pinger_test.go b/scaler/queue_pinger_test.go
index 2e9582c..0b433c9 100644
--- a/scaler/queue_pinger_test.go
+++ b/scaler/queue_pinger_test.go
@@ -6,11 +6,12 @@ import (
 	"time"
 
 	"github.com/go-logr/logr"
-	"github.com/kedacore/http-add-on/pkg/k8s"
-	"github.com/kedacore/http-add-on/pkg/queue"
 	"github.com/stretchr/testify/require"
 	"golang.org/x/sync/errgroup"
 	v1 "k8s.io/api/core/v1"
+
+	"github.com/kedacore/http-add-on/pkg/k8s"
+	"github.com/kedacore/http-add-on/pkg/queue"
 )
 
 func TestCounts(t *testing.T) {
@@ -35,11 +36,10 @@ func TestCounts(t *testing.T) {
 
 	q := queue.NewMemory()
 	for host, count := range counts {
-		q.Resize(host, count)
+		r.NoError(q.Resize(host, count))
 	}
 
 	srv, srvURL, endpoints, err := startFakeQueueEndpointServer(
-		ns,
 		svcName,
 		q,
 		3,
@@ -65,14 +65,14 @@ func TestCounts(t *testing.T) {
 
 	// now update the queue, start the ticker, and ensure
 	// that counts are updated after the first tick
-	q.Resize("host1", 1)
-	q.Resize("host2", 2)
-	q.Resize("host3", 3)
-	q.Resize("host4", 4)
+	r.NoError(q.Resize("host1", 1))
+	r.NoError(q.Resize("host2", 2))
+	r.NoError(q.Resize("host3", 3))
+	r.NoError(q.Resize("host4", 4))
 	ticker := time.NewTicker(tickDur)
 	fakeCache := k8s.NewFakeDeploymentCache()
 	go func() {
-		pinger.start(ctx, ticker, fakeCache)
+		_ = pinger.start(ctx, ticker, fakeCache)
 	}()
 	// sleep to ensure we ticked and finished calling
 	// fetchAndSaveCounts
@@ -117,10 +117,10 @@ func TestFetchAndSaveCounts(t *testing.T) {
 	}
 	q := queue.NewMemory()
 	for host, count := range counts.Counts {
-		q.Resize(host, count)
+		r.NoError(q.Resize(host, count))
 	}
 	srv, srvURL, endpoints, err := startFakeQueueEndpointServer(
-		ns, svcName, q, numEndpoints,
+		svcName, q, numEndpoints,
 	)
 	r.NoError(err)
 	defer srv.Close()
@@ -181,7 +181,7 @@ func TestFetchCounts(t *testing.T) {
 		r.NoError(q.Resize(host, count))
 	}
 	srv, srvURL, endpoints, err := startFakeQueueEndpointServer(
-		ns, svcName, q, numEndpoints,
+		svcName, q, numEndpoints,
 	)
 	r.NoError(err)
 
@@ -218,7 +218,8 @@ func TestFetchCounts(t *testing.T) {
 }
 
 func TestMergeCountsWithRoutingTable(t *testing.T) {
-	for _, tc := range cases() {
+	r := require.New(t)
+	for _, tc := range cases(r) {
 		t.Run(tc.name, func(t *testing.T) {
 			ctx := context.Background()
 			grp, ctx := errgroup.WithContext(ctx)
diff --git a/tests/e2e-test.sh b/tests/e2e-test.sh
index cb0b19e..0c95d1f 100755
--- a/tests/e2e-test.sh
+++ b/tests/e2e-test.sh
@@ -11,7 +11,7 @@ function clear_resources(){
   helm uninstall keda --namespace keda --wait
 }
 
-function print_logs {   
+function print_logs {
   echo ">>> KEDA Operator log <<<"
   kubectl logs -n keda -l app=keda-operator --tail 5000
   printf "##############################################\n"