From fbca475163b9d0c5233123e78361ee654663bc57 Mon Sep 17 00:00:00 2001 From: LiZhenCheng9527 Date: Wed, 10 Jul 2024 16:39:54 +0800 Subject: [PATCH 1/3] test Signed-off-by: LiZhenCheng9527 --- hack/copyright-check.sh | 48 ++++++++++++++++++++++++++++++++++++ hack/copyright/BSDandGPL.txt | 2 ++ hack/copyright/apache.txt | 15 +++++++++++ hack/test.sh | 32 ++++++++++++++++++++++++ pkg/status/status_server.go | 16 ------------ 5 files changed, 97 insertions(+), 16 deletions(-) create mode 100755 hack/copyright-check.sh create mode 100644 hack/copyright/BSDandGPL.txt create mode 100644 hack/copyright/apache.txt create mode 100755 hack/test.sh diff --git a/hack/copyright-check.sh b/hack/copyright-check.sh new file mode 100755 index 000000000..520a6707c --- /dev/null +++ b/hack/copyright-check.sh @@ -0,0 +1,48 @@ +#!/bin/bash +ROOT_DIR=$(git rev-parse --show-toplevel) +echo $ROOT_DIR +cd $ROOT_DIR + +go_copyright=$(cat ./hack/copyright/apache.txt) +echo "$go_copyright" + +c_copyright=$(cat ./hack/copyright/BSDandGPL.txt) +echo "$c_copyright" + +go_dirs="$ROOT_DIR/bpf/kmesh/bpf2go $ROOT_DIR/pkg" + +function check_go_copyright() { + file=$1 + + copyright_found=$(head -n 20 $file | grep -c "$go_copyright") + + if [ $copyright_found -eq 0 ]; then + echo $copyright_found + echo "Copyright missing in $file" + # exit 1 + fi + + # header_copyright=$(head -n 1 $file) + + # if [ "$header_copyright" != "$go_copyright" ]; then + # echo "Copyright doesn't match in $file" + # # exit 1 + # fi +} + +function check_dir() { + dir=$1 + find $dir -type f -name "*.go" | while read file; do + echo $file + if ! echo $exclude_dirs | grep -q $(dirname $file); then + check_go_copyright $file + fi + done +} + +for dir in ${go_dirs}; do + echo $dir + check_dir $dir +done + +echo "Copyright check passed!" \ No newline at end of file diff --git a/hack/copyright/BSDandGPL.txt b/hack/copyright/BSDandGPL.txt new file mode 100644 index 000000000..74d3b29eb --- /dev/null +++ b/hack/copyright/BSDandGPL.txt @@ -0,0 +1,2 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* Copyright Authors of Kmesh */ \ No newline at end of file diff --git a/hack/copyright/apache.txt b/hack/copyright/apache.txt new file mode 100644 index 000000000..b2e5f4829 --- /dev/null +++ b/hack/copyright/apache.txt @@ -0,0 +1,15 @@ +/* + * Copyright 2024 The Kmesh 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. + */ \ No newline at end of file diff --git a/hack/test.sh b/hack/test.sh new file mode 100755 index 000000000..31612ca1d --- /dev/null +++ b/hack/test.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# 文件路径 +target_file="/home/lzcworkspace/library/src/kmesh.net/kmesh/pkg/status/status_server.go" # 目标文件路径 +copyright_file="./hack/copyright/apache.txt" # 版权声明文件路径 + +# 检查文件是否存在 +if [ ! -f "$target_file" ]; then + echo "Target file $target_file does not exist." + exit 1 +fi + +if [ ! -f "$copyright_file" ]; then + echo "Copyright file $copyright_file does not exist." + exit 1 +fi + +# 检查版权文件中的每一行是否存在于目标文件中 +all_lines_present=true +while IFS= read -r line; do + if ! grep -qF -- "$line" "$target_file"; then + all_lines_present=false + echo "Line not found: $line" + break + fi +done < "$copyright_file" + +if [ "$all_lines_present" = true ]; then + echo "The target file contains all lines from the copyright file." +else + echo "The target file does not contain all lines from the copyright file." +fi \ No newline at end of file diff --git a/pkg/status/status_server.go b/pkg/status/status_server.go index ffebe6b54..960546ca3 100644 --- a/pkg/status/status_server.go +++ b/pkg/status/status_server.go @@ -1,19 +1,3 @@ -/* - * Copyright 2024 The Kmesh 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 status import ( From 351d4c070c61bef2d9f7193aa12b3ef95d4440c8 Mon Sep 17 00:00:00 2001 From: LiZhenCheng9527 Date: Thu, 11 Jul 2024 14:27:11 +0800 Subject: [PATCH 2/3] add copyright check script Signed-off-by: LiZhenCheng9527 --- bpf/kmesh/probes/access_log.h | 3 + bpf/kmesh/probes/metrics.h | 3 + bpf/kmesh/probes/probe.h | 3 + hack/copyright-check.sh | 112 ++++++++++++++---- hack/copyright/BSDandGPL1.txt | 2 + .../{BSDandGPL.txt => BSDandGPL2.txt} | 0 hack/copyright/apache.txt | 2 +- hack/test.sh | 3 - pkg/auth/policy_store.go | 2 +- pkg/auth/policy_store_test.go | 2 +- pkg/auth/rbac.go | 2 +- pkg/auth/rbac_test.go | 2 +- pkg/auth/xdp_auth_handler.go | 2 +- pkg/bpf/bpf.go | 2 +- pkg/bpf/bpf_kmesh.go | 2 +- pkg/bpf/bpf_kmesh_common.go | 2 +- pkg/bpf/bpf_kmesh_l4.go | 2 +- pkg/bpf/bpf_kmesh_l4_workload.go | 2 +- pkg/bpf/bpf_kmesh_workload.go | 2 +- pkg/bpf/pin.go | 2 +- pkg/cache/v2/cluster.go | 2 +- pkg/cache/v2/cluster_test.go | 2 +- pkg/cache/v2/listener.go | 2 +- pkg/cache/v2/listener_test.go | 2 +- pkg/cache/v2/maps/cluster.go | 2 +- pkg/cache/v2/maps/common.go | 2 +- pkg/cache/v2/maps/listener.go | 2 +- pkg/cache/v2/maps/route.go | 2 +- pkg/cache/v2/route.go | 2 +- pkg/cache/v2/route_test.go | 2 +- pkg/cni/chained.go | 2 +- pkg/cni/chained_test.go | 2 +- pkg/cni/install.go | 2 +- pkg/cni/kubeconfig.go | 2 +- pkg/cni/plugin/plugin.go | 2 +- pkg/cni/plugin/plugin_test.go | 2 +- pkg/constants/constants.go | 2 +- pkg/controller/ads/ads_controller.go | 2 +- pkg/controller/ads/ads_controller_test.go | 2 +- pkg/controller/ads/ads_processor.go | 2 +- pkg/controller/ads/ads_processor_test.go | 2 +- pkg/controller/ads/cache.go | 2 +- pkg/controller/ads/cache_test.go | 2 +- pkg/controller/ads/convert_filter.go | 2 +- pkg/controller/ads/convert_filter_test.go | 2 +- pkg/controller/bypass/bypass_controller.go | 2 +- pkg/controller/bypass/bypass_test.go | 2 +- pkg/controller/client.go | 2 +- pkg/controller/client_test.go | 2 +- pkg/controller/config/config.go | 4 +- pkg/controller/config/config_test.go | 2 +- pkg/controller/controller.go | 2 +- pkg/controller/interfaces/client.go | 2 +- pkg/controller/manage/kmesh_manage.go | 2 +- pkg/controller/manage/kmesh_manage_test.go | 2 +- pkg/controller/netns/netns.go | 2 +- pkg/controller/security/caclient.go | 2 +- pkg/controller/security/caclient_test.go | 2 +- pkg/controller/security/manager.go | 2 +- pkg/controller/security/manager_test.go | 2 +- pkg/controller/security/mock/mockcaclient.go | 2 +- pkg/controller/security/option.go | 2 +- pkg/controller/telemetry/metric.go | 2 +- pkg/controller/telemetry/metric_test.go | 2 +- pkg/controller/telemetry/utils.go | 2 +- pkg/controller/telemetry/utils_test.go | 2 +- pkg/controller/workload/bpfcache/backend.go | 2 +- pkg/controller/workload/bpfcache/endpoint.go | 2 +- pkg/controller/workload/bpfcache/factory.go | 2 +- pkg/controller/workload/bpfcache/fake_map.go | 2 +- pkg/controller/workload/bpfcache/frontend.go | 2 +- pkg/controller/workload/bpfcache/service.go | 2 +- .../workload/cache/service_cache.go | 2 +- .../workload/cache/workload_cache.go | 2 +- .../workload/cache/workload_cache_test.go | 2 +- .../workload/workload_controller.go | 2 +- .../workload/workload_controller_test.go | 2 +- pkg/controller/workload/workload_hash.go | 2 +- pkg/controller/workload/workload_hash_test.go | 2 +- pkg/controller/workload/workload_processor.go | 2 +- .../workload/workload_processor_test.go | 2 +- pkg/controller/xdstest/fake_xdsclient.go | 2 +- pkg/controller/xdstest/fake_xdsserver.go | 2 +- pkg/dns/dns.go | 2 +- pkg/dns/dns_test.go | 2 +- pkg/logger/logger.go | 2 +- pkg/nets/connect.go | 2 +- pkg/nets/nets.go | 2 +- pkg/nets/nets_test.go | 2 +- pkg/status/api.go | 2 +- pkg/status/status_server.go | 17 ++- pkg/status/status_server_test.go | 2 +- pkg/utils/ebpf.go | 2 +- pkg/utils/exec.go | 2 +- pkg/utils/fileop.go | 2 +- pkg/utils/hash/hash.go | 2 +- pkg/utils/kubeclient.go | 5 +- pkg/utils/nettools.go | 2 +- pkg/utils/test/bpf_map.go | 2 +- pkg/version/version.go | 6 +- 100 files changed, 211 insertions(+), 125 deletions(-) create mode 100644 hack/copyright/BSDandGPL1.txt rename hack/copyright/{BSDandGPL.txt => BSDandGPL2.txt} (100%) diff --git a/bpf/kmesh/probes/access_log.h b/bpf/kmesh/probes/access_log.h index 713c94275..618b4b378 100644 --- a/bpf/kmesh/probes/access_log.h +++ b/bpf/kmesh/probes/access_log.h @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ + #ifndef __KMESH_BPF_ACCESS_LOG_H__ #define __KMESH_BPF_ACCESS_LOG_H__ diff --git a/bpf/kmesh/probes/metrics.h b/bpf/kmesh/probes/metrics.h index 91da8debe..3db66d29b 100644 --- a/bpf/kmesh/probes/metrics.h +++ b/bpf/kmesh/probes/metrics.h @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ + #ifndef __KMESH_BPF_METRICS_H__ #define __KMESH_BPF_METRICS_H__ #include "bpf_common.h" diff --git a/bpf/kmesh/probes/probe.h b/bpf/kmesh/probes/probe.h index ed9b2b423..d726b02e0 100644 --- a/bpf/kmesh/probes/probe.h +++ b/bpf/kmesh/probes/probe.h @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ + #ifndef __KMESH_BPF_PROBE_H__ #define __KMESH_BPF_PROBE_H__ diff --git a/hack/copyright-check.sh b/hack/copyright-check.sh index 520a6707c..018d9deb1 100755 --- a/hack/copyright-check.sh +++ b/hack/copyright-check.sh @@ -1,48 +1,112 @@ #!/bin/bash ROOT_DIR=$(git rev-parse --show-toplevel) -echo $ROOT_DIR -cd $ROOT_DIR -go_copyright=$(cat ./hack/copyright/apache.txt) -echo "$go_copyright" +go_copyright_path=$ROOT_DIR/hack/copyright/apache.txt -c_copyright=$(cat ./hack/copyright/BSDandGPL.txt) -echo "$c_copyright" +c_copyright_path1=$ROOT_DIR/hack/copyright/BSDandGPL1.txt +c_copyright_path2=$ROOT_DIR/hack/copyright/BSDandGPL2.txt -go_dirs="$ROOT_DIR/bpf/kmesh/bpf2go $ROOT_DIR/pkg" +go_dirs="$ROOT_DIR/pkg" +c_dirs="$ROOT_DIR/bpf" + +check=true function check_go_copyright() { - file=$1 - - copyright_found=$(head -n 20 $file | grep -c "$go_copyright") - - if [ $copyright_found -eq 0 ]; then - echo $copyright_found - echo "Copyright missing in $file" - # exit 1 + target_file=$1 + copyright_file=$go_copyright_path + + if [ ! -f "$target_file" ]; then + echo "Target file $target_file does not exist." + exit 1 + fi + + if [ ! -f "$copyright_file" ]; then + echo "Copyright file $copyright_file does not exist." + exit 1 fi - # header_copyright=$(head -n 1 $file) + all_lines_present=true + while IFS= read -r line; do + if ! grep -qF -- "$line" "$target_file"; then + all_lines_present=false + break + fi + done < "$copyright_file" - # if [ "$header_copyright" != "$go_copyright" ]; then - # echo "Copyright doesn't match in $file" - # # exit 1 - # fi + if [ "$all_lines_present" != true ]; then + echo "The target file does not contain all lines from the copyright file." + echo $target_file + fi } -function check_dir() { +function check_c_copyright() { + target_file=$1 + copyright_file1=$c_copyright_path1 + copyright_file2=$c_copyright_path2 + + if [ ! -f "$target_file" ]; then + echo "Target file $target_file does not exist." + exit 1 + fi + + if [ ! -f "$copyright_file1" ]; then + echo "Copyright file $copyright_file1 does not exist." + exit 1 + fi + + if [ ! -f "$copyright_file2" ]; then + echo "Copyright file $copyright_file2 does not exist." + exit 1 + fi + + all_lines_present1=true + while IFS= read -r line; do + if ! grep -qF -- "$line" "$target_file"; then + all_lines_present1=false + break + fi + done < "$copyright_file1" + + all_lines_present2=true + while IFS= read -r line; do + if ! grep -qF -- "$line" "$target_file"; then + all_lines_present2=false + break + fi + done < "$copyright_file2" + + if [ "$all_lines_present1" != true ] && [ "$all_lines_present2" != true ]; then + echo "The target file does not contain all lines from the copyright file." + echo $target_file + fi +} + +function go_check_dir() { dir=$1 find $dir -type f -name "*.go" | while read file; do - echo $file + # echo $file if ! echo $exclude_dirs | grep -q $(dirname $file); then check_go_copyright $file fi done } +function c_check_dir() { + dir=$1 + find $dir -type f -name "*.c" -o -name "*.h" | while read file; do + # echo $file + if ! echo $exclude_dirs | grep -q $(dirname $file); then + check_c_copyright $file + fi + done +} + for dir in ${go_dirs}; do - echo $dir - check_dir $dir + go_check_dir $dir +done + +for dir in ${c_dirs}; do + c_check_dir $dir done echo "Copyright check passed!" \ No newline at end of file diff --git a/hack/copyright/BSDandGPL1.txt b/hack/copyright/BSDandGPL1.txt new file mode 100644 index 000000000..ccaaa529b --- /dev/null +++ b/hack/copyright/BSDandGPL1.txt @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ \ No newline at end of file diff --git a/hack/copyright/BSDandGPL.txt b/hack/copyright/BSDandGPL2.txt similarity index 100% rename from hack/copyright/BSDandGPL.txt rename to hack/copyright/BSDandGPL2.txt diff --git a/hack/copyright/apache.txt b/hack/copyright/apache.txt index b2e5f4829..6e9499eb0 100644 --- a/hack/copyright/apache.txt +++ b/hack/copyright/apache.txt @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/hack/test.sh b/hack/test.sh index 31612ca1d..03c8481b6 100755 --- a/hack/test.sh +++ b/hack/test.sh @@ -1,10 +1,8 @@ #!/bin/sh -# 文件路径 target_file="/home/lzcworkspace/library/src/kmesh.net/kmesh/pkg/status/status_server.go" # 目标文件路径 copyright_file="./hack/copyright/apache.txt" # 版权声明文件路径 -# 检查文件是否存在 if [ ! -f "$target_file" ]; then echo "Target file $target_file does not exist." exit 1 @@ -15,7 +13,6 @@ if [ ! -f "$copyright_file" ]; then exit 1 fi -# 检查版权文件中的每一行是否存在于目标文件中 all_lines_present=true while IFS= read -r line; do if ! grep -qF -- "$line" "$target_file"; then diff --git a/pkg/auth/policy_store.go b/pkg/auth/policy_store.go index 1a8d77a5a..c5818cce9 100644 --- a/pkg/auth/policy_store.go +++ b/pkg/auth/policy_store.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/auth/policy_store_test.go b/pkg/auth/policy_store_test.go index a52df02d9..fcf5dfa2e 100644 --- a/pkg/auth/policy_store_test.go +++ b/pkg/auth/policy_store_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/auth/rbac.go b/pkg/auth/rbac.go index f76dece8f..35f7f3bd0 100644 --- a/pkg/auth/rbac.go +++ b/pkg/auth/rbac.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/auth/rbac_test.go b/pkg/auth/rbac_test.go index be02b62b0..710903fc8 100644 --- a/pkg/auth/rbac_test.go +++ b/pkg/auth/rbac_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/auth/xdp_auth_handler.go b/pkg/auth/xdp_auth_handler.go index 5d515f672..5fb0a40d7 100644 --- a/pkg/auth/xdp_auth_handler.go +++ b/pkg/auth/xdp_auth_handler.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/bpf/bpf.go b/pkg/bpf/bpf.go index 855e1fc67..764637291 100644 --- a/pkg/bpf/bpf.go +++ b/pkg/bpf/bpf.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/bpf/bpf_kmesh.go b/pkg/bpf/bpf_kmesh.go index e1a9e109e..390276f2c 100644 --- a/pkg/bpf/bpf_kmesh.go +++ b/pkg/bpf/bpf_kmesh.go @@ -2,7 +2,7 @@ // +build enhanced /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/bpf/bpf_kmesh_common.go b/pkg/bpf/bpf_kmesh_common.go index be28fa902..7c9f3bf28 100644 --- a/pkg/bpf/bpf_kmesh_common.go +++ b/pkg/bpf/bpf_kmesh_common.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/bpf/bpf_kmesh_l4.go b/pkg/bpf/bpf_kmesh_l4.go index b6ff9bc66..70fd6fa94 100644 --- a/pkg/bpf/bpf_kmesh_l4.go +++ b/pkg/bpf/bpf_kmesh_l4.go @@ -2,7 +2,7 @@ // +build !enhanced /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/bpf/bpf_kmesh_l4_workload.go b/pkg/bpf/bpf_kmesh_l4_workload.go index 826f49ea6..fb6fcd437 100644 --- a/pkg/bpf/bpf_kmesh_l4_workload.go +++ b/pkg/bpf/bpf_kmesh_l4_workload.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/bpf/bpf_kmesh_workload.go b/pkg/bpf/bpf_kmesh_workload.go index 5c508408e..e1e9ac7c1 100644 --- a/pkg/bpf/bpf_kmesh_workload.go +++ b/pkg/bpf/bpf_kmesh_workload.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/bpf/pin.go b/pkg/bpf/pin.go index e6ba762d0..24691da23 100644 --- a/pkg/bpf/pin.go +++ b/pkg/bpf/pin.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cache/v2/cluster.go b/pkg/cache/v2/cluster.go index ddd95934e..357d5243e 100644 --- a/pkg/cache/v2/cluster.go +++ b/pkg/cache/v2/cluster.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cache/v2/cluster_test.go b/pkg/cache/v2/cluster_test.go index 523941331..851c7d38b 100644 --- a/pkg/cache/v2/cluster_test.go +++ b/pkg/cache/v2/cluster_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cache/v2/listener.go b/pkg/cache/v2/listener.go index cd58456a3..33fa9a85a 100644 --- a/pkg/cache/v2/listener.go +++ b/pkg/cache/v2/listener.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cache/v2/listener_test.go b/pkg/cache/v2/listener_test.go index 0d052d03c..f4f26bda7 100644 --- a/pkg/cache/v2/listener_test.go +++ b/pkg/cache/v2/listener_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cache/v2/maps/cluster.go b/pkg/cache/v2/maps/cluster.go index e18024c91..cd29529e5 100644 --- a/pkg/cache/v2/maps/cluster.go +++ b/pkg/cache/v2/maps/cluster.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cache/v2/maps/common.go b/pkg/cache/v2/maps/common.go index ee193b304..f8f0fc1db 100644 --- a/pkg/cache/v2/maps/common.go +++ b/pkg/cache/v2/maps/common.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cache/v2/maps/listener.go b/pkg/cache/v2/maps/listener.go index 2390c14d2..c1735414f 100644 --- a/pkg/cache/v2/maps/listener.go +++ b/pkg/cache/v2/maps/listener.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cache/v2/maps/route.go b/pkg/cache/v2/maps/route.go index 5addf1f7e..60f3c6ef0 100644 --- a/pkg/cache/v2/maps/route.go +++ b/pkg/cache/v2/maps/route.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cache/v2/route.go b/pkg/cache/v2/route.go index d5f35c588..929a12ec2 100644 --- a/pkg/cache/v2/route.go +++ b/pkg/cache/v2/route.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cache/v2/route_test.go b/pkg/cache/v2/route_test.go index 4b1b79740..1dba73206 100644 --- a/pkg/cache/v2/route_test.go +++ b/pkg/cache/v2/route_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cni/chained.go b/pkg/cni/chained.go index 252ea6d8e..5308674d8 100644 --- a/pkg/cni/chained.go +++ b/pkg/cni/chained.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cni/chained_test.go b/pkg/cni/chained_test.go index c4e0f13c2..9c8efeb45 100644 --- a/pkg/cni/chained_test.go +++ b/pkg/cni/chained_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cni/install.go b/pkg/cni/install.go index cca6d4ee4..bacefc710 100644 --- a/pkg/cni/install.go +++ b/pkg/cni/install.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cni/kubeconfig.go b/pkg/cni/kubeconfig.go index e5863bbf2..531981495 100644 --- a/pkg/cni/kubeconfig.go +++ b/pkg/cni/kubeconfig.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cni/plugin/plugin.go b/pkg/cni/plugin/plugin.go index 884e04f77..c3115ae36 100644 --- a/pkg/cni/plugin/plugin.go +++ b/pkg/cni/plugin/plugin.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/cni/plugin/plugin_test.go b/pkg/cni/plugin/plugin_test.go index a47eb859b..c751c4bc6 100644 --- a/pkg/cni/plugin/plugin_test.go +++ b/pkg/cni/plugin/plugin_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 56014687f..8bf24b05c 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/ads/ads_controller.go b/pkg/controller/ads/ads_controller.go index 4a59adcd7..c10e18364 100644 --- a/pkg/controller/ads/ads_controller.go +++ b/pkg/controller/ads/ads_controller.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/ads/ads_controller_test.go b/pkg/controller/ads/ads_controller_test.go index 1badf456c..a3e36425a 100644 --- a/pkg/controller/ads/ads_controller_test.go +++ b/pkg/controller/ads/ads_controller_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/ads/ads_processor.go b/pkg/controller/ads/ads_processor.go index 0a48d1e79..221516a72 100644 --- a/pkg/controller/ads/ads_processor.go +++ b/pkg/controller/ads/ads_processor.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/ads/ads_processor_test.go b/pkg/controller/ads/ads_processor_test.go index c1e4f22d3..4ba9c379e 100644 --- a/pkg/controller/ads/ads_processor_test.go +++ b/pkg/controller/ads/ads_processor_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/ads/cache.go b/pkg/controller/ads/cache.go index a945a5b3a..6e6f75229 100644 --- a/pkg/controller/ads/cache.go +++ b/pkg/controller/ads/cache.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/ads/cache_test.go b/pkg/controller/ads/cache_test.go index 0b3c5bf83..831016741 100644 --- a/pkg/controller/ads/cache_test.go +++ b/pkg/controller/ads/cache_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/ads/convert_filter.go b/pkg/controller/ads/convert_filter.go index f0749cfad..21cf0b80a 100644 --- a/pkg/controller/ads/convert_filter.go +++ b/pkg/controller/ads/convert_filter.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/ads/convert_filter_test.go b/pkg/controller/ads/convert_filter_test.go index 046d5fbe5..de6140e5d 100644 --- a/pkg/controller/ads/convert_filter_test.go +++ b/pkg/controller/ads/convert_filter_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/bypass/bypass_controller.go b/pkg/controller/bypass/bypass_controller.go index afde1377a..7cdef6c72 100644 --- a/pkg/controller/bypass/bypass_controller.go +++ b/pkg/controller/bypass/bypass_controller.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/bypass/bypass_test.go b/pkg/controller/bypass/bypass_test.go index d9e67a110..e34a0b582 100644 --- a/pkg/controller/bypass/bypass_test.go +++ b/pkg/controller/bypass/bypass_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/client.go b/pkg/controller/client.go index c7e042c68..ae2d99e0e 100644 --- a/pkg/controller/client.go +++ b/pkg/controller/client.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/client_test.go b/pkg/controller/client_test.go index dd04fd30d..017e44200 100644 --- a/pkg/controller/client_test.go +++ b/pkg/controller/client_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/config/config.go b/pkg/controller/config/config.go index bd34d37db..adc2000fc 100644 --- a/pkg/controller/config/config.go +++ b/pkg/controller/config/config.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ import ( // in order to fix: could not resolve Any message type _ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/router/v3" _ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" - _ "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3" // nolint + _ "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3" "kmesh.net/kmesh/pkg/constants" "kmesh.net/kmesh/pkg/logger" diff --git a/pkg/controller/config/config_test.go b/pkg/controller/config/config_test.go index 55c2a7f2c..6bb548adf 100644 --- a/pkg/controller/config/config_test.go +++ b/pkg/controller/config/config_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index be5c3684f..2563815c2 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/interfaces/client.go b/pkg/controller/interfaces/client.go index 11c1e7ffe..dcf3f1398 100644 --- a/pkg/controller/interfaces/client.go +++ b/pkg/controller/interfaces/client.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/manage/kmesh_manage.go b/pkg/controller/manage/kmesh_manage.go index f79dee4af..26d2275f2 100644 --- a/pkg/controller/manage/kmesh_manage.go +++ b/pkg/controller/manage/kmesh_manage.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/manage/kmesh_manage_test.go b/pkg/controller/manage/kmesh_manage_test.go index ad4bac1ee..c2be13c56 100644 --- a/pkg/controller/manage/kmesh_manage_test.go +++ b/pkg/controller/manage/kmesh_manage_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/netns/netns.go b/pkg/controller/netns/netns.go index cf6a209c3..6cdcee62e 100644 --- a/pkg/controller/netns/netns.go +++ b/pkg/controller/netns/netns.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/security/caclient.go b/pkg/controller/security/caclient.go index 284c9f8bc..70f36e1b2 100644 --- a/pkg/controller/security/caclient.go +++ b/pkg/controller/security/caclient.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/security/caclient_test.go b/pkg/controller/security/caclient_test.go index 5c6b5559a..4a0e5bcfc 100644 --- a/pkg/controller/security/caclient_test.go +++ b/pkg/controller/security/caclient_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/security/manager.go b/pkg/controller/security/manager.go index 5e34d8c7e..6521664fb 100644 --- a/pkg/controller/security/manager.go +++ b/pkg/controller/security/manager.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/security/manager_test.go b/pkg/controller/security/manager_test.go index 3bd29bd6e..328740da4 100644 --- a/pkg/controller/security/manager_test.go +++ b/pkg/controller/security/manager_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/security/mock/mockcaclient.go b/pkg/controller/security/mock/mockcaclient.go index 9ac7b5ebf..f23aac785 100644 --- a/pkg/controller/security/mock/mockcaclient.go +++ b/pkg/controller/security/mock/mockcaclient.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/security/option.go b/pkg/controller/security/option.go index 8cf9b2ff3..42988f501 100644 --- a/pkg/controller/security/option.go +++ b/pkg/controller/security/option.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/telemetry/metric.go b/pkg/controller/telemetry/metric.go index bef28b27b..80bf00d15 100644 --- a/pkg/controller/telemetry/metric.go +++ b/pkg/controller/telemetry/metric.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/telemetry/metric_test.go b/pkg/controller/telemetry/metric_test.go index ebc9eee7a..d909eb649 100644 --- a/pkg/controller/telemetry/metric_test.go +++ b/pkg/controller/telemetry/metric_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/telemetry/utils.go b/pkg/controller/telemetry/utils.go index f0da6395f..f50fa83bc 100644 --- a/pkg/controller/telemetry/utils.go +++ b/pkg/controller/telemetry/utils.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/telemetry/utils_test.go b/pkg/controller/telemetry/utils_test.go index 544c7b539..7b3989a72 100644 --- a/pkg/controller/telemetry/utils_test.go +++ b/pkg/controller/telemetry/utils_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/bpfcache/backend.go b/pkg/controller/workload/bpfcache/backend.go index 2eb853f67..8178dc520 100644 --- a/pkg/controller/workload/bpfcache/backend.go +++ b/pkg/controller/workload/bpfcache/backend.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/bpfcache/endpoint.go b/pkg/controller/workload/bpfcache/endpoint.go index 38c88f6f8..bb0801d8b 100644 --- a/pkg/controller/workload/bpfcache/endpoint.go +++ b/pkg/controller/workload/bpfcache/endpoint.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/bpfcache/factory.go b/pkg/controller/workload/bpfcache/factory.go index 7fa1fe3b2..819f0e50a 100644 --- a/pkg/controller/workload/bpfcache/factory.go +++ b/pkg/controller/workload/bpfcache/factory.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/bpfcache/fake_map.go b/pkg/controller/workload/bpfcache/fake_map.go index 0d1b4248b..d17a45c3e 100644 --- a/pkg/controller/workload/bpfcache/fake_map.go +++ b/pkg/controller/workload/bpfcache/fake_map.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/bpfcache/frontend.go b/pkg/controller/workload/bpfcache/frontend.go index 804afc304..4856d5e7e 100644 --- a/pkg/controller/workload/bpfcache/frontend.go +++ b/pkg/controller/workload/bpfcache/frontend.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/bpfcache/service.go b/pkg/controller/workload/bpfcache/service.go index 833f83752..c7394cde9 100644 --- a/pkg/controller/workload/bpfcache/service.go +++ b/pkg/controller/workload/bpfcache/service.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/cache/service_cache.go b/pkg/controller/workload/cache/service_cache.go index e9398c48c..8ec056aca 100644 --- a/pkg/controller/workload/cache/service_cache.go +++ b/pkg/controller/workload/cache/service_cache.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/cache/workload_cache.go b/pkg/controller/workload/cache/workload_cache.go index 3c0da4b05..680ef8800 100644 --- a/pkg/controller/workload/cache/workload_cache.go +++ b/pkg/controller/workload/cache/workload_cache.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/cache/workload_cache_test.go b/pkg/controller/workload/cache/workload_cache_test.go index 4691320d6..29e90f915 100644 --- a/pkg/controller/workload/cache/workload_cache_test.go +++ b/pkg/controller/workload/cache/workload_cache_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/workload_controller.go b/pkg/controller/workload/workload_controller.go index f41e541ba..62a50ab8a 100644 --- a/pkg/controller/workload/workload_controller.go +++ b/pkg/controller/workload/workload_controller.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/workload_controller_test.go b/pkg/controller/workload/workload_controller_test.go index cf501b9b0..a620eb9c1 100644 --- a/pkg/controller/workload/workload_controller_test.go +++ b/pkg/controller/workload/workload_controller_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/workload_hash.go b/pkg/controller/workload/workload_hash.go index 63030503c..d066a25b6 100644 --- a/pkg/controller/workload/workload_hash.go +++ b/pkg/controller/workload/workload_hash.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/workload_hash_test.go b/pkg/controller/workload/workload_hash_test.go index 98e56c7dd..b079cfa3b 100644 --- a/pkg/controller/workload/workload_hash_test.go +++ b/pkg/controller/workload/workload_hash_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/workload_processor.go b/pkg/controller/workload/workload_processor.go index 4016d0e13..ddfbcc79c 100644 --- a/pkg/controller/workload/workload_processor.go +++ b/pkg/controller/workload/workload_processor.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/workload/workload_processor_test.go b/pkg/controller/workload/workload_processor_test.go index 54354d2be..0fe2c333a 100644 --- a/pkg/controller/workload/workload_processor_test.go +++ b/pkg/controller/workload/workload_processor_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/xdstest/fake_xdsclient.go b/pkg/controller/xdstest/fake_xdsclient.go index 489338128..a53b08aa4 100644 --- a/pkg/controller/xdstest/fake_xdsclient.go +++ b/pkg/controller/xdstest/fake_xdsclient.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/controller/xdstest/fake_xdsserver.go b/pkg/controller/xdstest/fake_xdsserver.go index 8a73b619f..019248236 100644 --- a/pkg/controller/xdstest/fake_xdsserver.go +++ b/pkg/controller/xdstest/fake_xdsserver.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/dns/dns.go b/pkg/dns/dns.go index b6053e0a8..9630d4d4d 100644 --- a/pkg/dns/dns.go +++ b/pkg/dns/dns.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/dns/dns_test.go b/pkg/dns/dns_test.go index b1d20db6d..13fc23567 100644 --- a/pkg/dns/dns_test.go +++ b/pkg/dns/dns_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index 3ca4b9e55..76351d9ef 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/nets/connect.go b/pkg/nets/connect.go index 0d56eb761..d76430c41 100644 --- a/pkg/nets/connect.go +++ b/pkg/nets/connect.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/nets/nets.go b/pkg/nets/nets.go index 417050a66..542be582a 100644 --- a/pkg/nets/nets.go +++ b/pkg/nets/nets.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/nets/nets_test.go b/pkg/nets/nets_test.go index e8071a1bf..0c9a9dc7b 100644 --- a/pkg/nets/nets_test.go +++ b/pkg/nets/nets_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/status/api.go b/pkg/status/api.go index 8cbed740a..5f85c07c8 100644 --- a/pkg/status/api.go +++ b/pkg/status/api.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/status/status_server.go b/pkg/status/status_server.go index 960546ca3..00b1e4b42 100644 --- a/pkg/status/status_server.go +++ b/pkg/status/status_server.go @@ -1,3 +1,19 @@ +/* + * Copyright The Kmesh 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 status import ( @@ -9,7 +25,6 @@ import ( "strconv" "time" - // nolint "github.com/cilium/ebpf" "github.com/sirupsen/logrus" "google.golang.org/protobuf/encoding/protojson" diff --git a/pkg/status/status_server_test.go b/pkg/status/status_server_test.go index e51afc569..b3cdedcbc 100644 --- a/pkg/status/status_server_test.go +++ b/pkg/status/status_server_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/utils/ebpf.go b/pkg/utils/ebpf.go index 103512684..1b0ea06c0 100644 --- a/pkg/utils/ebpf.go +++ b/pkg/utils/ebpf.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/utils/exec.go b/pkg/utils/exec.go index eddbd1df4..b51142ee2 100644 --- a/pkg/utils/exec.go +++ b/pkg/utils/exec.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/utils/fileop.go b/pkg/utils/fileop.go index e04952c92..7299f21da 100644 --- a/pkg/utils/fileop.go +++ b/pkg/utils/fileop.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/utils/hash/hash.go b/pkg/utils/hash/hash.go index 609a338b6..d725d45f4 100644 --- a/pkg/utils/hash/hash.go +++ b/pkg/utils/hash/hash.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/utils/kubeclient.go b/pkg/utils/kubeclient.go index a094b4a8a..87ec0c630 100644 --- a/pkg/utils/kubeclient.go +++ b/pkg/utils/kubeclient.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,9 +12,6 @@ * 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. - * - * Author: bitcoffee - * Create: 2023-11-19 */ package utils diff --git a/pkg/utils/nettools.go b/pkg/utils/nettools.go index 17d24fddf..13c9416a7 100644 --- a/pkg/utils/nettools.go +++ b/pkg/utils/nettools.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/utils/test/bpf_map.go b/pkg/utils/test/bpf_map.go index e82ba621a..5f680f9d6 100644 --- a/pkg/utils/test/bpf_map.go +++ b/pkg/utils/test/bpf_map.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pkg/version/version.go b/pkg/version/version.go index 1341c24b7..82cfb6a79 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -10,8 +10,10 @@ * 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. - * Create: 2024-5-23 + * See the License for the specific language governing permissions and + * limitations under the License. */ + package version import ( From 9360353b85baa52f15351671856f49e7166e9189 Mon Sep 17 00:00:00 2001 From: LiZhenCheng9527 Date: Thu, 11 Jul 2024 15:55:23 +0800 Subject: [PATCH 3/3] add copyright check in github ci Signed-off-by: LiZhenCheng9527 --- .github/workflows/main.yml | 4 ++++ bpf/kmesh/bpf2go/bpf2go.go | 2 +- hack/copyright-check.sh | 35 +++++++++++++++++++++++++---------- hack/test.sh | 29 ----------------------------- 4 files changed, 30 insertions(+), 40 deletions(-) delete mode 100755 hack/test.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a54872e3..9b7abd4a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,6 +24,10 @@ jobs: run: | make gen-check + - name: Run Copyright-check + run : | + make ./hack/copyright-check.sh + - name: Build Kmesh shell: bash run: | diff --git a/bpf/kmesh/bpf2go/bpf2go.go b/bpf/kmesh/bpf2go/bpf2go.go index 8e3fcebca..7a1614dcb 100644 --- a/bpf/kmesh/bpf2go/bpf2go.go +++ b/bpf/kmesh/bpf2go/bpf2go.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Kmesh Authors. + * Copyright The Kmesh Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/hack/copyright-check.sh b/hack/copyright-check.sh index 018d9deb1..66dbdc957 100755 --- a/hack/copyright-check.sh +++ b/hack/copyright-check.sh @@ -1,4 +1,5 @@ #!/bin/bash + ROOT_DIR=$(git rev-parse --show-toplevel) go_copyright_path=$ROOT_DIR/hack/copyright/apache.txt @@ -9,8 +10,6 @@ c_copyright_path2=$ROOT_DIR/hack/copyright/BSDandGPL2.txt go_dirs="$ROOT_DIR/pkg" c_dirs="$ROOT_DIR/bpf" -check=true - function check_go_copyright() { target_file=$1 copyright_file=$go_copyright_path @@ -36,7 +35,7 @@ function check_go_copyright() { if [ "$all_lines_present" != true ]; then echo "The target file does not contain all lines from the copyright file." echo $target_file - fi + fi } function check_c_copyright() { @@ -101,12 +100,28 @@ function c_check_dir() { done } -for dir in ${go_dirs}; do - go_check_dir $dir -done +function copyright_check() { + for dir in ${go_dirs}; do + go_check_dir $dir + done + + for dir in ${c_dirs}; do + c_check_dir $dir + done +} -for dir in ${c_dirs}; do - c_check_dir $dir -done +# Confirmation of whether there are files with wrong copyright +if [ -z "$1" -o "$1" == "-c" -o "$1" == "--check" ]; then + result=$(copyright_check | grep -c 'not contain') + if [ "$result" != 0 ]; then + echo "ERROR: Some files need to be update copyright, please run "./hack/copyright-check -g" and update and include any changed files in your PR" + exit 1 + else + echo "pass copyright check" + fi +fi -echo "Copyright check passed!" \ No newline at end of file +# Obtaining the name of a file that with wrong copyright +if [ "$1" == "-g" -o "$1" == "--get" ]; then + copyright_check +fi diff --git a/hack/test.sh b/hack/test.sh deleted file mode 100755 index 03c8481b6..000000000 --- a/hack/test.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -target_file="/home/lzcworkspace/library/src/kmesh.net/kmesh/pkg/status/status_server.go" # 目标文件路径 -copyright_file="./hack/copyright/apache.txt" # 版权声明文件路径 - -if [ ! -f "$target_file" ]; then - echo "Target file $target_file does not exist." - exit 1 -fi - -if [ ! -f "$copyright_file" ]; then - echo "Copyright file $copyright_file does not exist." - exit 1 -fi - -all_lines_present=true -while IFS= read -r line; do - if ! grep -qF -- "$line" "$target_file"; then - all_lines_present=false - echo "Line not found: $line" - break - fi -done < "$copyright_file" - -if [ "$all_lines_present" = true ]; then - echo "The target file contains all lines from the copyright file." -else - echo "The target file does not contain all lines from the copyright file." -fi \ No newline at end of file