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

mmerli 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 e95cf06  [ci] update and simplify GitHub workflow (#796)
e95cf06 is described below

commit e95cf063334886846c3c691a55bc1deee34add3d
Author: Paul Gier <paul.g...@datastax.com>
AuthorDate: Thu Jun 30 14:57:35 2022 -0500

    [ci] update and simplify GitHub workflow (#796)
    
    * update github workflow
    
    - Use current version of github actions
    - Use golang-ci-lint action instead of manual install
    - Enable default linters
    - Combine integration test config into a single github workflow file
    
    Signed-off-by: Paul Gier <paul.g...@datastax.com>
    
    * enable 'ineffassign' linter and fix errors
    
    Signed-off-by: Paul Gier <paul.g...@datastax.com>
    
    * enable 'unused' linter and fix errors
    
    Signed-off-by: Paul Gier <paul.g...@datastax.com>
---
 .github/workflows/go.yml      | 26 --------------------------
 .github/workflows/project.yml | 40 ++++++++++++++++++++++++----------------
 .golangci.yml                 | 22 ++++++++++++----------
 pulsar/internal/connection.go |  6 ------
 pulsar/schema_test.go         |  3 +++
 5 files changed, 39 insertions(+), 58 deletions(-)

diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
deleted file mode 100644
index 1819b53..0000000
--- a/.github/workflows/go.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: Go
-on: [pull_request]
-jobs:
-  build:
-    name: Build
-    runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        go-version: [1.15, 1.16, 1.17, 1.18]
-    steps:
-      - name: clean docker cache
-        run: |
-          docker rmi $(docker images -q) -f
-          df -h
-      - name: Set up Go
-        uses: actions/setup-go@v1
-        with:
-          go-version: ${{ matrix.go-version }}
-        id: go
-
-      - name: Check out code into the Go module directory
-        uses: actions/checkout@v2
-
-      - name: Test
-        run: |
-          ./docker-ci.sh ${{ matrix.go-version }}
diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml
index ce8545b..16518ad 100644
--- a/.github/workflows/project.yml
+++ b/.github/workflows/project.yml
@@ -1,30 +1,38 @@
-name: Project Style Check
+name: CI
 on: [pull_request]
 jobs:
   build:
-    name: Build
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/setup-go@v3
+      - name: build
+        run: go build ./pulsar
+
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: golangci/golangci-lint-action@v3
+
+  integration-tests:
     runs-on: ubuntu-latest
     strategy:
       matrix:
         go-version: [1.15, 1.16, 1.17, 1.18]
     steps:
-      - name: Set up Go
-        uses: actions/setup-go@v1
+      - name: clean docker cache
+        run: |
+          docker rmi $(docker images -q) -f
+          df -h
+
+      - uses: actions/setup-go@v3
         with:
           go-version: ${{ matrix.go-version }}
-        id: go
 
       - name: Check out code into the Go module directory
-        uses: actions/checkout@v1
-
-      - name: InstallTool
-        run: |
-          wget -O - -q 
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh 
-s v1.46.2
-          ./bin/golangci-lint --version
-
-      - name: Build
-        run: go build ./pulsar
+        uses: actions/checkout@v3
 
-      - name: CheckStyle
+      - name: Run Tests
         run: |
-          ./bin/golangci-lint run -c ./.golangci.yml ./...
+          ./docker-ci.sh ${{ matrix.go-version }}
diff --git a/.golangci.yml b/.golangci.yml
index 525d34c..2dc120a 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -5,20 +5,22 @@ run:
   deadline: 6m
 
 linters:
-  disable-all: true
+  # Uncomment this line to run only the explicitly enabled linters
+  # disable-all: true
+
+  # Run these linters in addition to the default ones
   enable:
     - bodyclose
-    - deadcode
     - goimports
-    - revive
-    - gosimple
-    - govet
+    - lll
     - misspell
-    - structcheck
+    - prealloc
+    - revive
     - stylecheck
-    - typecheck
     - unconvert
     - unparam
-    - varcheck
-    - lll
-    - prealloc
+
+  # Disable these default linters
+  disable:
+    - errcheck
+    - staticcheck
diff --git a/pulsar/internal/connection.go b/pulsar/internal/connection.go
index 0249020..318ec89 100644
--- a/pulsar/internal/connection.go
+++ b/pulsar/internal/connection.go
@@ -148,8 +148,6 @@ type connection struct {
 
        log log.Logger
 
-       requestIDGenerator uint64
-
        incomingRequestsWG sync.WaitGroup
        incomingRequestsCh chan *request
        incomingCmdCh      chan *incomingCmd
@@ -957,10 +955,6 @@ func (c *connection) closed() bool {
        return connectionClosed == c.getState()
 }
 
-func (c *connection) newRequestID() uint64 {
-       return atomic.AddUint64(&c.requestIDGenerator, 1)
-}
-
 func (c *connection) getTLSConfig() (*tls.Config, error) {
        tlsConfig := &tls.Config{
                InsecureSkipVerify: c.tlsOptions.AllowInsecureConnection,
diff --git a/pulsar/schema_test.go b/pulsar/schema_test.go
index 1aa35f0..e7d52ca 100644
--- a/pulsar/schema_test.go
+++ b/pulsar/schema_test.go
@@ -84,6 +84,7 @@ func TestJsonSchema(t *testing.T) {
 
        consumerJS, err := NewJSONSchemaWithValidation(exampleSchemaDef, nil)
        assert.Nil(t, err)
+       assert.NotNil(t, consumerJS)
        consumerJS = NewJSONSchema(exampleSchemaDef, nil) // test this legacy 
function
        consumer, err := client.Subscribe(ConsumerOptions{
                Topic:                       "jsonTopic",
@@ -109,6 +110,7 @@ func TestProtoSchema(t *testing.T) {
        // create producer
        psProducer, err := NewProtoSchemaWithValidation(protoSchemaDef, nil)
        assert.Nil(t, err)
+       assert.NotNil(t, psProducer)
        psProducer = NewProtoSchema(protoSchemaDef, nil)
        producer, err := client.CreateProducer(ProducerOptions{
                Topic:  "proto",
@@ -152,6 +154,7 @@ func TestAvroSchema(t *testing.T) {
        // create producer
        asProducer, err := NewAvroSchemaWithValidation(exampleSchemaDef, nil)
        assert.Nil(t, err)
+       assert.NotNil(t, asProducer)
        asProducer = NewAvroSchema(exampleSchemaDef, nil)
        producer, err := client.CreateProducer(ProducerOptions{
                Topic:  "avro-topic",

Reply via email to