This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 8828c01  ci: replace license header checker and formatter (#1077)
8828c01 is described below

commit 8828c0170f1aa327492585444521da372f58b968
Author: tison <[email protected]>
AuthorDate: Tue Aug 15 23:33:17 2023 +0800

    ci: replace license header checker and formatter (#1077)
    
    This refers to #1075.
    
    korandoru/hawkeye can auto-format all the incoming files at once.
    
    Signed-off-by: tison <[email protected]>
---
 .asf.yaml                                       |   2 -
 .github/workflows/ci.yml                        |   5 +-
 Dockerfile                                      |   2 -
 integration-tests/certs/generate.sh             |   3 +-
 integration-tests/license_test.go               | 118 ------------------------
 integration-tests/pb/build.sh                   |   3 +-
 integration-tests/pb/hello.proto                |   3 +-
 integration-tests/pb/hi.proto                   |  19 ++++
 integration-tests/pb/build.sh => licenserc.toml |  17 ++--
 pulsar/internal/pulsar_proto/PulsarApi.proto    |   3 +-
 scripts/pulsar-test-service-start.sh            |   3 +-
 scripts/pulsar-test-service-stop.sh             |   3 +-
 scripts/run-ci.sh                               |   3 +-
 13 files changed, 40 insertions(+), 144 deletions(-)

diff --git a/.asf.yaml b/.asf.yaml
index 05e8ef3..246ec81 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,7 +14,6 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-#
 
 github:
   description: "Apache Pulsar Go Client Library"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7c946b7..f0c9b63 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -29,7 +29,10 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
-      - run: make lint
+      - name: Check license header
+        run: docker run --rm -v $(pwd):/github/workspace 
ghcr.io/korandoru/hawkeye-native:v3 check
+      - name: Run golangci-lint
+        run: make lint
 
   integration-tests:
     runs-on: ubuntu-latest
diff --git a/Dockerfile b/Dockerfile
index 07eff8e..1c137fc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,7 +14,6 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-#
 
 # Explicit version of Pulsar and Golang images should be
 # set via the Makefile or CLI
diff --git a/integration-tests/certs/generate.sh 
b/integration-tests/certs/generate.sh
index 9294e03..ea365c1 100755
--- a/integration-tests/certs/generate.sh
+++ b/integration-tests/certs/generate.sh
@@ -1,5 +1,4 @@
 #!/bin/bash
-#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -16,7 +15,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-#
+
 
 export CA_HOME=$(pwd)
 echo $CA_HOME
diff --git a/integration-tests/license_test.go 
b/integration-tests/license_test.go
deleted file mode 100644
index ac89eb4..0000000
--- a/integration-tests/license_test.go
+++ /dev/null
@@ -1,118 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you 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 license_test
-
-import (
-       "os"
-       "path/filepath"
-       "regexp"
-       "testing"
-)
-
-var goFileCheck = regexp.MustCompile(`// Licensed to the Apache Software 
Foundation \(ASF\) under one
-// or more contributor license agreements\.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership\.  The ASF licenses this file
-// to you 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\.
-
-`)
-
-var otherCheck = regexp.MustCompile(`#
-# Licensed to the Apache Software Foundation \(ASF\) under one
-# or more contributor license agreements\.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership\.  The ASF licenses this file
-# to you 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\.
-#
-`)
-
-var skip = map[string]bool{
-       "../pulsar/internal/pulsar_proto/PulsarApi.pb.go": true,
-       "../.github/workflows/bot.yaml":                   true,
-       "../integration-tests/pb/hello.pb.go":             true,
-       "../integration-tests/.htpasswd":                  true,
-}
-
-func TestLicense(t *testing.T) {
-       err := filepath.Walk("../.", func(path string, fi os.FileInfo, err 
error) error {
-               if skip[path] {
-                       return nil
-               }
-
-               if err != nil {
-                       return err
-               }
-
-               switch filepath.Ext(path) {
-               case ".go":
-                       src, err := os.ReadFile(path)
-                       if err != nil {
-                               return nil
-                       }
-
-                       // Find license
-                       if !goFileCheck.Match(src) {
-                               t.Errorf("%v: license header not present", path)
-                               return nil
-                       }
-               case ".yaml":
-                       fallthrough
-               case ".conf":
-                       src, err := os.ReadFile(path)
-                       if err != nil {
-                               return nil
-                       }
-
-                       // Find license
-                       if !otherCheck.Match(src) {
-                               t.Errorf("%v: license header not present", path)
-                               return nil
-                       }
-
-               default:
-                       return nil
-               }
-
-               return nil
-       })
-       if err != nil {
-               t.Fatal(err)
-       }
-}
diff --git a/integration-tests/pb/build.sh b/integration-tests/pb/build.sh
index e192458..6511472 100755
--- a/integration-tests/pb/build.sh
+++ b/integration-tests/pb/build.sh
@@ -1,5 +1,4 @@
 #!/usr/bin/env bash
-#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -16,7 +15,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-#
+
 
 PROJECT_DIR=$(git rev-parse --show-toplevel)
 SOURCE_PATH="$PROJECT_DIR/integration-tests/pb"
diff --git a/integration-tests/pb/hello.proto b/integration-tests/pb/hello.proto
index ca6a4ff..5b33a52 100644
--- a/integration-tests/pb/hello.proto
+++ b/integration-tests/pb/hello.proto
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -16,6 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 syntax = "proto3";
 package prototest;
 
diff --git a/integration-tests/pb/hi.proto b/integration-tests/pb/hi.proto
index f5a401a..2f50ce3 100644
--- a/integration-tests/pb/hi.proto
+++ b/integration-tests/pb/hi.proto
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
 syntax = "proto3";
 package prototest;
 
diff --git a/integration-tests/pb/build.sh b/licenserc.toml
old mode 100755
new mode 100644
similarity index 73%
copy from integration-tests/pb/build.sh
copy to licenserc.toml
index e192458..4ca4e14
--- a/integration-tests/pb/build.sh
+++ b/licenserc.toml
@@ -1,5 +1,3 @@
-#!/usr/bin/env bash
-#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -16,11 +14,12 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-#
 
-PROJECT_DIR=$(git rev-parse --show-toplevel)
-SOURCE_PATH="$PROJECT_DIR/integration-tests/pb"
-DEST_PATH="$PROJECT_DIR/integration-tests/pb"
-echo "source_path: $SOURCE_PATH"
-echo "dest_path: $DEST_PATH"
-protoc -I=$SOURCE_PATH --go_out=$DEST_PATH $SOURCE_PATH/*.proto
+headerPath = "Apache-2.0-ASF.txt"
+
+excludes = [
+    "*.txt",
+]
+
+[mapping.DOUBLESLASH_STYLE]
+extensions = ["go"]
diff --git a/pulsar/internal/pulsar_proto/PulsarApi.proto 
b/pulsar/internal/pulsar_proto/PulsarApi.proto
index 0c72361..8bd7572 100644
--- a/pulsar/internal/pulsar_proto/PulsarApi.proto
+++ b/pulsar/internal/pulsar_proto/PulsarApi.proto
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -16,6 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 syntax = "proto2";
 
 package pulsar.proto;
diff --git a/scripts/pulsar-test-service-start.sh 
b/scripts/pulsar-test-service-start.sh
index ed90b06..1f62558 100755
--- a/scripts/pulsar-test-service-start.sh
+++ b/scripts/pulsar-test-service-start.sh
@@ -1,5 +1,4 @@
 #!/bin/bash
-#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -16,7 +15,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-#
+
 
 set -e
 
diff --git a/scripts/pulsar-test-service-stop.sh 
b/scripts/pulsar-test-service-stop.sh
index eafccd9..fffcd8b 100755
--- a/scripts/pulsar-test-service-stop.sh
+++ b/scripts/pulsar-test-service-stop.sh
@@ -1,5 +1,4 @@
 #!/bin/bash
-#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -16,7 +15,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-#
+
 
 set -e
 
diff --git a/scripts/run-ci.sh b/scripts/run-ci.sh
index 8eebdec..cc4f6a1 100755
--- a/scripts/run-ci.sh
+++ b/scripts/run-ci.sh
@@ -1,5 +1,4 @@
 #!/bin/bash
-#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -16,7 +15,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-#
+
 
 set -e -x
 

Reply via email to