Skip to content

Commit

Permalink
codegen using Go 1.19
Browse files Browse the repository at this point in the history
The golang linting was upgraded in our CI to accomodate gofmt changes in Go
1.19.

Please refer to the related PRs/issues:

tektoncd#5944
tektoncd#5771

Signed-off-by: Yongxuan Zhang [email protected]
  • Loading branch information
Yongxuanzhang committed Feb 23, 2023
1 parent 37b364a commit 0d6813a
Show file tree
Hide file tree
Showing 32 changed files with 136 additions and 118 deletions.
2 changes: 1 addition & 1 deletion cmd/entrypoint/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,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,
Expand Down
2 changes: 1 addition & 1 deletion cmd/git-init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion cmd/imagedigestexporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ var (
terminationMessagePath = flag.String("terminationMessagePath", "/tekton/termination", "Location of file containing termination message")
)

/* The input of this go program will be a JSON string with all the output PipelineResources of type
/*
The input of this go program will be a JSON string with all the output PipelineResources of type
Image, which will include the path to where the index.json file will be located. The program will
read the related index.json file(s) and log another JSON string including the name of the image resource
and the digests.
Expand Down
2 changes: 1 addition & 1 deletion cmd/pullrequest-init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
38 changes: 24 additions & 14 deletions docs/pipeline-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5960,9 +5960,9 @@ RunStatus
<h3 id="tekton.dev/v1alpha1.VerificationPolicy">VerificationPolicy
</h3>
<div>
<p>VerificationPolicy defines the Tekton resources and corresponding authorities to verify.
The VerificationPolicy is used in trusted resources to store the public keys to verify
Tekton resources.</p>
<p>VerificationPolicy defines the rules to verify Tekton resources.
VerificationPolicy can config the mapping from resources to a list of public
keys, so when verifying the resources we can use the corresponding public keys.</p>
</div>
<table>
<thead>
Expand Down Expand Up @@ -6028,9 +6028,9 @@ VerificationPolicySpec
</em>
</td>
<td>
<p>Resources defines the patterns of Resources names that should be subject to this policy.
For example, we may want to apply this Policy only from a certain github repo.
Then the ResourcesPattern should include the path. If using gitresolver, and we want to config keys from a certain git repo.
<p>Resources defines the patterns of resources sources that should be subject to this policy.
For example, we may want to apply this Policy from a certain GitHub repo.
Then the ResourcesPattern should be valid regex. E.g. If using gitresolver, and we want to config keys from a certain git repo.
<code>ResourcesPattern</code> can be <code>https://github.com/tektoncd/catalog.git</code>, we will use regex to filter out those resources.</p>
</td>
</tr>
Expand Down Expand Up @@ -6188,7 +6188,7 @@ the controller, but was unused as there is no controller for PipelineResource.</
(<em>Appears on:</em><a href="#tekton.dev/v1alpha1.VerificationPolicySpec">VerificationPolicySpec</a>)
</p>
<div>
<p>The Authority block defines the rules for validating signatures.</p>
<p>The Authority block defines the keys for validating signatures.</p>
</div>
<table>
<thead>
Expand Down Expand Up @@ -6219,7 +6219,7 @@ KeyRef
</em>
</td>
<td>
<p>Key defines the type of key to validate the resource.</p>
<p>Key contains the public key to validate the resource.</p>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -6295,6 +6295,14 @@ structs.</p>
</tr>
</tbody>
</table>
<h3 id="tekton.dev/v1alpha1.HashAlgorithm">HashAlgorithm
(<code>string</code> alias)</h3>
<p>
(<em>Appears on:</em><a href="#tekton.dev/v1alpha1.KeyRef">KeyRef</a>)
</p>
<div>
<p>HashAlgorithm defines the hash algorithm used for the public key</p>
</div>
<h3 id="tekton.dev/v1alpha1.KeyRef">KeyRef
</h3>
<p>
Expand Down Expand Up @@ -6341,7 +6349,9 @@ string
<td>
<code>hashAlgorithm</code><br/>
<em>
string
<a href="#tekton.dev/v1alpha1.HashAlgorithm">
HashAlgorithm
</a>
</em>
</td>
<td>
Expand Down Expand Up @@ -6376,8 +6386,8 @@ string
</td>
<td>
<p>Pattern defines a resource pattern. Regex is created to filter resources based on <code>Pattern</code>
Examples patterns:
Github resource: <a href="https://github.com/tektoncd/catalog.git">https://github.com/tektoncd/catalog.git</a>, <a href="https://github.com/tektoncd/*">https://github.com/tektoncd/*</a>
Example patterns:
GitHub resource: <a href="https://github.com/tektoncd/catalog.git">https://github.com/tektoncd/catalog.git</a>, <a href="https://github.com/tektoncd/*">https://github.com/tektoncd/*</a>
Bundle resource: gcr.io/tekton-releases/catalog/upstream/git-clone, gcr.io/tekton-releases/catalog/upstream/*
Hub resource: <a href="https://artifacthub.io/*">https://artifacthub.io/*</a>,</p>
</td>
Expand Down Expand Up @@ -6587,9 +6597,9 @@ Refer Go&rsquo;s ParseDuration documentation for expected format: <a href="https
</em>
</td>
<td>
<p>Resources defines the patterns of Resources names that should be subject to this policy.
For example, we may want to apply this Policy only from a certain github repo.
Then the ResourcesPattern should include the path. If using gitresolver, and we want to config keys from a certain git repo.
<p>Resources defines the patterns of resources sources that should be subject to this policy.
For example, we may want to apply this Policy from a certain GitHub repo.
Then the ResourcesPattern should be valid regex. E.g. If using gitresolver, and we want to config keys from a certain git repo.
<code>ResourcesPattern</code> can be <code>https://github.com/tektoncd/catalog.git</code>, we will use regex to filter out those resources.</p>
</td>
</tr>
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/pipeline/pod/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ func (tpl *Template) ToAffinityAssistantTemplate() *AffinityAssistantTemplate {
}

// PodTemplate holds pod specific configuration
//
//nolint:revive
type PodTemplate = Template

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1/container_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1/taskrun_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/pipeline/v1beta1/resource_types_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ func (tr *TaskRunResources) Validate(ctx context.Context) *apis.FieldError {
}

// validateTaskRunResources validates that
// 1. resource is not declared more than once
// 2. if both resource reference and resource spec is defined at the same time
// 3. at least resource ref or resource spec is defined
// 1. resource is not declared more than once
// 2. if both resource reference and resource spec is defined at the same time
// 3. at least resource ref or resource spec is defined
func validateTaskRunResources(ctx context.Context, resources []TaskResourceBinding, path string) *apis.FieldError {
encountered := sets.NewString()
for _, r := range resources {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1beta1/taskrun_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pkg/client/resolution/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pkg/client/resolution/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pkg/client/resource/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pkg/client/resource/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions pkg/controller/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ import (
// For example, a controller impl that wants to be notified of updates to Runs
// which reference a Task with apiVersion "example.dev/v0" and kind "Example":
//
// runinformer.Get(ctx).Informer().AddEventHandler(cache.FilteringResourceEventHandler{
// FilterFunc: FilterRunRef("example.dev/v0", "Example"),
// Handler: controller.HandleAll(impl.Enqueue),
// })
// runinformer.Get(ctx).Informer().AddEventHandler(cache.FilteringResourceEventHandler{
// FilterFunc: FilterRunRef("example.dev/v0", "Example"),
// Handler: controller.HandleAll(impl.Enqueue),
// })
func FilterRunRef(apiVersion, kind string) func(interface{}) bool {
return func(obj interface{}) bool {
r, ok := obj.(*v1alpha1.Run)
Expand Down Expand Up @@ -67,10 +67,10 @@ func FilterRunRef(apiVersion, kind string) func(interface{}) bool {
// For example, a controller impl that wants to be notified of updates to TaskRuns that are controlled by
// a Run which references a custom task with apiVersion "example.dev/v0" and kind "Example":
//
// taskruninformer.Get(ctx).Informer().AddEventHandler(cache.FilteringResourceEventHandler{
// FilterFunc: FilterOwnerRunRef("example.dev/v0", "Example"),
// Handler: controller.HandleAll(impl.Enqueue),
// })
// taskruninformer.Get(ctx).Informer().AddEventHandler(cache.FilteringResourceEventHandler{
// FilterFunc: FilterOwnerRunRef("example.dev/v0", "Example"),
// Handler: controller.HandleAll(impl.Enqueue),
// })
func FilterOwnerRunRef(runLister listersalpha.RunLister, apiVersion, kind string) func(interface{}) bool {
return func(obj interface{}) bool {
object, ok := obj.(metav1.Object)
Expand Down Expand Up @@ -114,10 +114,10 @@ func FilterOwnerRunRef(runLister listersalpha.RunLister, apiVersion, kind string
// For example, a controller impl that wants to be notified of updates to CustomRuns
// which reference a Task with apiVersion "example.dev/v0" and kind "Example":
//
// customruninformer.Get(ctx).Informer().AddEventHandler(cache.FilteringResourceEventHandler{
// FilterFunc: FilterCustomRunRef("example.dev/v0", "Example"),
// Handler: controller.HandleAll(impl.Enqueue),
// })
// customruninformer.Get(ctx).Informer().AddEventHandler(cache.FilteringResourceEventHandler{
// FilterFunc: FilterCustomRunRef("example.dev/v0", "Example"),
// Handler: controller.HandleAll(impl.Enqueue),
// })
func FilterCustomRunRef(apiVersion, kind string) func(interface{}) bool {
return func(obj interface{}) bool {
r, ok := obj.(*v1beta1.CustomRun)
Expand Down Expand Up @@ -147,10 +147,10 @@ func FilterCustomRunRef(apiVersion, kind string) func(interface{}) bool {
// For example, a controller impl that wants to be notified of updates to TaskRuns that are controlled by
// a CustomRun which references a custom task with apiVersion "example.dev/v0" and kind "Example":
//
// taskruninformer.Get(ctx).Informer().AddEventHandler(cache.FilteringResourceEventHandler{
// FilterFunc: FilterOwnerCustomRunRef("example.dev/v0", "Example"),
// Handler: controller.HandleAll(impl.Enqueue),
// })
// taskruninformer.Get(ctx).Informer().AddEventHandler(cache.FilteringResourceEventHandler{
// FilterFunc: FilterOwnerCustomRunRef("example.dev/v0", "Example"),
// Handler: controller.HandleAll(impl.Enqueue),
// })
func FilterOwnerCustomRunRef(customRunLister listersbeta.CustomRunLister, apiVersion, kind string) func(interface{}) bool {
return func(obj interface{}) bool {
object, ok := obj.(metav1.Object)
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/affinityassistant/transformer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/computeresources/compare/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 0d6813a

Please sign in to comment.