Repository: knative/pkg
Pull request #2650 (2022-11-22 19:24:13)

[release-1.7] gofmt with go1.19

knative-prow[bot]: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/knative/pkg/pull/2650#" title="Author self-approved">dprotaso</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=knative%2Fpkg).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/knative/pkg/blob/release-1.7/OWNERS)~~ [dprotaso]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
codecov[bot]: # [Codecov](https://codecov.io/gh/knative/pkg/pull/2650?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) Report
Base: **81.37**% // Head: **81.34**% // Decreases project coverage by **`-0.03%`** :warning:
> Coverage data is based on head [(`a9bdb82`)](https://codecov.io/gh/knative/pkg/pull/2650?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) compared to base [(`3b65316`)](https://codecov.io/gh/knative/pkg/commit/3b65316a103ef61cda23b3ded08e0574913da629?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative).
> Patch has no changes to coverable lines.

> :exclamation: Current head a9bdb82 differs from pull request most recent head 18f57b4. Consider uploading reports for the commit 18f57b4 to get more accurate results

<details><summary>Additional details and impacted files</summary>


```diff
@@               Coverage Diff               @@
##           release-1.7    #2650      +/-   ##
===============================================
- Coverage        81.37%   81.34%   -0.04%     
===============================================
  Files              162      162              
  Lines             9736     9736              
===============================================
- Hits              7923     7920       -3     
- Misses            1577     1579       +2     
- Partials           236      237       +1     
```


| [Impacted Files](https://codecov.io/gh/knative/pkg/pull/2650?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) | Coverage Δ | |
|---|---|---|
| [apis/duck/v1alpha1/legacy\_targetable\_types.go](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-YXBpcy9kdWNrL3YxYWxwaGExL2xlZ2FjeV90YXJnZXRhYmxlX3R5cGVzLmdv) | `100.00% <ø> (ø)` | |
| [apis/duck/verify.go](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-YXBpcy9kdWNrL3ZlcmlmeS5nbw==) | `100.00% <ø> (ø)` | |
| [apis/field\_error.go](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-YXBpcy9maWVsZF9lcnJvci5nbw==) | `95.58% <ø> (ø)` | |
| [configmap/store.go](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-Y29uZmlnbWFwL3N0b3JlLmdv) | `94.44% <ø> (ø)` | |
| [depcheck/depcheck.go](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-ZGVwY2hlY2svZGVwY2hlY2suZ28=) | `83.33% <ø> (ø)` | |
| [injection/injection.go](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-aW5qZWN0aW9uL2luamVjdGlvbi5nbw==) | `0.00% <ø> (ø)` | |
| [logging/object\_encoders.go](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-bG9nZ2luZy9vYmplY3RfZW5jb2RlcnMuZ28=) | `0.00% <ø> (ø)` | |
| [metrics/prometheus\_exporter.go](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-bWV0cmljcy9wcm9tZXRoZXVzX2V4cG9ydGVyLmdv) | `90.24% <ø> (ø)` | |
| [reconciler/retry.go](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cmVjb25jaWxlci9yZXRyeS5nbw==) | `100.00% <ø> (ø)` | |
| [tracing/opencensus.go](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-dHJhY2luZy9vcGVuY2Vuc3VzLmdv) | `48.11% <ø> (ø)` | |
| ... and [2 more](https://codecov.io/gh/knative/pkg/pull/2650/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative)

</details>

[:umbrella: View full report at Codecov](https://codecov.io/gh/knative/pkg/pull/2650?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative).

nader-ziada: /retest
nader-ziada: /lgtm

Patch:
diff --git a/.github/workflows/knative-boilerplate.yaml b/.github/workflows/knative-boilerplate.yaml
deleted file mode 100644
index 2a0b01ba4..000000000
--- a/.github/workflows/knative-boilerplate.yaml
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright 2020 The Knative Authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# 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.
-
-# This file is automagically synced here from github.com/knative-sandbox/.github
-# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten.
-
-name: Boilerplate
-
-on:
-  pull_request:
-    branches: [ 'main', 'master', 'release-*' ]
-
-jobs:
-
-  check:
-    name: Boilerplate Check
-    runs-on: ubuntu-latest
-    strategy:
-      fail-fast: false # Keep running if one leg fails.
-      matrix:
-        extension:
-        - go
-        - sh
-
-        # Map between extension and human-readable name.
-        include:
-        - extension: go
-          language: Go
-        - extension: sh
-          language: Bash
-
-    steps:
-
-      - name: Set up Go 1.17.x
-        uses: actions/setup-go@v2
-        with:
-          go-version: 1.17.x
-        id: go
-
-      - name: Check out code
-        uses: actions/checkout@v2
-
-      - name: Install Tools
-        run: |
-          TEMP_PATH="$(mktemp -d)"
-          cd $TEMP_PATH
-
-          echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog'
-          curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" 2>&1
-          echo '::endgroup::'
-
-          echo '::group:: Installing boilerplate-check ... https://github.com/mattmoor/boilerplate-check'
-          go install github.com/mattmoor/boilerplate-check/cmd/boilerplate-check@latest
-          echo '::endgroup::'
-
-          echo "${TEMP_PATH}" >> $GITHUB_PATH
-
-      - id: boilerplate_txt
-        uses: andstor/file-existence-action@v1
-        with:
-          files: ./hack/boilerplate/boilerplate.${{ matrix.extension }}.txt
-      - name: ${{ matrix.language }} license boilerplate
-        shell: bash
-        if: ${{ steps.boilerplate_txt.outputs.files_exists == 'true' }}
-        env:
-          REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
-        run: |
-          set -e
-          cd "${GITHUB_WORKSPACE}" || exit 1
-
-          echo '::group:: Running github.com/mattmoor/boilerplate-check for ${{ matrix.language }} with reviewdog 🐶 ...'
-          # Don't fail because of boilerplate-check
-          set +o pipefail
-          boilerplate-check check \
-            --boilerplate ./hack/boilerplate/boilerplate.${{ matrix.extension }}.txt \
-            --file-extension ${{ matrix.extension }} \
-            --exclude "(vendor|third_party)/" |
-          reviewdog -efm="%A%f:%l: %m" \
-                -efm="%C%.%#" \
-                -name="${{ matrix.language }} headers" \
-                -reporter="github-pr-check" \
-                -filter-mode="diff_context" \
-                -fail-on-error="true" \
-                -level="error"
-          echo '::endgroup::'
diff --git a/.github/workflows/knative-donotsubmit.yaml b/.github/workflows/knative-donotsubmit.yaml
deleted file mode 100644
index cec5c3077..000000000
--- a/.github/workflows/knative-donotsubmit.yaml
+++ /dev/null
@@ -1,61 +0,0 @@
-# Copyright 2020 The Knative Authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# 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.
-
-# This file is automagically synced here from github.com/knative-sandbox/.github
-# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten.
-
-name: Do Not Submit
-
-on:
-  pull_request:
-    branches: [ 'main', 'master', 'release-*' ]
-
-jobs:
-
-  donotsubmit:
-    name: Do Not Submit
-    runs-on: ubuntu-latest
-
-    steps:
-      - name: Check out code
-        uses: actions/checkout@v2
-
-      - name: Do Not Submit
-        shell: bash
-        env:
-          REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
-        run: |
-          set -e
-          cd "${GITHUB_WORKSPACE}" || exit 1
-
-          TEMP_PATH="$(mktemp -d)"
-          PATH="${TEMP_PATH}:$PATH"
-
-          echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog'
-          curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" 2>&1
-          echo '::endgroup::'
-
-          echo '::group:: Running DO NOT SUBMIT with reviewdog 🐶 ...'
-          # Don't fail because of grep
-          set +o pipefail
-          find . -type f -not -path './vendor/*' -not -path './third_party/*' -not -path './.git/*' -not -path './.github/workflows/*' |
-          xargs grep -n "DO NOT SUBMIT" |
-          reviewdog -efm="%f:%l:%m" \
-                -name="DO NOT SUBMIT" \
-                -reporter="github-pr-check" \
-                -filter-mode="added" \
-                -fail-on-error="true" \
-                -level="error"
-
-          echo '::endgroup::'
diff --git a/apis/duck/v1alpha1/legacy_targetable_types.go b/apis/duck/v1alpha1/legacy_targetable_types.go
index c8a32a735..09513ff03 100644
--- a/apis/duck/v1alpha1/legacy_targetable_types.go
+++ b/apis/duck/v1alpha1/legacy_targetable_types.go
@@ -33,7 +33,7 @@ import (
 // under Status rather than strings.
 // This is to support existing resources until they migrate.
 //
-// Do not use this for anything new, use Addressable
+// # Do not use this for anything new, use Addressable
 //
 // LegacyTargetable is the old schema for the addressable portion
 // of the payload
diff --git a/apis/duck/verify.go b/apis/duck/verify.go
index e3f5abab4..48675f93a 100644
--- a/apis/duck/verify.go
+++ b/apis/duck/verify.go
@@ -31,10 +31,10 @@ type Populatable = ducktypes.Populatable
 // the provided Implementable duck type.  It is expected that under the resource
 // definition implementing a particular "Fooable" that one would write:
 //
-//   type ConcreteResource struct { ... }
+//	type ConcreteResource struct { ... }
 //
-//   // Check that ConcreteResource properly implement Fooable.
-//   err := duck.VerifyType(&ConcreteResource{}, &something.Fooable{})
+//	// Check that ConcreteResource properly implement Fooable.
+//	err := duck.VerifyType(&ConcreteResource{}, &something.Fooable{})
 //
 // This will return an error if the duck typing is not satisfied.
 func VerifyType(instance interface{}, iface Implementable) error {
diff --git a/apis/field_error.go b/apis/field_error.go
index ddd4838af..d4773d4aa 100644
--- a/apis/field_error.go
+++ b/apis/field_error.go
@@ -83,11 +83,12 @@ var _ error = (*FieldError)(nil)
 
 // ViaField is used to propagate a validation error along a field access.
 // For example, if a type recursively validates its "spec" via:
-//   if err := foo.Spec.Validate(); err != nil {
-//     // Augment any field paths with the context that they were accessed
-//     // via "spec".
-//     return err.ViaField("spec")
-//   }
+//
+//	if err := foo.Spec.Validate(); err != nil {
+//	  // Augment any field paths with the context that they were accessed
+//	  // via "spec".
+//	  return err.ViaField("spec")
+//	}
 func (fe *FieldError) ViaField(prefix ...string) *FieldError {
 	if fe == nil {
 		return nil
@@ -114,11 +115,12 @@ func (fe *FieldError) ViaField(prefix ...string) *FieldError {
 
 // ViaIndex is used to attach an index to the next ViaField provided.
 // For example, if a type recursively validates a parameter that has a collection:
-//  for i, c := range spec.Collection {
-//    if err := doValidation(c); err != nil {
-//      return err.ViaIndex(i).ViaField("collection")
-//    }
-//  }
+//
+//	for i, c := range spec.Collection {
+//	  if err := doValidation(c); err != nil {
+//	    return err.ViaIndex(i).ViaField("collection")
+//	  }
+//	}
 func (fe *FieldError) ViaIndex(index int) *FieldError {
 	return fe.ViaField(asIndex(index))
 }
@@ -130,11 +132,12 @@ func (fe *FieldError) ViaFieldIndex(field string, index int) *FieldError {
 
 // ViaKey is used to attach a key to the next ViaField provided.
 // For example, if a type recursively validates a parameter that has a collection:
-//  for k, v := range spec.Bag {
-//    if err := doValidation(v); err != nil {
-//      return err.ViaKey(k).ViaField("bag")
-//    }
-//  }
+//
+//	for k, v := range spec.Bag {
+//	  if err := doValidation(v); err != nil {
+//	    return err.ViaKey(k).ViaField("bag")
+//	  }
+//	}
 func (fe *FieldError) ViaKey(key string) *FieldError {
 	return fe.ViaField(asKey(key))
 }
@@ -145,7 +148,8 @@ func (fe *FieldError) ViaFieldKey(field, key string) *FieldError {
 }
 
 // At is a way to alter the level of the diagnostics held in this FieldError.
-//    ErrMissingField("foo").At(WarningLevel)
+//
+//	ErrMissingField("foo").At(WarningLevel)
 func (fe *FieldError) At(l DiagnosticLevel) *FieldError {
 	if fe == nil {
 		return nil
@@ -166,9 +170,10 @@ func (fe *FieldError) At(l DiagnosticLevel) *FieldError {
 }
 
 // Filter is a way to access the set of diagnostics having a particular level.
-//    if err := x.Validate(ctx).Filter(ErrorLevel); err != nil {
-//       return err
-//    }
+//
+//	if err := x.Validate(ctx).Filter(ErrorLevel); err != nil {
+//	   return err
+//	}
 func (fe *FieldError) Filter(l DiagnosticLevel) *FieldError {
 	if fe == nil {
 		return nil
@@ -282,10 +287,11 @@ func asKey(key string) string {
 
 // flatten takes in a array of path components and looks for chances to flatten
 // objects that have index prefixes, examples:
-//   err([0]).ViaField(bar).ViaField(foo) -> foo.bar.[0] converts to foo.bar[0]
-//   err(bar).ViaIndex(0).ViaField(foo) -> foo.[0].bar converts to foo[0].bar
-//   err(bar).ViaField(foo).ViaIndex(0) -> [0].foo.bar converts to [0].foo.bar
-//   err(bar).ViaIndex(0).ViaIndex(1).ViaField(foo) -> foo.[1].[0].bar converts to foo[1][0].bar
+//
+//	err([0]).ViaField(bar).ViaField(foo) -> foo.bar.[0] converts to foo.bar[0]
+//	err(bar).ViaIndex(0).ViaField(foo) -> foo.[0].bar converts to foo[0].bar
+//	err(bar).ViaField(foo).ViaIndex(0) -> [0].foo.bar converts to [0].foo.bar
+//	err(bar).ViaIndex(0).ViaIndex(1).ViaField(foo) -> foo.[1].[0].bar converts to foo[1][0].bar
 func flatten(path []string) string {
 	var newPath []string
 	for _, part := range path {
diff --git a/codegen/cmd/injection-gen/generators/comment_parser.go b/codegen/cmd/injection-gen/generators/comment_parser.go
index 68ac8b4cb..4051e6a86 100644
--- a/codegen/cmd/injection-gen/generators/comment_parser.go
+++ b/codegen/cmd/injection-gen/generators/comment_parser.go
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
-    http://www.apache.org/licenses/LICENSE-2.0
+	http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
@@ -27,10 +27,10 @@ type CommentTag map[string][]string
 
 // ExtractCommentTags parses comments for lines of the form:
 //
-//   "marker" + "prefix" + ':' + "key=value,key2=value2".
+//	 "marker" + "prefix" + ':' + "key=value,key2=value2".
 //
-//  In the following example the marker is '+' and the prefix is 'foo':
-//   +foo:key=value1,key2=value2,key=value3
+//	In the following example the marker is '+' and the prefix is 'foo':
+//	 +foo:key=value1,key2=value2,key=value3
 //
 // Values are optional; empty map is the default. A tag can be specified more than
 // one time and all values are returned.  If the resulting map has an entry for
@@ -38,17 +38,19 @@ type CommentTag map[string][]string
 //
 // Example: if you pass "+" for 'marker', and the following lines are in
 // the comments:
-//   +foo:key=value1,key2=value2,key=value3
-//   +bar
+//
+//	+foo:key=value1,key2=value2,key=value3
+//	+bar
 //
 // Then this function will return:
-//   map[string]map[string]string{
-//     "foo":{
-//      "key":  []string{"value1", "value3"},
-//      "key2": []string{"value2"}
-//     },
-//     "bar": {},
-//  }
+//
+//	 map[string]map[string]string{
+//	   "foo":{
+//	    "key":  []string{"value1", "value3"},
+//	    "key2": []string{"value2"}
+//	   },
+//	   "bar": {},
+//	}
 //
 // Users are not expected to repeat values.
 func ExtractCommentTags(marker string, lines []string) CommentTags {
diff --git a/configmap/doc.go b/configmap/doc.go
index d861a3801..5e9ab8990 100644
--- a/configmap/doc.go
+++ b/configmap/doc.go
@@ -16,6 +16,6 @@ limitations under the License.
 
 // Package configmap exists to facilitate consuming Kubernetes ConfigMap
 // resources in various ways, including:
-//  - Watching them for changes over time, and
-//  - Loading them from a VolumeMount.
+//   - Watching them for changes over time, and
+//   - Loading them from a VolumeMount.
 package configmap
diff --git a/configmap/hash-gen/main.go b/configmap/hash-gen/main.go
index 5846167f9..a2b154d92 100644
--- a/configmap/hash-gen/main.go
+++ b/configmap/hash-gen/main.go
@@ -20,7 +20,6 @@ import (
 	"bytes"
 	"errors"
 	"fmt"
-	"io/ioutil"
 	"log"
 	"os"
 
@@ -39,7 +38,7 @@ func main() {
 // processFile reads the ConfigMap manifest from a file and adds or updates the label
 // containing the checksum of it's _example data if present.
 func processFile(fileName string) error {
-	in, err := ioutil.ReadFile(fileName)
+	in, err := os.ReadFile(fileName)
 	if err != nil {
 		return fmt.Errorf("failed to read file: %w", err)
 	}
@@ -50,7 +49,7 @@ func processFile(fileName string) error {
 	}
 
 	//nolint:gosec // This is not security critical so open permissions are fine.
-	if err := ioutil.WriteFile(fileName, out, 0644); err != nil {
+	if err := os.WriteFile(fileName, out, 0644); err != nil {
 		return fmt.Errorf("failed to write file: %w", err)
 	}
 	return nil
diff --git a/configmap/load.go b/configmap/load.go
index ee40fbf0c..56ad1e4ab 100644
--- a/configmap/load.go
+++ b/configmap/load.go
@@ -17,7 +17,6 @@ limitations under the License.
 package configmap
 
 import (
-	"io/ioutil"
 	"os"
 	"path"
 	"path/filepath"
@@ -47,7 +46,7 @@ func Load(p string) (map[string]string, error) {
 		if info.IsDir() {
 			return nil
 		}
-		b, err := ioutil.ReadFile(p)
+		b, err := os.ReadFile(p)
 		if err != nil {
 			return err
 		}
diff --git a/configmap/store.go b/configmap/store.go
index ffe9ad8c6..375a474c2 100644
--- a/configmap/store.go
+++ b/configmap/store.go
@@ -35,7 +35,7 @@ type Logger interface {
 // Constructors is a map for specifying configmap names to
 // their function constructors
 //
-// The values of this map must be functions with the definition
+// # The values of this map must be functions with the definition
 //
 // func(*k8s.io/api/core/v1.ConfigMap) (... , error)
 //
@@ -60,7 +60,7 @@ type UntypedStore struct {
 // NewUntypedStore creates an UntypedStore with given name,
 // Logger and Constructors
 //
-// The Logger must not be nil
+// # The Logger must not be nil
 //
 // The values in the Constructors map must be functions with
 // the definition
diff --git a/depcheck/depcheck.go b/depcheck/depcheck.go
index 034617451..98d0807b9 100644
--- a/depcheck/depcheck.go
+++ b/depcheck/depcheck.go
@@ -49,9 +49,11 @@ func (g graph) order() []string {
 }
 
 // path constructs an examplary path that looks something like:
-//    knative.dev/pkg/apis/duck
-//    knative.dev/pkg/apis  # Also: [knative.dev/pkg/kmeta knative.dev/pkg/tracker]
-//    k8s.io/api/core/v1
+//
+//	knative.dev/pkg/apis/duck
+//	knative.dev/pkg/apis  # Also: [knative.dev/pkg/kmeta knative.dev/pkg/tracker]
+//	k8s.io/api/core/v1
+//
 // See the failing example in the test file.
 func (g graph) path(name string) []string {
 	n := g[name]
diff --git a/go.mod b/go.mod
index ef30b683b..1b6fa3f3a 100644
--- a/go.mod
+++ b/go.mod
@@ -49,6 +49,7 @@ require (
 	k8s.io/code-generator v0.23.9
 	k8s.io/gengo v0.0.0-20220613173612-397b4ae3bce7
 	k8s.io/klog/v2 v2.70.2-0.20220707122935-0990e81f1a8f
+	k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
 	knative.dev/hack v0.0.0-20220815132133-e9a8475f4329
 	sigs.k8s.io/yaml v1.3.0
 )
@@ -102,7 +103,6 @@ require (
 	gopkg.in/inf.v0 v0.9.1 // indirect
 	gopkg.in/yaml.v2 v2.4.0 // indirect
 	k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
-	k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
 	sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
 	sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
 )
diff --git a/hash/doc.go b/hash/doc.go
index 8b849cd3e..5595336ad 100644
--- a/hash/doc.go
+++ b/hash/doc.go
@@ -16,12 +16,12 @@ limitations under the License.
 
 // Package hash contains various Knative specific hashing utilities.
 //
-// - ChooseSubset is a consistent hashing/mapping function providing
-//   a consistent selection of N keys from M (N<=M) keys for a given
-//   target.
-// - BucketSet is a bucketer library which uses ChooseSubset under the
-//   the hood in order to implement consistent mapping between keys and
-//   set of buckets, identified by unique names. Compared to basic bucket
-//   implementation which just does hash%num_buckets, when the number of
-//   buckets change only a small subset of keys are supposed to migrate.
+//   - ChooseSubset is a consistent hashing/mapping function providing
+//     a consistent selection of N keys from M (N<=M) keys for a given
+//     target.
+//   - BucketSet is a bucketer library which uses ChooseSubset under the
+//     the hood in order to implement consistent mapping between keys and
+//     set of buckets, identified by unique names. Compared to basic bucket
+//     implementation which just does hash%num_buckets, when the number of
+//     buckets change only a small subset of keys are supposed to migrate.
 package hash
diff --git a/injection/doc.go b/injection/doc.go
index db5495d81..960674dea 100644
--- a/injection/doc.go
+++ b/injection/doc.go
@@ -22,84 +22,84 @@ limitations under the License.
 // interesting.  The first is in the context of implementations of
 // `controller.Reconciler` being wrapped in a `*controller.Impl`:
 //
-//   import (
-//     // Simply linking this triggers the injection of the informer, which links
-//     // the factory triggering its injection, and which links the client,
-//     // triggering its injection.  All you need to know is that it works :)
-//     deployinformer "knative.dev/pkg/injection/informers/kubeinformers/appsv1/deployment"
-//     "knative.dev/pkg/injection"
-//   )
+//	import (
+//	  // Simply linking this triggers the injection of the informer, which links
+//	  // the factory triggering its injection, and which links the client,
+//	  // triggering its injection.  All you need to know is that it works :)
+//	  deployinformer "knative.dev/pkg/injection/informers/kubeinformers/appsv1/deployment"
+//	  "knative.dev/pkg/injection"
+//	)
 //
-//   func NewController(ctx context.Context) *controller.Impl {
-//     deploymentInformer := deployinformer.Get(ctx)
-//     // Pass deploymentInformer.Lister() to Reconciler
-//     ...
-//     // Set up events on deploymentInformer.Informer()
-//     ...
-//   }
+//	func NewController(ctx context.Context) *controller.Impl {
+//	  deploymentInformer := deployinformer.Get(ctx)
+//	  // Pass deploymentInformer.Lister() to Reconciler
+//	  ...
+//	  // Set up events on deploymentInformer.Informer()
+//	  ...
+//	}
 //
 // Then in `package main` the entire controller process can be set up via:
 //
-//   package main
+//	package main
 //
-//   import (
-//   	// The set of controllers this controller process runs.
-//      // Linking these will register their transitive dependencies, after
-//      // which the shared main can set up the rest.
-//   	"github.com/knative/foo/pkg/reconciler/matt"
-//   	"github.com/knative/foo/pkg/reconciler/scott"
-//   	"github.com/knative/foo/pkg/reconciler/ville"
-//   	"github.com/knative/foo/pkg/reconciler/dave"
+//	import (
+//		// The set of controllers this controller process runs.
+//	   // Linking these will register their transitive dependencies, after
+//	   // which the shared main can set up the rest.
+//		"github.com/knative/foo/pkg/reconciler/matt"
+//		"github.com/knative/foo/pkg/reconciler/scott"
+//		"github.com/knative/foo/pkg/reconciler/ville"
+//		"github.com/knative/foo/pkg/reconciler/dave"
 //
-//   	// This defines the shared main for injected controllers.
-//   	"knative.dev/pkg/injection/sharedmain"
-//   )
+//		// This defines the shared main for injected controllers.
+//		"knative.dev/pkg/injection/sharedmain"
+//	)
 //
-//   func main() {
-//   	sharedmain.Main("mycomponent",
-//         // We pass in the list of controllers to construct, and that's it!
-//         // If we forget to add this, go will complain about the unused import.
-//         matt.NewController,
-//         scott.NewController,
-//         ville.NewController,
-//         dave.NewController,
-//      )
-//   }
+//	func main() {
+//		sharedmain.Main("mycomponent",
+//	      // We pass in the list of controllers to construct, and that's it!
+//	      // If we forget to add this, go will complain about the unused import.
+//	      matt.NewController,
+//	      scott.NewController,
+//	      ville.NewController,
+//	      dave.NewController,
+//	   )
+//	}
 //
 // If you want to adapt the above to run the controller within a single
 // namespace, you can instead do something like:
 //
-//   package main
+//	package main
 //
-//   import (
-//   	// The set of controllers this controller process runs.
-//      // Linking these will register their transitive dependencies, after
-//      // which the shared main can set up the rest.
-//   	"github.com/knative/foo/pkg/reconciler/matt"
-//   	"github.com/knative/foo/pkg/reconciler/scott"
-//   	"github.com/knative/foo/pkg/reconciler/ville"
-//   	"github.com/knative/foo/pkg/reconciler/dave"
+//	import (
+//		// The set of controllers this controller process runs.
+//	   // Linking these will register their transitive dependencies, after
+//	   // which the shared main can set up the rest.
+//		"github.com/knative/foo/pkg/reconciler/matt"
+//		"github.com/knative/foo/pkg/reconciler/scott"
+//		"github.com/knative/foo/pkg/reconciler/ville"
+//		"github.com/knative/foo/pkg/reconciler/dave"
 //
-//   	// This defines the shared main for injected controllers.
-//   	"knative.dev/pkg/injection/sharedmain"
+//		// This defines the shared main for injected controllers.
+//		"knative.dev/pkg/injection/sharedmain"
 //
-//      // These are used to set up the context.
-//   	"knative.dev/pkg/injection"
-//   	"knative.dev/pkg/signals"
-//   )
+//	   // These are used to set up the context.
+//		"knative.dev/pkg/injection"
+//		"knative.dev/pkg/signals"
+//	)
 //
-//   func main() {
-//      // Scope the shared informer factories to the provided namespace.
-//      ctx := injection.WithNamespace(signals.NewContext(), "the-namespace")
+//	func main() {
+//	   // Scope the shared informer factories to the provided namespace.
+//	   ctx := injection.WithNamespace(signals.NewContext(), "the-namespace")
 //
-//      // Use our initial context when setting up the controllers.
-//   	sharedmain.MainWithContext(ctx, "mycomponent",
-//         // We pass in the list of controllers to construct, and that's it!
-//         // If we forget to add this, go will complain about the unused import.
-//         matt.NewController,
-//         scott.NewController,
-//         ville.NewController,
-//         dave.NewController,
-//      )
-//   }
+//	   // Use our initial context when setting up the controllers.
+//		sharedmain.MainWithContext(ctx, "mycomponent",
+//	      // We pass in the list of controllers to construct, and that's it!
+//	      // If we forget to add this, go will complain about the unused import.
+//	      matt.NewController,
+//	      scott.NewController,
+//	      ville.NewController,
+//	      dave.NewController,
+//	   )
+//	}
 package injection
diff --git a/injection/injection.go b/injection/injection.go
index d8cefc9fb..f06e06f17 100644
--- a/injection/injection.go
+++ b/injection/injection.go
@@ -34,9 +34,11 @@ import (
 //
 // Typical integration:
 // ```go
-//   ctx, startInformers := injection.EnableInjectionOrDie(signals.NewContext(), nil)
-//   ... start watches with informers, if required ...
-//   startInformers()
+//
+//	ctx, startInformers := injection.EnableInjectionOrDie(signals.NewContext(), nil)
+//	... start watches with informers, if required ...
+//	startInformers()
+//
 // ```
 func EnableInjectionOrDie(ctx context.Context, cfg *rest.Config) (context.Context, func()) {
 	if ctx == nil {
diff --git a/logging/object_encoders.go b/logging/object_encoders.go
index ee14737ce..9a30f8aab 100644
--- a/logging/object_encoders.go
+++ b/logging/object_encoders.go
@@ -29,9 +29,12 @@ import (
 
 // StringSet returns a marshaler for the set of strings.
 // To use this in sugared logger do:
+//
 //	logger.Infow("Revision State", zap.Object("healthy", logging.StringSet(healthySet)),
 //		zap.Object("unhealthy", logging.StringSet(unhealthySet)))
+//
 // To use with non-sugared logger do:
+//
 //	logger.Info("Revision State", zap.Object("healthy", logging.StringSet(healthySet)),
 //		zap.Object("unhealthy", logging.StringSet(unhealthySet)))
 func StringSet(s sets.String) zapcore.ObjectMarshalerFunc {
diff --git a/metrics/prometheus_exporter.go b/metrics/prometheus_exporter.go
index b5b39d9fc..621ffcbea 100644
--- a/metrics/prometheus_exporter.go
+++ b/metrics/prometheus_exporter.go
@@ -20,6 +20,7 @@ import (
 	"net/http"
 	"strconv"
 	"sync"
+	"time"
 
 	prom "contrib.go.opencensus.io/exporter/prometheus"
 	"go.opencensus.io/resource"
@@ -41,7 +42,7 @@ func (emptyPromExporter) ExportView(viewData *view.Data) {
 	// a signal to enrich the internal Meters with Resource information.
 }
 
-//nolint: unparam // False positive of flagging the second result of this function unused.
+// nolint: unparam // False positive of flagging the second result of this function unused.
 func newPrometheusExporter(config *metricsConfig, logger *zap.SugaredLogger) (view.Exporter, ResourceExporterFactory, error) {
 	e, err := prom.NewExporter(prom.Options{Namespace: config.component})
 	if err != nil {
@@ -82,9 +83,11 @@ func startNewPromSrv(e *prom.Exporter, host string, port int) *http.Server {
 	if curPromSrv != nil {
 		curPromSrv.Close()
 	}
+	//nolint:gosec
 	curPromSrv = &http.Server{
-		Addr:    host + ":" + strconv.Itoa(port),
-		Handler: sm,
+		Addr:              host + ":" + strconv.Itoa(port),
+		Handler:           sm,
+		ReadHeaderTimeout: 60 * time.Second,
 	}
 	return curPromSrv
 }
diff --git a/metrics/resource_view.go b/metrics/resource_view.go
index 236fd588b..69e4ab435 100644
--- a/metrics/resource_view.go
+++ b/metrics/resource_view.go
@@ -29,7 +29,7 @@ import (
 	"go.opencensus.io/stats"
 	"go.opencensus.io/stats/view"
 	"go.opencensus.io/tag"
-	"k8s.io/apimachinery/pkg/util/clock"
+	"k8s.io/utils/clock"
 )
 
 type storedViews struct {
@@ -53,7 +53,7 @@ type meters struct {
 	meters         map[string]*meterExporter
 	factory        ResourceExporterFactory
 	lock           sync.Mutex
-	clock          clock.Clock
+	clock          clock.WithTicker
 	ticker         clock.Ticker
 	tickerStopChan chan struct{}
 }
@@ -65,7 +65,7 @@ var (
 	resourceViews = storedViews{}
 	allMeters     = meters{
 		meters: map[string]*meterExporter{"": &defaultMeter},
-		clock:  clock.Clock(clock.RealClock{}),
+		clock:  clock.RealClock{},
 	}
 
 	cleanupOnce                = new(sync.Once)
diff --git a/network/error_handler.go b/network/error_handler.go
index 763766489..d0b6beedc 100644
--- a/network/error_handler.go
+++ b/network/error_handler.go
@@ -17,8 +17,8 @@ limitations under the License.
 package network
 
 import (
-	"io/ioutil"
 	"net/http"
+	"os"
 
 	"go.uber.org/zap"
 )
@@ -36,7 +36,7 @@ func ErrorHandler(logger *zap.SugaredLogger) func(http.ResponseWriter, *http.Req
 }
 
 func readSockStat(logger *zap.SugaredLogger) string {
-	b, err := ioutil.ReadFile("/proc/net/sockstat")
+	b, err := os.ReadFile("/proc/net/sockstat")
 	if err != nil {
 		logger.Errorw("Unable to read sockstat", zap.Error(err))
 		return ""
diff --git a/network/h2c.go b/network/h2c.go
index 6cc0fa733..b8f2d8c26 100644
--- a/network/h2c.go
+++ b/network/h2c.go
@@ -28,6 +28,7 @@ import (
 
 // NewServer returns a new HTTP Server with HTTP2 handler.
 func NewServer(addr string, h http.Handler) *http.Server {
+	//nolint:gosec // https://github.com/knative/pkg/issues/2632
 	h1s := &http.Server{
 		Addr:    addr,
 		Handler: h2c.NewHandler(h, &http2.Server{}),
diff --git a/network/handlers/error.go b/network/handlers/error.go
index e45d2fa03..fd3b1c1b2 100644
--- a/network/handlers/error.go
+++ b/network/handlers/error.go
@@ -20,5 +20,6 @@ import "knative.dev/pkg/network"
 
 // Error sets up a handler suitable for use with the ErrorHandler field on
 // httputil's reverse proxy, which logs /proc/net/sockstat data.
+//
 //nolint:staticcheck // We actually want to mirror this.
 var Error = network.ErrorHandler
diff --git a/profiling/server.go b/profiling/server.go
index 9d61c0981..526385f05 100644
--- a/profiling/server.go
+++ b/profiling/server.go
@@ -110,6 +110,7 @@ func NewServer(handler http.Handler) *http.Server {
 		port = strconv.Itoa(ProfilingPort)
 	}
 
+	//nolint:gosec // https://github.com/knative/pkg/issues/2632
 	return &http.Server{
 		Addr:    ":" + port,
 		Handler: handler,
diff --git a/reconciler/retry.go b/reconciler/retry.go
index 1a50406b1..2c6cfd612 100644
--- a/reconciler/retry.go
+++ b/reconciler/retry.go
@@ -5,7 +5,7 @@ Licensed under the Apache License, Veroute.on 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
-    http://www.apache.org/licenses/LICENSE-2.0
+	http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/tracing/opencensus.go b/tracing/opencensus.go
index 7471c1336..69019d267 100644
--- a/tracing/opencensus.go
+++ b/tracing/opencensus.go
@@ -147,8 +147,9 @@ func WithExporter(name string, logger *zap.SugaredLogger) ConfigOption {
 // The host arg is used for a value of tag ip="{IP}" so you can use an actual IP. Otherwise,
 // the host name must be able to be resolved.
 // e.g)
-//   "name" is a service name like activator-service.
-//   "host" is a endpoint IP like activator-service's endpoint IP.
+//
+//	"name" is a service name like activator-service.
+//	"host" is a endpoint IP like activator-service's endpoint IP.
 func WithExporterFull(name, host string, logger *zap.SugaredLogger) ConfigOption {
 	return func(cfg *config.Config) error {
 		var (
diff --git a/tracing/zipkin.go b/tracing/zipkin.go
index ab94386ff..b124a20d1 100644
--- a/tracing/zipkin.go
+++ b/tracing/zipkin.go
@@ -31,8 +31,8 @@ type ZipkinReporterFactory func(*config.Config) (zipkinreporter.Reporter, error)
 // WithZipkinExporter returns a config with zipkin enabled.
 //
 // Deprecated: This function is the legacy entrypoint and should be replaced with one of:
-//  - WithExporter() in production code
-//  - testing/FakeZipkinExporter() in test code.
+//   - WithExporter() in production code
+//   - testing/FakeZipkinExporter() in test code.
 func WithZipkinExporter(reporterFact ZipkinReporterFactory, endpoint *zipkinmodel.Endpoint) ConfigOption {
 	return func(cfg *config.Config) error {
 		var (
diff --git a/vendor/k8s.io/apimachinery/pkg/util/clock/clock.go b/vendor/k8s.io/apimachinery/pkg/util/clock/clock.go
deleted file mode 100644
index 1a544d3b2..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/clock/clock.go
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-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.
-*/
-
-package clock
-
-import (
-	"sync"
-	"time"
-)
-
-// PassiveClock allows for injecting fake or real clocks into code
-// that needs to read the current time but does not support scheduling
-// activity in the future.
-type PassiveClock interface {
-	Now() time.Time
-	Since(time.Time) time.Duration
-}
-
-// Clock allows for injecting fake or real clocks into code that
-// needs to do arbitrary things based on time.
-type Clock interface {
-	PassiveClock
-	After(time.Duration) <-chan time.Time
-	AfterFunc(time.Duration, func()) Timer
-	NewTimer(time.Duration) Timer
-	Sleep(time.Duration)
-	NewTicker(time.Duration) Ticker
-}
-
-// RealClock really calls time.Now()
-type RealClock struct{}
-
-// Now returns the current time.
-func (RealClock) Now() time.Time {
-	return time.Now()
-}
-
-// Since returns time since the specified timestamp.
-func (RealClock) Since(ts time.Time) time.Duration {
-	return time.Since(ts)
-}
-
-// After is the same as time.After(d).
-func (RealClock) After(d time.Duration) <-chan time.Time {
-	return time.After(d)
-}
-
-// AfterFunc is the same as time.AfterFunc(d, f).
-func (RealClock) AfterFunc(d time.Duration, f func()) Timer {
-	return &realTimer{
-		timer: time.AfterFunc(d, f),
-	}
-}
-
-// NewTimer returns a new Timer.
-func (RealClock) NewTimer(d time.Duration) Timer {
-	return &realTimer{
-		timer: time.NewTimer(d),
-	}
-}
-
-// NewTicker returns a new Ticker.
-func (RealClock) NewTicker(d time.Duration) Ticker {
-	return &realTicker{
-		ticker: time.NewTicker(d),
-	}
-}
-
-// Sleep pauses the RealClock for duration d.
-func (RealClock) Sleep(d time.Duration) {
-	time.Sleep(d)
-}
-
-// FakePassiveClock implements PassiveClock, but returns an arbitrary time.
-type FakePassiveClock struct {
-	lock sync.RWMutex
-	time time.Time
-}
-
-// FakeClock implements Clock, but returns an arbitrary time.
-type FakeClock struct {
-	FakePassiveClock
-
-	// waiters are waiting for the fake time to pass their specified time
-	waiters []fakeClockWaiter
-}
-
-type fakeClockWaiter struct {
-	targetTime    time.Time
-	stepInterval  time.Duration
-	skipIfBlocked bool
-	destChan      chan time.Time
-	afterFunc     func()
-}
-
-// NewFakePassiveClock returns a new FakePassiveClock.
-func NewFakePassiveClock(t time.Time) *FakePassiveClock {
-	return &FakePassiveClock{
-		time: t,
-	}
-}
-
-// NewFakeClock returns a new FakeClock
-func NewFakeClock(t time.Time) *FakeClock {
-	return &FakeClock{
-		FakePassiveClock: *NewFakePassiveClock(t),
-	}
-}
-
-// Now returns f's time.
-func (f *FakePassiveClock) Now() time.Time {
-	f.lock.RLock()
-	defer f.lock.RUnlock()
-	return f.time
-}
-
-// Since returns time since the time in f.
-func (f *FakePassiveClock) Since(ts time.Time) time.Duration {
-	f.lock.RLock()
-	defer f.lock.RUnlock()
-	return f.time.Sub(ts)
-}
-
-// SetTime sets the time on the FakePassiveClock.
-func (f *FakePassiveClock) SetTime(t time.Time) {
-	f.lock.Lock()
-	defer f.lock.Unlock()
-	f.time = t
-}
-
-// After is the Fake version of time.After(d).
-func (f *FakeClock) After(d time.Duration) <-chan time.Time {
-	f.lock.Lock()
-	defer f.lock.Unlock()
-	stopTime := f.time.Add(d)
-	ch := make(chan time.Time, 1) // Don't block!
-	f.waiters = append(f.waiters, fakeClockWaiter{
-		targetTime: stopTime,
-		destChan:   ch,
-	})
-	return ch
-}
-
-// AfterFunc is the Fake version of time.AfterFunc(d, callback).
-func (f *FakeClock) AfterFunc(d time.Duration, cb func()) Timer {
-	f.lock.Lock()
-	defer f.lock.Unlock()
-	stopTime := f.time.Add(d)
-	ch := make(chan time.Time, 1) // Don't block!
-
-	timer := &fakeTimer{
-		fakeClock: f,
-		waiter: fakeClockWaiter{
-			targetTime: stopTime,
-			destChan:   ch,
-			afterFunc:  cb,
-		},
-	}
-	f.waiters = append(f.waiters, timer.waiter)
-	return timer
-}
-
-// NewTimer is the Fake version of time.NewTimer(d).
-func (f *FakeClock) NewTimer(d time.Duration) Timer {
-	f.lock.Lock()
-	defer f.lock.Unlock()
-	stopTime := f.time.Add(d)
-	ch := make(chan time.Time, 1) // Don't block!
-	timer := &fakeTimer{
-		fakeClock: f,
-		waiter: fakeClockWaiter{
-			targetTime: stopTime,
-			destChan:   ch,
-		},
-	}
-	f.waiters = append(f.waiters, timer.waiter)
-	return timer
-}
-
-// NewTicker returns a new Ticker.
-func (f *FakeClock) NewTicker(d time.Duration) Ticker {
-	f.lock.Lock()
-	defer f.lock.Unlock()
-	tickTime := f.time.Add(d)
-	ch := make(chan time.Time, 1) // hold one tick
-	f.waiters = append(f.waiters, fakeClockWaiter{
-		targetTime:    tickTime,
-		stepInterval:  d,
-		skipIfBlocked: true,
-		destChan:      ch,
-	})
-
-	return &fakeTicker{
-		c: ch,
-	}
-}
-
-// Step moves clock by Duration, notifies anyone that's called After, Tick, or NewTimer
-func (f *FakeClock) Step(d time.Duration) {
-	f.lock.Lock()
-	defer f.lock.Unlock()
-	f.setTimeLocked(f.time.Add(d))
-}
-
-// SetTime sets the time on a FakeClock.
-func (f *FakeClock) SetTime(t time.Time) {
-	f.lock.Lock()
-	defer f.lock.Unlock()
-	f.setTimeLocked(t)
-}
-
-// Actually changes the time and checks any waiters. f must be write-locked.
-func (f *FakeClock) setTimeLocked(t time.Time) {
-	f.time = t
-	newWaiters := make([]fakeClockWaiter, 0, len(f.waiters))
-	for i := range f.waiters {
-		w := &f.waiters[i]
-		if !w.targetTime.After(t) {
-
-			if w.skipIfBlocked {
-				select {
-				case w.destChan <- t:
-				default:
-				}
-			} else {
-				w.destChan <- t
-			}
-
-			if w.afterFunc != nil {
-				w.afterFunc()
-			}
-
-			if w.stepInterval > 0 {
-				for !w.targetTime.After(t) {
-					w.targetTime = w.targetTime.Add(w.stepInterval)
-				}
-				newWaiters = append(newWaiters, *w)
-			}
-
-		} else {
-			newWaiters = append(newWaiters, f.waiters[i])
-		}
-	}
-	f.waiters = newWaiters
-}
-
-// HasWaiters returns true if After or AfterFunc has been called on f but not yet satisfied
-// (so you can write race-free tests).
-func (f *FakeClock) HasWaiters() bool {
-	f.lock.RLock()
-	defer f.lock.RUnlock()
-	return len(f.waiters) > 0
-}
-
-// Sleep pauses the FakeClock for duration d.
-func (f *FakeClock) Sleep(d time.Duration) {
-	f.Step(d)
-}
-
-// IntervalClock implements Clock, but each invocation of Now steps the clock forward the specified duration
-type IntervalClock struct {
-	Time     time.Time
-	Duration time.Duration
-}
-
-// Now returns i's time.
-func (i *IntervalClock) Now() time.Time {
-	i.Time = i.Time.Add(i.Duration)
-	return i.Time
-}
-
-// Since returns time since the time in i.
-func (i *IntervalClock) Since(ts time.Time) time.Duration {
-	return i.Time.Sub(ts)
-}
-
-// After is currently unimplemented, will panic.
-// TODO: make interval clock use FakeClock so this can be implemented.
-func (*IntervalClock) After(d time.Duration) <-chan time.Time {
-	panic("IntervalClock doesn't implement After")
-}
-
-// AfterFunc is currently unimplemented, will panic.
-// TODO: make interval clock use FakeClock so this can be implemented.
-func (*IntervalClock) AfterFunc(d time.Duration, cb func()) Timer {
-	panic("IntervalClock doesn't implement AfterFunc")
-}
-
-// NewTimer is currently unimplemented, will panic.
-// TODO: make interval clock use FakeClock so this can be implemented.
-func (*IntervalClock) NewTimer(d time.Duration) Timer {
-	panic("IntervalClock doesn't implement NewTimer")
-}
-
-// NewTicker is currently unimplemented, will panic.
-// TODO: make interval clock use FakeClock so this can be implemented.
-func (*IntervalClock) NewTicker(d time.Duration) Ticker {
-	panic("IntervalClock doesn't implement NewTicker")
-}
-
-// Sleep is currently unimplemented; will panic.
-func (*IntervalClock) Sleep(d time.Duration) {
-	panic("IntervalClock doesn't implement Sleep")
-}
-
-// Timer allows for injecting fake or real timers into code that
-// needs to do arbitrary things based on time.
-type Timer interface {
-	C() <-chan time.Time
-	Stop() bool
-	Reset(d time.Duration) bool
-}
-
-// realTimer is backed by an actual time.Timer.
-type realTimer struct {
-	timer *time.Timer
-}
-
-// C returns the underlying timer's channel.
-func (r *realTimer) C() <-chan time.Time {
-	return r.timer.C
-}
-
-// Stop calls Stop() on the underlying timer.
-func (r *realTimer) Stop() bool {
-	return r.timer.Stop()
-}
-
-// Reset calls Reset() on the underlying timer.
-func (r *realTimer) Reset(d time.Duration) bool {
-	return r.timer.Reset(d)
-}
-
-// fakeTimer implements Timer based on a FakeClock.
-type fakeTimer struct {
-	fakeClock *FakeClock
-	waiter    fakeClockWaiter
-}
-
-// C returns the channel that notifies when this timer has fired.
-func (f *fakeTimer) C() <-chan time.Time {
-	return f.waiter.destChan
-}
-
-// Stop conditionally stops the timer.  If the timer has neither fired
-// nor been stopped then this call stops the timer and returns true,
-// otherwise this call returns false.  This is like time.Timer::Stop.
-func (f *fakeTimer) Stop() bool {
-	f.fakeClock.lock.Lock()
-	defer f.fakeClock.lock.Unlock()
-	// The timer has already fired or been stopped, unless it is found
-	// among the clock's waiters.
-	stopped := false
-	oldWaiters := f.fakeClock.waiters
-	newWaiters := make([]fakeClockWaiter, 0, len(oldWaiters))
-	seekChan := f.waiter.destChan
-	for i := range oldWaiters {
-		// Identify the timer's fakeClockWaiter by the identity of the
-		// destination channel, nothing else is necessarily unique and
-		// constant since the timer's creation.
-		if oldWaiters[i].destChan == seekChan {
-			stopped = true
-		} else {
-			newWaiters = append(newWaiters, oldWaiters[i])
-		}
-	}
-
-	f.fakeClock.waiters = newWaiters
-
-	return stopped
-}
-
-// Reset conditionally updates the firing time of the timer.  If the
-// timer has neither fired nor been stopped then this call resets the
-// timer to the fake clock's "now" + d and returns true, otherwise
-// it creates a new waiter, adds it to the clock, and returns true.
-//
-// It is not possible to return false, because a fake timer can be reset
-// from any state (waiting to fire, already fired, and stopped).
-//
-// See the GoDoc for time.Timer::Reset for more context on why
-// the return value of Reset() is not useful.
-func (f *fakeTimer) Reset(d time.Duration) bool {
-	f.fakeClock.lock.Lock()
-	defer f.fakeClock.lock.Unlock()
-	waiters := f.fakeClock.waiters
-	seekChan := f.waiter.destChan
-	for i := range waiters {
-		if waiters[i].destChan == seekChan {
-			waiters[i].targetTime = f.fakeClock.time.Add(d)
-			return true
-		}
-	}
-	// No existing waiter, timer has already fired or been reset.
-	// We should still enable Reset() to succeed by creating a
-	// new waiter and adding it to the clock's waiters.
-	newWaiter := fakeClockWaiter{
-		targetTime: f.fakeClock.time.Add(d),
-		destChan:   seekChan,
-	}
-	f.fakeClock.waiters = append(f.fakeClock.waiters, newWaiter)
-	return true
-}
-
-// Ticker defines the Ticker interface
-type Ticker interface {
-	C() <-chan time.Time
-	Stop()
-}
-
-type realTicker struct {
-	ticker *time.Ticker
-}
-
-func (t *realTicker) C() <-chan time.Time {
-	return t.ticker.C
-}
-
-func (t *realTicker) Stop() {
-	t.ticker.Stop()
-}
-
-type fakeTicker struct {
-	c <-chan time.Time
-}
-
-func (t *fakeTicker) C() <-chan time.Time {
-	return t.c
-}
-
-func (t *fakeTicker) Stop() {
-}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 065c883af..d3abee7d5 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -715,7 +715,6 @@ k8s.io/apimachinery/pkg/runtime/serializer/versioning
 k8s.io/apimachinery/pkg/selection
 k8s.io/apimachinery/pkg/types
 k8s.io/apimachinery/pkg/util/cache
-k8s.io/apimachinery/pkg/util/clock
 k8s.io/apimachinery/pkg/util/diff
 k8s.io/apimachinery/pkg/util/errors
 k8s.io/apimachinery/pkg/util/framer
diff --git a/webhook/psbinding/doc.go b/webhook/psbinding/doc.go
index 70944d0a6..26a59417b 100644
--- a/webhook/psbinding/doc.go
+++ b/webhook/psbinding/doc.go
@@ -17,11 +17,11 @@ limitations under the License.
 // Package psbinding provides facilities to make authoring Bindings that
 // work with "Pod Spec"-able subjects easier.  There are two key components
 //  1. The AdmissionController, which lives in psbinding.go (controller.go)
-//    sets it up.
+//     sets it up.
 //  2. The BaseReconciler, which lives in reconciler.go and can either be
-//    used directly as a Reconciler, or it can be wrapped as a base
-//    implementation for a customized reconciler that wants to take advantage
-//    of its facilities (e.g. for updating status and manipulating finalizers).
+//     used directly as a Reconciler, or it can be wrapped as a base
+//     implementation for a customized reconciler that wants to take advantage
+//     of its facilities (e.g. for updating status and manipulating finalizers).
 //
 // The core concept to consuming psbinding is the Bindable interface.  By
 // implementing Bindable on your binding resource, you enable the BaseReconciler
@@ -31,7 +31,9 @@ limitations under the License.
 // "mutation" methods carry the business logic for the "Pod Spec"-able binding.
 //
 // The mutation methods have the signature:
-//    func(context.Context, *v1alpha1.WithPod)
+//
+//	func(context.Context, *v1alpha1.WithPod)
+//
 // These methods are called to have the Binding perform its mutation on the
 // supplied WithPod (our "Pod Spec"-able wrapper type).  However, in some
 // cases the binding may need additional context.  Similar to apis.Validatable
diff --git a/webhook/webhook.go b/webhook/webhook.go
index ffb806ee0..ff5533bce 100644
--- a/webhook/webhook.go
+++ b/webhook/webhook.go
@@ -208,6 +208,7 @@ func (wh *Webhook) Run(stop <-chan struct{}) error {
 		QuietPeriod: wh.Options.GracePeriod,
 	}
 
+	//nolint:gosec // https://github.com/knative/pkg/issues/2632
 	server := &http.Server{
 		Handler:   drainer,
 		Addr:      fmt.Sprint(":", wh.Options.Port),
diff --git a/websocket/connection.go b/websocket/connection.go
index 601ee951d..6aa1e6109 100644
--- a/websocket/connection.go
+++ b/websocket/connection.go
@@ -22,7 +22,6 @@ import (
 	"errors"
 	"fmt"
 	"io"
-	"io/ioutil"
 	"net/http/httputil"
 	"sync"
 	"time"
@@ -302,7 +301,7 @@ func (c *ManagedConnection) read() error {
 	// and if that channel is set.
 	// TODO(markusthoemmes): Return the messageType along with the payload.
 	if c.messageChan != nil && (messageType == websocket.TextMessage || messageType == websocket.BinaryMessage) {
-		if message, _ := ioutil.ReadAll(reader); message != nil {
+		if message, _ := io.ReadAll(reader); message != nil {
 			c.messageChan <- message
 		}
 	}


Test patch:
diff --git a/apis/testing/fuzzer/fuzzer.go b/apis/testing/fuzzer/fuzzer.go
index ab7b71536..412ff195a 100644
--- a/apis/testing/fuzzer/fuzzer.go
+++ b/apis/testing/fuzzer/fuzzer.go
@@ -54,16 +54,16 @@ var Funcs = fuzzer.MergeFuzzerFuncs(
 // Consumers should initialize their conditions prior to fuzzing them.
 // For example:
 //
-// func(s *SomeStatus, c fuzz.Continue) {
-//   c.FuzzNoCustom(s) // fuzz the status object
+//	func(s *SomeStatus, c fuzz.Continue) {
+//	  c.FuzzNoCustom(s) // fuzz the status object
 //
-//   // Clear the random fuzzed condition
-//   s.Status.SetConditions(nil)
+//	  // Clear the random fuzzed condition
+//	  s.Status.SetConditions(nil)
 //
-//   // Fuzz the known conditions except their type value
-//   s.InitializeConditions()
-//   fuzz.Conditions(&s.Status, c)
-// }
+//	  // Fuzz the known conditions except their type value
+//	  s.InitializeConditions()
+//	  fuzz.Conditions(&s.Status, c)
+//	}
 func FuzzConditions(accessor apis.ConditionsAccessor, c fuzz.Continue) {
 	conds := accessor.GetConditions()
 	for i, cond := range conds {
diff --git a/apis/testing/roundtrip/roundtrip.go b/apis/testing/roundtrip/roundtrip.go
index ed4fc02d8..afb4bee49 100644
--- a/apis/testing/roundtrip/roundtrip.go
+++ b/apis/testing/roundtrip/roundtrip.go
@@ -87,8 +87,7 @@ func init() {
 // ExternalTypesViaJSON applies the round-trip test to all external round-trippable Kinds
 // in the scheme. This is effectively testing the scenario:
 //
-//    external -> json -> external
-//
+//	external -> json -> external
 func ExternalTypesViaJSON(t *testing.T, scheme *runtime.Scheme, fuzzerFuncs fuzzer.FuzzerFuncs) {
 	codecFactory := serializer.NewCodecFactory(scheme)
 
@@ -114,8 +113,7 @@ func ExternalTypesViaJSON(t *testing.T, scheme *runtime.Scheme, fuzzerFuncs fuzz
 // ExternalTypesViaHub applies the round-trip test to all external round-trippable Kinds
 // in the scheme. This is effectively testing the scenario:
 //
-//    external version -> hub version -> external version
-//
+//	external version -> hub version -> external version
 func ExternalTypesViaHub(t *testing.T, scheme, hubs *runtime.Scheme, fuzzerFuncs fuzzer.FuzzerFuncs) {
 	f := fuzzer.FuzzerFor(
 		fuzzer.MergeFuzzerFuncs(metafuzzer.Funcs, fuzzerFuncs),
diff --git a/apis/url_test.go b/apis/url_test.go
index 56966384f..3d9c0df60 100644
--- a/apis/url_test.go
+++ b/apis/url_test.go
@@ -1,5 +1,5 @@
 /*
-Copyright 2019 The Knative Authors
+Copyright 2022 The Knative Authors
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@ 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.
 */
+
 package apis
 
 import (
diff --git a/codegen/cmd/injection-gen/generators/comment_parser_test.go b/codegen/cmd/injection-gen/generators/comment_parser_test.go
index bbe5fab45..2915f9fbf 100644
--- a/codegen/cmd/injection-gen/generators/comment_parser_test.go
+++ b/codegen/cmd/injection-gen/generators/comment_parser_test.go
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
-    http://www.apache.org/licenses/LICENSE-2.0
+	http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/configmap/example_test.go b/configmap/example_test.go
index 3a22538ea..aef50afa7 100644
--- a/configmap/example_test.go
+++ b/configmap/example_test.go
@@ -38,7 +38,7 @@ func TestChecksum(t *testing.T) {
 		in:   "1",
 		want: "83dcefb7",
 	}, {
-		in: "   a somewhat longer test			",
+		in:   "   a somewhat longer test			",
 		want: "fefe6f72",
 	}, {
 		in:   "a somewhat longer test",
diff --git a/configmap/hash-gen/main_test.go b/configmap/hash-gen/main_test.go
index ffac0bc6d..7dcaba8cf 100644
--- a/configmap/hash-gen/main_test.go
+++ b/configmap/hash-gen/main_test.go
@@ -17,7 +17,6 @@ limitations under the License.
 package main
 
 import (
-	"io/ioutil"
 	"os"
 	"path"
 	"testing"
@@ -28,7 +27,7 @@ import (
 func TestProcess(t *testing.T) {
 	for _, test := range []string{"add", "update", "nothing"} {
 		t.Run(test, func(t *testing.T) {
-			in, err := ioutil.ReadFile(path.Join("testdata", test+".yaml"))
+			in, err := os.ReadFile(path.Join("testdata", test+".yaml"))
 			if err != nil {
 				t.Fatal("Failed to load test fixture:", err)
 			}
@@ -38,7 +37,7 @@ func TestProcess(t *testing.T) {
 				t.Fatal("Expected no error but got", err)
 			}
 
-			want, err := ioutil.ReadFile(path.Join("testdata", test+"_want.yaml"))
+			want, err := os.ReadFile(path.Join("testdata", test+"_want.yaml"))
 			if err != nil && !os.IsNotExist(err) {
 				t.Fatal("Failed to load test fixture:", err)
 			}
diff --git a/configmap/load_test.go b/configmap/load_test.go
index 313868457..0516b437e 100644
--- a/configmap/load_test.go
+++ b/configmap/load_test.go
@@ -18,7 +18,6 @@ package configmap
 
 import (
 	"fmt"
-	"io/ioutil"
 	"os"
 	"path"
 	"testing"
@@ -33,7 +32,7 @@ func TestLoad(t *testing.T) {
 		"a.b.c":  "blah",
 		".z.y.x": "hidden!",
 	}
-	tmpdir, err := ioutil.TempDir("", "")
+	tmpdir, err := os.MkdirTemp("", "")
 	if err != nil {
 		t.Fatal("TempDir() =", err)
 	}
@@ -60,7 +59,7 @@ func TestLoad(t *testing.T) {
 	// Write out the files as they should be loaded.
 	for k, v := range want {
 		// Write the actual file to $/.{timestamp}/key
-		if err := ioutil.WriteFile(path.Join(tsDir, k), []byte(v), 0644); err != nil {
+		if err := os.WriteFile(path.Join(tsDir, k), []byte(v), 0644); err != nil {
 			t.Fatalf("WriteFile(..{ts}/%s) = %v", k, err)
 		}
 		// Symlink $/key => $/..data/key
@@ -91,7 +90,7 @@ func TestLoadError(t *testing.T) {
 // 		"a.b.c":  "blah",
 // 		".z.y.x": "hidden!",
 // 	}
-// 	tmpdir, err := ioutil.TempDir("", "")
+// 	tmpdir, err := os.MkdirTemp("", "")
 // 	if err != nil {
 // 		t.Fatal("TempDir() =", err)
 // 	}
@@ -99,7 +98,7 @@ func TestLoadError(t *testing.T) {
 
 // 	// Write out the files as write-only, so we fail reading.
 // 	for k, v := range written {
-// 		err := ioutil.WriteFile(path.Join(tmpdir, k), []byte(v), 0200)
+// 		err := os.WriteFile(path.Join(tmpdir, k), []byte(v), 0200)
 // 		if err != nil {
 // 			t.Fatalf("WriteFile(%q) = %v", k, err)
 // 		}
@@ -111,7 +110,7 @@ func TestLoadError(t *testing.T) {
 // }
 
 func TestReadSymlinkedFileError(t *testing.T) {
-	tmpdir, err := ioutil.TempDir("", "")
+	tmpdir, err := os.MkdirTemp("", "")
 	if err != nil {
 		t.Fatal("TempDir() =", err)
 	}
diff --git a/configmap/testing/configmap.go b/configmap/testing/configmap.go
index 909036892..58cf9a21b 100644
--- a/configmap/testing/configmap.go
+++ b/configmap/testing/configmap.go
@@ -18,7 +18,7 @@ package testing
 
 import (
 	"fmt"
-	"io/ioutil"
+	"os"
 	"strings"
 	"testing"
 	"unicode"
@@ -45,7 +45,7 @@ func ConfigMapFromTestFile(t testing.TB, name string, allowed ...string) *corev1
 func ConfigMapsFromTestFile(t testing.TB, name string, allowed ...string) (*corev1.ConfigMap, *corev1.ConfigMap) {
 	t.Helper()
 
-	b, err := ioutil.ReadFile(fmt.Sprintf("testdata/%s.yaml", name))
+	b, err := os.ReadFile(fmt.Sprintf("testdata/%s.yaml", name))
 	if err != nil {
 		t.Fatal("ReadFile() =", err)
 	}
diff --git a/metrics/client_test.go b/metrics/client_test.go
index ba6de4557..9ad2ac958 100644
--- a/metrics/client_test.go
+++ b/metrics/client_test.go
@@ -18,7 +18,7 @@ package metrics
 
 import (
 	"bytes"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"net/url"
 	"testing"
@@ -96,7 +96,7 @@ func TestClientMetrics(t *testing.T) {
 	stub := ClientFunc(func(req *http.Request) (*http.Response, error) {
 		return &http.Response{
 			StatusCode: http.StatusOK,
-			Body:       ioutil.NopCloser(bytes.NewBufferString("hi")),
+			Body:       io.NopCloser(bytes.NewBufferString("hi")),
 		}, nil
 	})
 
diff --git a/metrics/config_test.go b/metrics/config_test.go
index ce7d0a733..b9056651e 100644
--- a/metrics/config_test.go
+++ b/metrics/config_test.go
@@ -13,6 +13,7 @@ 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.
 */
+
 package metrics
 
 import (
diff --git a/metrics/e2e_test.go b/metrics/e2e_test.go
index 627062065..67ea352c3 100644
--- a/metrics/e2e_test.go
+++ b/metrics/e2e_test.go
@@ -21,7 +21,6 @@ import (
 	"errors"
 	"fmt"
 	"io"
-	"io/ioutil"
 	"net"
 	"net/http"
 	"sort"
@@ -166,7 +165,7 @@ func TestMetricsExport(t *testing.T) {
 				t.Fatalf("failed to fetch prometheus metrics: %+v", err)
 			}
 			defer resp.Body.Close()
-			body, err := ioutil.ReadAll(resp.Body)
+			body, err := io.ReadAll(resp.Body)
 			if err != nil {
 				t.Fatalf("failed to read prometheus response: %+v", err)
 			}
diff --git a/metrics/metricskey/constants_test.go b/metrics/metricskey/constants_test.go
index f683b4e47..56d135ef0 100644
--- a/metrics/metricskey/constants_test.go
+++ b/metrics/metricskey/constants_test.go
@@ -13,6 +13,7 @@ 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.
 */
+
 package metricskey_test
 
 import (
diff --git a/metrics/opencensus_exporter_test.go b/metrics/opencensus_exporter_test.go
index d827b7d93..ba5417422 100644
--- a/metrics/opencensus_exporter_test.go
+++ b/metrics/opencensus_exporter_test.go
@@ -3,7 +3,9 @@ Copyright 2020 The Knative Authors.
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
-    http://www.apache.org/licenses/LICENSE-2.0
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,8 +17,8 @@ package metrics
 import (
 	"crypto/tls"
 	"fmt"
-	"io/ioutil"
 	"net"
+	"os"
 	"path/filepath"
 	"testing"
 
@@ -31,11 +33,11 @@ import (
 )
 
 func TestOpenCensusConfig(t *testing.T) {
-	cert, err := ioutil.ReadFile(filepath.Join("testdata", "client-cert.pem"))
+	cert, err := os.ReadFile(filepath.Join("testdata", "client-cert.pem"))
 	if err != nil {
 		t.Fatal("Couldn't find testdata/client-cert.pem:", err)
 	}
-	key, err := ioutil.ReadFile(filepath.Join("testdata", "client-key.pem"))
+	key, err := os.ReadFile(filepath.Join("testdata", "client-key.pem"))
 	if err != nil {
 		t.Fatal("Couldn't find testdata/client-key.pem:", err)
 	}
diff --git a/metrics/prometheus_exporter_test.go b/metrics/prometheus_exporter_test.go
index e5ae2e47c..93c1fd11d 100644
--- a/metrics/prometheus_exporter_test.go
+++ b/metrics/prometheus_exporter_test.go
@@ -3,7 +3,9 @@ Copyright 2019 The Knative Authors.
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
-    http://www.apache.org/licenses/LICENSE-2.0
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/metrics/resource_view_test.go b/metrics/resource_view_test.go
index 52ac8df5d..f80486657 100644
--- a/metrics/resource_view_test.go
+++ b/metrics/resource_view_test.go
@@ -24,8 +24,8 @@ import (
 	"go.opencensus.io/resource"
 	"go.opencensus.io/stats"
 	"go.opencensus.io/stats/view"
-	"k8s.io/apimachinery/pkg/util/clock"
 	"k8s.io/apimachinery/pkg/util/wait"
+	testingclock "k8s.io/utils/clock/testing"
 )
 
 var (
@@ -129,8 +129,8 @@ func TestSetFactory(t *testing.T) {
 }
 
 func TestAllMetersExpiration(t *testing.T) {
-	allMeters.clock = clock.Clock(clock.NewFakeClock(time.Now()))
-	fakeClock := allMeters.clock.(*clock.FakeClock)
+	fakeClock := testingclock.NewFakeClock(time.Now())
+	allMeters.clock = fakeClock
 	ClearMetersForTest() // t+0m
 
 	// Add resource123
@@ -199,8 +199,8 @@ func TestAllMetersExpiration(t *testing.T) {
 }
 
 func TestIfAllMeterResourcesAreRemoved(t *testing.T) {
-	allMeters.clock = clock.Clock(clock.NewFakeClock(time.Now()))
-	fakeClock := allMeters.clock.(*clock.FakeClock)
+	fakeClock := testingclock.NewFakeClock(time.Now())
+	allMeters.clock = fakeClock
 	ClearMetersForTest() // t+0m
 	// Register many resources at once
 	for i := 1; i <= 100; i++ {
diff --git a/reconciler/testing/hooks.go b/reconciler/testing/hooks.go
index f60d6ebed..c89be34a0 100644
--- a/reconciler/testing/hooks.go
+++ b/reconciler/testing/hooks.go
@@ -44,7 +44,7 @@ CreateHookFunc is a function for handling a Create hook. Its runtime.Object
 parameter will be the Kubernetes resource created. The resource can be cast
 to its actual type like this:
 
-		pod := obj.(*v1.Pod)
+	pod := obj.(*v1.Pod)
 
 A return value of true marks the hook as completed. Returning false allows
 the hook to run again when the next resource of the requested type is
@@ -57,7 +57,7 @@ UpdateHookFunc is a function for handling an update hook. its runtime.Object
 parameter will be the Kubernetes resource updated. The resource can be cast
 to its actual type like this:
 
-		pod := obj.(*v1.Pod)
+	pod := obj.(*v1.Pod)
 
 A return value of true marks the hook as completed. Returning false allows
 the hook to run again when the next resource of the requested type is
diff --git a/reconciler/testing/reactions.go b/reconciler/testing/reactions.go
index d66b41a71..c6d960b99 100644
--- a/reconciler/testing/reactions.go
+++ b/reconciler/testing/reactions.go
@@ -28,15 +28,18 @@ import (
 
 // InduceFailure is used in conjunction with TableTest's WithReactors field.
 // Tests that want to induce a failure in a row of a TableTest would add:
-//   WithReactors: []clientgotesting.ReactionFunc{
-//      // Makes calls to create revisions return an error.
-//      InduceFailure("create", "revisions"),
-//   },
+//
+//	WithReactors: []clientgotesting.ReactionFunc{
+//	   // Makes calls to create revisions return an error.
+//	   InduceFailure("create", "revisions"),
+//	},
+//
 // Or to target a subresource, say a patch to InMemoryChannel.Status, you would add:
-//   WithReactors: []clientgotesting.ReactionFunc{
-//      // Makes calls to patch inmemorychannels status subresource return an error.
-//      InduceFailure("patch", "inmemorychannels/status"),
-//   },
+//
+//	WithReactors: []clientgotesting.ReactionFunc{
+//	   // Makes calls to patch inmemorychannels status subresource return an error.
+//	   InduceFailure("patch", "inmemorychannels/status"),
+//	},
 func InduceFailure(verb, resource string) clientgotesting.ReactionFunc {
 	return func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) {
 		if !action.Matches(verb, resource) {
diff --git a/reconciler/testing/sorter.go b/reconciler/testing/sorter.go
index 2c1e91923..a55286f7b 100644
--- a/reconciler/testing/sorter.go
+++ b/reconciler/testing/sorter.go
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
-    http://www.apache.org/licenses/LICENSE-2.0
+	http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/reconciler/testing/sorter_test.go b/reconciler/testing/sorter_test.go
index 7c83200ea..63eccac1f 100644
--- a/reconciler/testing/sorter_test.go
+++ b/reconciler/testing/sorter_test.go
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
-    http://www.apache.org/licenses/LICENSE-2.0
+	http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/reconciler/testing/tracker_test.go b/reconciler/testing/tracker_test.go
index 90a1e236f..232a452ce 100644
--- a/reconciler/testing/tracker_test.go
+++ b/reconciler/testing/tracker_test.go
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
-    http://www.apache.org/licenses/LICENSE-2.0
+	http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/test/cleanup_test.go b/test/cleanup_test.go
index 96f888548..e90ac5a34 100644
--- a/test/cleanup_test.go
+++ b/test/cleanup_test.go
@@ -20,7 +20,6 @@ import (
 	"bytes"
 	"errors"
 	"fmt"
-	"io/ioutil"
 	"os"
 	"os/exec"
 	"strings"
@@ -43,8 +42,7 @@ func TestCleanupOnInterrupt(t *testing.T) {
 		return
 	}
 
-	// TODO: Move to os.CreateTemp when we adopt 1.16 more widely
-	readyFile, err := ioutil.TempFile("", "")
+	readyFile, err := os.CreateTemp("", "")
 	if err != nil {
 		t.Fatalf("failed to setup tests")
 	}
diff --git a/test/gcs/gcs.go b/test/gcs/gcs.go
index d39652f50..fa0bba380 100644
--- a/test/gcs/gcs.go
+++ b/test/gcs/gcs.go
@@ -21,7 +21,6 @@ import (
 	"errors"
 	"fmt"
 	"io"
-	"io/ioutil"
 	"os"
 	"path"
 	"strings"
@@ -31,7 +30,7 @@ import (
 	"google.golang.org/api/option"
 )
 
-//nolint // there's also Client so they collide.
+// nolint // there's also Client so they collide.
 type GCSClient struct {
 	*storage.Client
 }
@@ -223,7 +222,7 @@ func (g *GCSClient) ReadObject(ctx context.Context, bucketName, objPath string)
 		return contents, err
 	}
 	defer f.Close()
-	return ioutil.ReadAll(f)
+	return io.ReadAll(f)
 }
 
 // NewReader creates a new Reader of a gcs file.
diff --git a/test/gcs/mock/mock.go b/test/gcs/mock/mock.go
index 3113f026d..7ee63f3dc 100644
--- a/test/gcs/mock/mock.go
+++ b/test/gcs/mock/mock.go
@@ -18,7 +18,6 @@ package mock
 
 import (
 	"context"
-	"io/ioutil"
 	"os"
 	"path/filepath"
 	"strings"
@@ -434,7 +433,7 @@ func (c *clientMocker) Upload(ctx context.Context, bkt, objPath, filePath string
 		return NewNoObjectError(bkt, objName, dir)
 	}
 
-	content, err := ioutil.ReadFile(filePath)
+	content, err := os.ReadFile(filePath)
 	if err != nil {
 		return err
 	}
diff --git a/test/gcs/mock/mock_test.go b/test/gcs/mock/mock_test.go
index 395398445..40eb77743 100644
--- a/test/gcs/mock/mock_test.go
+++ b/test/gcs/mock/mock_test.go
@@ -21,7 +21,6 @@ import (
 	"context"
 	"errors"
 	"fmt"
-	"io/ioutil"
 	"os"
 	"path"
 	"reflect"
@@ -971,7 +970,7 @@ func TestDownload(t *testing.T) {
 				return
 			}
 
-			fileContent, err := ioutil.ReadFile(file)
+			fileContent, err := os.ReadFile(file)
 			if err != nil {
 				t.Fatalf("cannot read content %v, error %v", file, err)
 			}
@@ -989,7 +988,7 @@ func TestUpload(t *testing.T) {
 	project1 := "test-project1"
 	object1 := "dir/object1"
 	file := "test/upload"
-	content, err := ioutil.ReadFile(file)
+	content, err := os.ReadFile(file)
 	if err != nil {
 		t.Fatalf("cannot read content %v, error %v", file, err)
 	}
diff --git a/test/ghutil/client.go b/test/ghutil/client.go
index 8c14509f1..2dc162e0b 100644
--- a/test/ghutil/client.go
+++ b/test/ghutil/client.go
@@ -22,8 +22,8 @@ import (
 	"context"
 	"errors"
 	"fmt"
-	"io/ioutil"
 	"log"
+	"os"
 	"strings"
 	"time"
 
@@ -73,7 +73,7 @@ type GithubClient struct {
 
 // NewGithubClient explicitly authenticates to github with giving token and returns a handle
 func NewGithubClient(tokenFilePath string) (*GithubClient, error) {
-	b, err := ioutil.ReadFile(tokenFilePath)
+	b, err := os.ReadFile(tokenFilePath)
 	if err != nil {
 		return nil, err
 	}
diff --git a/test/imports/banned_deps_test.go b/test/imports/banned_deps_test.go
index f9bc42eef..b48c8065d 100644
--- a/test/imports/banned_deps_test.go
+++ b/test/imports/banned_deps_test.go
@@ -44,9 +44,12 @@ var bannedImports = []vbTuple{
 }
 
 // TestBannedImports run with:
-//   go test ./vendor/knative.dev/pkg/test/imports/ -run TestBannedImports
+//
+//	go test ./vendor/knative.dev/pkg/test/imports/ -run TestBannedImports
+//
 // Or with test-infra:
-//   report_go_test ${REPO_ROOT_DIR}/vendor/knative.dev/pkg/test/imports/...
+//
+//	report_go_test ${REPO_ROOT_DIR}/vendor/knative.dev/pkg/test/imports/...
 func TestBannedImports(t *testing.T) {
 	_, filename, _, _ := runtime.Caller(0)
 	dir := filepath.Dir(filename)
diff --git a/test/ingress/ingress.go b/test/ingress/ingress.go
index fc9f9a19c..8de4052c7 100644
--- a/test/ingress/ingress.go
+++ b/test/ingress/ingress.go
@@ -35,8 +35,10 @@ const (
 // GetIngressEndpoint gets the ingress public IP or hostname.
 // address - is the endpoint to which we should actually connect.
 // portMap - translates the request's port to the port on address to which the caller
-//    should connect.  This is used when the resolution to address goes through some
-//    sort of port-mapping, e.g. Kubernetes node ports.
+//
+//	should connect.  This is used when the resolution to address goes through some
+//	sort of port-mapping, e.g. Kubernetes node ports.
+//
 // err - an error when address/portMap cannot be established.
 func GetIngressEndpoint(ctx context.Context, kubeClientset kubernetes.Interface, endpointOverride string) (address string, portMap func(string) string, err error) {
 	ingressName := istioIngressName
diff --git a/test/interactive/docker.go b/test/interactive/docker.go
index 3b295921f..b0ef91ebe 100644
--- a/test/interactive/docker.go
+++ b/test/interactive/docker.go
@@ -19,7 +19,6 @@ package interactive
 
 import (
 	"fmt"
-	"io/ioutil"
 	"log"
 	"os"
 	"path"
@@ -77,12 +76,14 @@ func (d *Docker) AddMount(typeStr, source, target string, optAdditionalArgs ...s
 }
 
 // AddRWOverlay mounts a directory into the image at the desired location, but with an overlay
-//  so internal changes do not modify the external directory.
+//
+//	so internal changes do not modify the external directory.
+//
 // externalDirectory probably needs to be an absolute path
 // Returns a function to clean up the mount (but does not delete the directory).
 // Uses sudo and probably only works on Linux
 func (d *Docker) AddRWOverlay(externalDirectory, internalDirectory string) func() {
-	tmpDir, err := ioutil.TempDir("", "overlay")
+	tmpDir, err := os.MkdirTemp("", "overlay")
 	if err != nil {
 		log.Fatal(err)
 	}
diff --git a/test/logstream/v2/stream_test.go b/test/logstream/v2/stream_test.go
index 4244adc0e..63fdee858 100644
--- a/test/logstream/v2/stream_test.go
+++ b/test/logstream/v2/stream_test.go
@@ -20,7 +20,7 @@ import (
 	"context"
 	"errors"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"strings"
 	"testing"
@@ -385,7 +385,7 @@ func (f *fakePods) GetLogs(podName string, opts *corev1.PodLogOptions) *restclie
 		Client: fakerest.CreateHTTPClient(func(request *http.Request) (*http.Response, error) {
 			resp := &http.Response{
 				StatusCode: http.StatusOK,
-				Body: ioutil.NopCloser(
+				Body: io.NopCloser(
 					strings.NewReader(logsForContainer(opts.Container))),
 			}
 			return resp, nil
diff --git a/test/mako/config/benchmark.go b/test/mako/config/benchmark.go
index 3ddff5cdd..64f1a812c 100644
--- a/test/mako/config/benchmark.go
+++ b/test/mako/config/benchmark.go
@@ -18,7 +18,6 @@ package config
 
 import (
 	"fmt"
-	"io/ioutil"
 	"log"
 	"os"
 	"path/filepath"
@@ -49,7 +48,7 @@ func getBenchmark() (*mpb.BenchmarkInfo, error) {
 	// Read the Mako config file for this environment.
 	data, koerr := readFileFromKoData(env + ".config")
 	if koerr != nil {
-		data, err = ioutil.ReadFile(filepath.Join(configMako, env+".config"))
+		data, err = os.ReadFile(filepath.Join(configMako, env+".config"))
 		if err != nil {
 			//nolint: errorlint // It's fine not to wrap here.
 			return nil, fmt.Errorf("cannot load both from kodata and from config mako config map: %s, %s", koerr.Error(), err.Error())
@@ -72,5 +71,5 @@ func readFileFromKoData(name string) ([]byte, error) {
 		return nil, fmt.Errorf("%q does not exist or is empty", koDataPathEnvName)
 	}
 	fullFilename := filepath.Join(koDataPath, name)
-	return ioutil.ReadFile(fullFilename)
+	return os.ReadFile(fullFilename)
 }
diff --git a/test/slackutil/http.go b/test/slackutil/http.go
index 072860ff3..41577c9d3 100644
--- a/test/slackutil/http.go
+++ b/test/slackutil/http.go
@@ -20,7 +20,7 @@ package slackutil
 
 import (
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"net/url"
 )
@@ -49,5 +49,5 @@ func handleResponse(resp *http.Response) ([]byte, error) {
 	if resp.StatusCode != http.StatusOK {
 		return nil, fmt.Errorf("http response code is not StatusOK: '%v'", resp.StatusCode)
 	}
-	return ioutil.ReadAll(resp.Body)
+	return io.ReadAll(resp.Body)
 }
diff --git a/test/slackutil/message_read.go b/test/slackutil/message_read.go
index fe13126b0..6feeb52f8 100644
--- a/test/slackutil/message_read.go
+++ b/test/slackutil/message_read.go
@@ -22,8 +22,8 @@ import (
 	"encoding/json"
 	"fmt"
 	"html"
-	"io/ioutil"
 	"net/url"
+	"os"
 	"strconv"
 	"strings"
 	"time"
@@ -44,7 +44,7 @@ type readClient struct {
 
 // NewReadClient reads token file and stores it for later authentication
 func NewReadClient(userName, tokenPath string) (ReadOperations, error) {
-	b, err := ioutil.ReadFile(tokenPath)
+	b, err := os.ReadFile(tokenPath)
 	if err != nil {
 		return nil, err
 	}
diff --git a/test/slackutil/message_write.go b/test/slackutil/message_write.go
index 6c0413cd5..eefd17d8b 100644
--- a/test/slackutil/message_write.go
+++ b/test/slackutil/message_write.go
@@ -21,7 +21,7 @@ package slackutil
 import (
 	"encoding/json"
 	"fmt"
-	"io/ioutil"
+	"os"
 	"strings"
 
 	"net/url"
@@ -42,7 +42,7 @@ type writeClient struct {
 
 // NewWriteClient reads token file and stores it for later authentication
 func NewWriteClient(userName, tokenPath string) (WriteOperations, error) {
-	b, err := ioutil.ReadFile(tokenPath)
+	b, err := os.ReadFile(tokenPath)
 	if err != nil {
 		return nil, err
 	}
diff --git a/test/spoof/spoof.go b/test/spoof/spoof.go
index 147a64adc..789d4bd68 100644
--- a/test/spoof/spoof.go
+++ b/test/spoof/spoof.go
@@ -23,7 +23,6 @@ import (
 	"errors"
 	"fmt"
 	"io"
-	"io/ioutil"
 	"net"
 	"net/http"
 	"net/url"
@@ -188,7 +187,7 @@ func (sc *SpoofingClient) Poll(req *http.Request, inState ResponseChecker, check
 		}
 		defer rawResp.Body.Close()
 
-		body, err := ioutil.ReadAll(rawResp.Body)
+		body, err := io.ReadAll(rawResp.Body)
 		if err != nil {
 			return true, err
 		}
diff --git a/test/upgrade/execute_failures_test.go b/test/upgrade/execute_failures_test.go
index cd5a19ddc..a11448f07 100644
--- a/test/upgrade/execute_failures_test.go
+++ b/test/upgrade/execute_failures_test.go
@@ -18,7 +18,7 @@ package upgrade_test
 
 import (
 	"fmt"
-	"io/ioutil"
+	"io"
 	"os"
 	"testing"
 
@@ -89,6 +89,6 @@ func captureStdOutput(call func()) string {
 	call()
 
 	_ = w.Close()
-	out, _ := ioutil.ReadAll(r)
+	out, _ := io.ReadAll(r)
 	return string(out)
 }
diff --git a/test/vegeta/pacers/steady_up_pacer.go b/test/vegeta/pacers/steady_up_pacer.go
index 9c8f01413..fa4878f18 100644
--- a/test/vegeta/pacers/steady_up_pacer.go
+++ b/test/vegeta/pacers/steady_up_pacer.go
@@ -26,13 +26,14 @@ import (
 )
 
 // steadyUpPacer is a Pacer that describes attack request rates that increases in the beginning then becomes steady.
-//  Max  |     ,----------------
-//       |    /
-//       |   /
-//       |  /
-//       | /
-//  Min -+------------------------------> t
-//       |<-Up->|
+//
+//	Max  |     ,----------------
+//	     |    /
+//	     |   /
+//	     |  /
+//	     | /
+//	Min -+------------------------------> t
+//	     |<-Up->|
 type steadyUpPacer struct {
 	// upDuration is the duration that attack request rates increase from Min to Max.
 	// MUST be larger than 0.
diff --git a/test/zipkin/doc.go b/test/zipkin/doc.go
index c4464f459..81c15343f 100644
--- a/test/zipkin/doc.go
+++ b/test/zipkin/doc.go
@@ -33,9 +33,8 @@ This package exposes following methods:
 
 A general flow for a Test Suite to use Zipkin Tracing support is as follows:
 
-		1. Call SetupZipkinTracing(kubernetes.Interface) in TestMain.
-		2. Use SpoofingClient to make HTTP requests.
-		3. Call CleanupZipkinTracingSetup on cleanup after tests are executed.
-
+ 1. Call SetupZipkinTracing(kubernetes.Interface) in TestMain.
+ 2. Use SpoofingClient to make HTTP requests.
+ 3. Call CleanupZipkinTracingSetup on cleanup after tests are executed.
 */
 package zipkin
diff --git a/test/zipkin/util.go b/test/zipkin/util.go
index 5e9cb5feb..f22efa441 100644
--- a/test/zipkin/util.go
+++ b/test/zipkin/util.go
@@ -22,7 +22,7 @@ import (
 	"context"
 	"encoding/json"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"net/url"
 	"strconv"
@@ -110,9 +110,10 @@ func SetupZipkinTracingFromConfigTracingOrFail(ctx context.Context, t testing.TB
 }
 
 // SetupZipkinTracing sets up zipkin tracing which involves:
-// 1. Setting up port-forwarding from localhost to zipkin pod on the cluster
-//    (pid of the process doing Port-Forward is stored in a global variable).
-// 2. Enable AlwaysSample config for tracing for the SpoofingClient.
+//  1. Setting up port-forwarding from localhost to zipkin pod on the cluster
+//     (pid of the process doing Port-Forward is stored in a global variable).
+//  2. Enable AlwaysSample config for tracing for the SpoofingClient.
+//
 // The zipkin deployment must have the label app=zipkin
 func SetupZipkinTracing(ctx context.Context, kubeClientset kubernetes.Interface, logf logging.FormatLogger, zipkinRemotePort int, zipkinNamespace string) (err error) {
 	setupOnce.Do(func() {
@@ -152,13 +153,13 @@ func SetupZipkinTracingOrFail(ctx context.Context, t testing.TB, kubeClientset k
 // CleanupZipkinTracingSetup cleans up the Zipkin tracing setup on the machine. This involves killing the process performing port-forward.
 // This should be called exactly once in TestMain. Likely in the form:
 //
-// func TestMain(m *testing.M) {
-//     os.Exit(func() int {
-//       // Any setup required for the tests.
-//       defer zipkin.CleanupZipkinTracingSetup(logger)
-//       return m.Run()
-//     }())
-// }
+//	func TestMain(m *testing.M) {
+//	    os.Exit(func() int {
+//	      // Any setup required for the tests.
+//	      defer zipkin.CleanupZipkinTracingSetup(logger)
+//	      return m.Run()
+//	    }())
+//	}
 func CleanupZipkinTracingSetup(logf logging.FormatLogger) {
 	teardownOnce.Do(func() {
 		// Because CleanupZipkinTracingSetup only runs once, make sure that now that it has been
@@ -226,7 +227,7 @@ func jsonTrace(traceID string) ([]model.SpanModel, error) {
 	}
 	defer resp.Body.Close()
 
-	body, err := ioutil.ReadAll(resp.Body)
+	body, err := io.ReadAll(resp.Body)
 	if err != nil {
 		return empty, err
 	}
diff --git a/tracing/testing/zipkin.go b/tracing/testing/zipkin.go
index 708277388..1707fbcaf 100644
--- a/tracing/testing/zipkin.go
+++ b/tracing/testing/zipkin.go
@@ -27,13 +27,14 @@ import (
 // FakeZipkinExporter is intended to capture the testing boilerplate of building
 // up the ConfigOption to pass NewOpenCensusTracer and expose a mechanism for examining
 // the traces it would have reported.  To set it up, use something like:
-//    reporter, co := FakeZipkinExporter()
-//    defer reporter.Close()
-//    oct := NewOpenCensusTracer(co)
-//    defer oct.Close()
-//    // Do stuff.
-//    spans := reporter.Flush()
-//    // Check reported spans.
+//
+//	reporter, co := FakeZipkinExporter()
+//	defer reporter.Close()
+//	oct := NewOpenCensusTracer(co)
+//	defer oct.Close()
+//	// Do stuff.
+//	spans := reporter.Flush()
+//	// Check reported spans.
 func FakeZipkinExporter() (*recorder.ReporterRecorder, tracing.ConfigOption) {
 	// Create tracer with reporter recorder
 	reporter := recorder.NewReporter()
diff --git a/webhook/admission_integration_test.go b/webhook/admission_integration_test.go
index 66a73c483..f5c818122 100644
--- a/webhook/admission_integration_test.go
+++ b/webhook/admission_integration_test.go
@@ -13,13 +13,14 @@ 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.
 */
+
 package webhook
 
 import (
 	"bytes"
 	"context"
 	"encoding/json"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"net/url"
 	"path"
@@ -154,7 +155,7 @@ func TestAdmissionValidResponseForResourceTLS(t *testing.T) {
 		}
 
 		defer response.Body.Close()
-		responseBody, err := ioutil.ReadAll(response.Body)
+		responseBody, err := io.ReadAll(response.Body)
 		if err != nil {
 			t.Error("Failed to read response body", err)
 			return
@@ -279,7 +280,7 @@ func TestAdmissionValidResponseForResource(t *testing.T) {
 		}
 
 		defer response.Body.Close()
-		responseBody, err := ioutil.ReadAll(response.Body)
+		responseBody, err := io.ReadAll(response.Body)
 		if err != nil {
 			t.Error("Failed to read response body", err)
 			return
@@ -408,7 +409,7 @@ func TestAdmissionInvalidResponseForResource(t *testing.T) {
 	}
 
 	defer response.Body.Close()
-	respBody, err := ioutil.ReadAll(response.Body)
+	respBody, err := io.ReadAll(response.Body)
 	if err != nil {
 		t.Fatal("Failed to read response body", err)
 	}
diff --git a/webhook/conversion_integration_test.go b/webhook/conversion_integration_test.go
index 56aeb4f66..3b99d0091 100644
--- a/webhook/conversion_integration_test.go
+++ b/webhook/conversion_integration_test.go
@@ -21,7 +21,7 @@ import (
 	"context"
 	"encoding/json"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"testing"
 
@@ -123,7 +123,7 @@ func TestConversionValidResponse(t *testing.T) {
 		t.Errorf("Response status code = %v, wanted %v", got, want)
 	}
 
-	responseBody, err := ioutil.ReadAll(response.Body)
+	responseBody, err := io.ReadAll(response.Body)
 	if err != nil {
 		t.Fatal("Failed to read response body", err)
 	}
@@ -212,7 +212,7 @@ func TestConversionInvalidResponse(t *testing.T) {
 		t.Errorf("Response status code = %v, wanted %v", got, want)
 	}
 
-	responseBody, err := ioutil.ReadAll(response.Body)
+	responseBody, err := io.ReadAll(response.Body)
 	if err != nil {
 		t.Fatal("Failed to read response body", err)
 	}
diff --git a/webhook/webhook_integration_test.go b/webhook/webhook_integration_test.go
index fd5b0626a..b81b2f4eb 100644
--- a/webhook/webhook_integration_test.go
+++ b/webhook/webhook_integration_test.go
@@ -19,7 +19,7 @@ package webhook
 import (
 	"context"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"strings"
 	"testing"
@@ -91,7 +91,7 @@ func TestMissingContentType(t *testing.T) {
 	}
 
 	defer response.Body.Close()
-	responseBody, err := ioutil.ReadAll(response.Body)
+	responseBody, err := io.ReadAll(response.Body)
 	if err != nil {
 		t.Fatal("Failed to read response body", err)
 	}
@@ -147,7 +147,7 @@ func testEmptyRequestBody(t *testing.T, controller interface{}) {
 	}
 	defer response.Body.Close()
 
-	responseBody, err := ioutil.ReadAll(response.Body)
+	responseBody, err := io.ReadAll(response.Body)
 	if err != nil {
 		t.Fatal("Failed to read response body", err)
 	}