Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add copyright header for health_test.go #14827

Closed
ahrtr opened this issue Nov 22, 2022 · 1 comment · Fixed by #14840
Closed

Add copyright header for health_test.go #14827

ahrtr opened this issue Nov 22, 2022 · 1 comment · Fixed by #14840

Comments

@ahrtr
Copy link
Member

ahrtr commented Nov 22, 2022

What would you like to be added?

Add copyright header for
https://github.com/etcd-io/etcd/blob/main/server/etcdserver/api/etcdhttp/health_test.go

// Copyright 2022 The etcd 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.

Why is this needed?

Each file should have the copyright header

@serathius
Copy link
Member

serathius commented Nov 23, 2022

This should be prevented by license_header check. I think the problem is that go_srcs_in_module, which is used to generate list of go files to check, skips test files. The result is that existing validation doesn't ensure license header in test files.

Code

etcd/scripts/test.sh

Lines 476 to 481 in 2e790d2

function license_header_per_module {
# bash 3.x compatible replacement of: mapfile -t gofiles < <(go_srcs_in_module "$1")
local gofiles=()
while IFS= read -r line; do gofiles+=("$line"); done < <(go_srcs_in_module "$1")
run_go_tool "github.com/google/addlicense" --check "${gofiles[@]}"
}

Would be good to follow up this issue with fixining license_header check to cover all files.

Bhargav-InfraCloud added a commit to Bhargav-InfraCloud/etcd that referenced this issue Nov 23, 2022
The shell function go_srcs_in_module will list go test files
along with go src files in the specified module. This helps
in identifying the copyright header misses in test files.

Fixes etcd-io#14827

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
Bhargav-InfraCloud added a commit to Bhargav-InfraCloud/etcd that referenced this issue Nov 23, 2022
Comments fixed as per goword in go test files that shell
function go_srcs_in_module lists as per changes on etcd-io#14827

Helps in etcd-io#14827

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
Bhargav-InfraCloud added a commit to Bhargav-InfraCloud/etcd that referenced this issue Nov 23, 2022
Comments fixed as per goword in go test files that shell
function go_srcs_in_module lists as per changes on etcd-io#14827

Helps in etcd-io#14827

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
Bhargav-InfraCloud added a commit to Bhargav-InfraCloud/etcd that referenced this issue Nov 23, 2022
The shell func go_srcs_in_module will now list
1. go src files
2. go test files belong to same packages
3. go test files that belong to _test packages

Fixes etcd-io#14827

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
Bhargav-InfraCloud added a commit to Bhargav-InfraCloud/etcd that referenced this issue Nov 23, 2022
Comments fixed as per goword in go _test package files that
shell function go_srcs_in_module lists as per changes on etcd-io#14827

Helps in etcd-io#14827

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
ahrtr added a commit that referenced this issue Nov 23, 2022
…test-files

Shell func go_srcs_in_module to list go src+test files (#14827)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants