Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 66 additions & 37 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,93 @@ name: Go
on:
pull_request:
branches:
- master
- master
push:
branches:
- master
- master

permissions:
contents: read

jobs:
build:
name: Lint ${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.24.0]
go-version: ["1.24"]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Check out code
uses: actions/checkout@v4

- name: go vet
run: go vet ./...
- name: go vet
run: go vet ./...

- name: go fmt
run: diff <(gofmt -d .) <(printf "")
- name: go fmt
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go code is not formatted:"
gofmt -d .
exit 1
fi

- name: golangci-lint
run: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
$(go env GOPATH)/bin/golangci-lint run --config ./.golangci.yml
- name: golangci-lint
uses: golangci/golangci-lint-action@v8

test:
name: Testing Go ${{ matrix.go-version }} on ${{ matrix.os }}
name: Test Go ${{ matrix.go-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: 1.24.0
go-version: ["1.24"]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Check out code
uses: actions/checkout@v4

- name: Run tests
run: go test -v -race ./...

- name: Run tests with coverage (Linux only)
if: matrix.os == 'ubuntu-latest'
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...

- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
files: ./coverage.out
flags: unittests
fail_ci_if_error: false

security:
name: Security Scan
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Test on ${{ matrix.os }}
env:
GO111MODULE: on
run: |
go test ./...
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: "fs"
scan-ref: "."
format: "sarif"
output: "trivy-results.sarif"

- name: Test on race ${{ matrix.os }}
env:
GO111MODULE: on
run: |
go test -race ./...
- name: Upload Trivy results to GitHub Security
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif"
56 changes: 34 additions & 22 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
linters-settings:
golint:
min-confidence: 0

misspell:
locale: US

staticcheck:
checks: ['all', '-SA6002']

version: "2"
linters:
disable-all: true
default: none
enable:
- durationcheck
- errcheck
- gocritic
- gofumpt
- goimports
- gomodguard
- gosec
- govet
- ineffassign
- misspell
- revive
- staticcheck
- tenv
- typecheck
- unconvert
- unused

issues:
exclude-use-default: false
exclude:
- should have a package comment
- error strings should not be capitalized or end with punctuation or a newline
- don't use ALL_CAPS in Go names
settings:
misspell:
locale: US
revive:
rules:
- name: package-comments
disabled: true
- name: error-strings
disabled: true
staticcheck:
checks:
- all
- -SA6002
exclusions:
generated: lax
rules:
- linters:
- revive
text: don't use ALL_CAPS in Go names
paths:
- third_party$
- builtin$
- examples$
formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

Loading
Loading