diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 659a26b..59160d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,8 @@ jobs: test: strategy: matrix: - os: [ubuntu-22.04, ubuntu-20.04, macos-12, macos-11] - go: [stable, 1.20.x, 1.19.x, 1.18.x] + os: [ubuntu-24.04, ubuntu-22.04, macos-13, macos-12] + go: [stable, 1.22.x, 1.18.x] name: Go ${{ matrix.go }} tests @ ${{ matrix.os }} for hyperscan runs-on: ${{ matrix.os }} steps: @@ -34,10 +34,10 @@ jobs: run: | brew install hyperscan pkg-config libpcap - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Golang ${{ matrix.go }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} cache: true @@ -56,36 +56,30 @@ jobs: strategy: matrix: include: - - os: macos-latest + - os: macos-13 go: stable hyperscan_version: 5.4.1 pcre_version: 8.45 - build_flags: -tags hyperscan_v54,chimera + build_flags: -tags hyperscan_v54 chimera: true - os: macos-12 go: stable hyperscan_version: 5.2.1 pcre_version: 8.45 - build_flags: -tags hyperscan_v52,chimera + build_flags: -tags hyperscan_v52 chimera: true - - os: macos-11 - go: stable - hyperscan_version: 5.1.1 - pcre_version: 8.45 - build_flags: -tags chimera - chimera: true - - os: ubuntu-22.04 + - os: ubuntu-24.04 go: stable hyperscan_version: 5.4.1 pcre_version: 8.45 - build_flags: -tags hyperscan_v54,chimera + build_flags: -tags hyperscan_v54 chimera: true coverage: true - - os: ubuntu-20.04 + - os: ubuntu-22.04 go: stable hyperscan_version: 5.2.1 pcre_version: 8.45 - build_flags: -tags hyperscan_v52,chimera + build_flags: -tags hyperscan_v52 chimera: true name: Go ${{ matrix.go }} tests @ ${{ matrix.os }} for hyperscan ${{ matrix.hyperscan_version }} runs-on: ${{ matrix.os }} @@ -94,7 +88,7 @@ jobs: CGO_CFLAGS: -I${{ github.workspace }}/dist/include/hs CGO_LDFLAGS: -L${{ github.workspace }}/dist/lib steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Hyperscan ${{ matrix.hyperscan }} with PCRE ${{ matrix.pcre_version }} uses: flier/install-hyperscan@main @@ -107,7 +101,7 @@ jobs: cache_key: ${{ runner.os }}-build-hyperscan-${{ matrix.hyperscan_version }}-pcre-${{ matrix.pcre_version }} - name: Install Golang ${{ matrix.go }} - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} cache: true @@ -133,19 +127,19 @@ jobs: golangci: name: lint - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Install Linux dependencies run: | sudo apt-get update sudo apt-get install -yq libhyperscan-dev libpcap-dev - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 - - uses: actions/checkout@v3 + - uses: actions/setup-go@v5 - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: version: latest working-directory: hyperscan diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8c1807c..17895ed 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -16,41 +16,36 @@ jobs: strategy: matrix: include: - - ubuntu_version: 22.04 + - ubuntu_version: 24.04 hyperscan_version: 5.4.2 pcre_version: 8.45 - go_version: 1.20.3 - build_flags: -tags hyperscan_v54,chimera - - ubuntu_version: 20.04 - hyperscan_version: 5.2.1 - pcre_version: 8.45 - go_version: 1.19.8 - build_flags: -tags hyperscan_v52,chimera - - ubuntu_version: 20.04 - hyperscan_version: 5.1.1 - pcre_version: 8.45 - build_flags: -tags chimera - go_version: 1.18.10 - - ubuntu_version: 18.04 - hyperscan_version: 4.7.0 - pcre_version: 8.42 - go_version: 1.18.10 - build_flags: -tags hyperscan_v4 + go_version: 1.23.3 + build_flags: -tags hyperscan_v54 + # - ubuntu_version: 22.04 + # hyperscan_version: 5.2.1 + # pcre_version: 8.45 + # go_version: 1.22.9 + # build_flags: -tags hyperscan_v52 + # - ubuntu_version: 20.04 + # hyperscan_version: 5.1.1 + # pcre_version: 8.41 + # build_flags: + # go_version: 1.21.13 name: tests @ ubuntu ${{ matrix.ubuntu_version }} for hyperscan ${{ matrix.hyperscan_version }} w/ ${{ matrix.build_flags }} env: LATEST_TAG: flier/gohs:${{ matrix.hyperscan_version }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: load: true build-args: | diff --git a/.golangci.yml b/.golangci.yml index f216fd1..dcaf454 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,11 +10,12 @@ run: issues-exit-code: 1 # include test files or not, default is true - tests: true + tests: false # list of build tags, all linters use it. Default is empty list. build-tags: - !privileged_tests + - chimera # default is true. Enables skipping of directories: # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ @@ -68,27 +69,24 @@ linters-settings: linters: enable-all: true disable: - - deadcode + - copyloopvar + - depguard - dupword - exhaustive - - exhaustivestruct - exhaustruct + - exportloopref - gci - gochecknoglobals - gochecknoinits - gocritic - godox - - golint - - ifshort - - interfacer + - gofumpt + - gosec + - intrange - ireturn - - maligned - nlreturn - nonamedreturns - - nosnakecase - paralleltest - - scopelint - - structcheck - - varcheck + - revive - varnamelen - wsl diff --git a/Dockerfile b/Dockerfile index 0a89ac7..47c7dac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG UBUNTU_VERSION=22.04 +ARG UBUNTU_VERSION=24.04 FROM ubuntu:${UBUNTU_VERSION} as build @@ -20,7 +20,7 @@ RUN < @@ -24,7 +21,7 @@ const ( ErrCompileError Error = C.CH_COMPILER_ERROR // ErrDatabaseVersionError is the error returned if the given database was built for a different version of Hyperscan. ErrDatabaseVersionError Error = C.CH_DB_VERSION_ERROR - // ErrDatabasePlatformError is the error returned if the given database was built for a different platform (i.e., CPU type). + // ErrDatabasePlatformError is the error returned if the given database was built for a different platform. ErrDatabasePlatformError Error = C.CH_DB_PLATFORM_ERROR // ErrDatabaseModeError is the error returned if the given database was built for a different mode of operation. ErrDatabaseModeError Error = C.CH_DB_MODE_ERROR diff --git a/internal/ch/error_v54.go b/internal/ch/error_v54.go index 439bf78..17e9086 100644 --- a/internal/ch/error_v54.go +++ b/internal/ch/error_v54.go @@ -1,5 +1,5 @@ -//go:build hyperscan_v54 && chimera -// +build hyperscan_v54,chimera +//go:build hyperscan_v54 +// +build hyperscan_v54 package ch diff --git a/internal/ch/link.go b/internal/ch/link.go index 9b6a3b4..13bce5e 100644 --- a/internal/ch/link.go +++ b/internal/ch/link.go @@ -1,6 +1,3 @@ -//go:build chimera -// +build chimera - package ch /* diff --git a/internal/ch/runtime.go b/internal/ch/runtime.go index 274c5b5..96eeccf 100644 --- a/internal/ch/runtime.go +++ b/internal/ch/runtime.go @@ -1,6 +1,3 @@ -//go:build chimera -// +build chimera - package ch import ( @@ -54,7 +51,7 @@ type Capture struct { type MatchEventHandler func(id uint, from, to uint64, flags uint, captured []*Capture, context interface{}) Callback // Type used to differentiate the errors raised with the `ErrorEventHandler` callback. -type ErrorEvent C.ch_error_event_t // nolint: errname +type ErrorEvent C.ch_error_event_t //nolint: errname const ( // PCRE hits its match limit and reports PCRE_ERROR_MATCHLIMIT. diff --git a/internal/ch/runtime_test.go b/internal/ch/runtime_test.go index 4807286..7df4f12 100644 --- a/internal/ch/runtime_test.go +++ b/internal/ch/runtime_test.go @@ -1,6 +1,3 @@ -//go:build chimera -// +build chimera - package ch_test import ( diff --git a/internal/ch/scratch.go b/internal/ch/scratch.go index c23a6a2..e08f268 100644 --- a/internal/ch/scratch.go +++ b/internal/ch/scratch.go @@ -1,6 +1,3 @@ -//go:build chimera -// +build chimera - package ch // #include diff --git a/internal/ch/scratch_test.go b/internal/ch/scratch_test.go index 5ef62b1..40b18cd 100644 --- a/internal/ch/scratch_test.go +++ b/internal/ch/scratch_test.go @@ -1,6 +1,3 @@ -//go:build chimera -// +build chimera - package ch_test import (