Skip to content

Commit

Permalink
use go test fmt and check for nil param
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed Nov 30, 2024
1 parent cfa8beb commit bd8e939
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,27 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run unit tests
run: go test -failfast -coverprofile=profile.cov
- name: Set up gotestfmt
uses: gotesttools/gotestfmt-action@v2
with:
# Optional: pass GITHUB_TOKEN to avoid rate limiting.
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: |
set -euo pipefail
go test -json -race -failfast -tags="headless" -coverprofile=profile.cov -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt -nofail
# Upload the original go test log as an artifact for later review.
- name: Upload test log
uses: actions/upload-artifact@v3
if: always()
with:
name: test-log
path: /tmp/gotest.log
if-no-files-found: error
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Send coverage
Expand Down
6 changes: 4 additions & 2 deletions fronted.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ type fronted struct {

func newFronted(pool *x509.CertPool, providers map[string]*Provider,
defaultProviderID, cacheFile string, clientHelloID tls.ClientHelloID,
listener func(f *fronted),
workingFronts workingFronts) (*fronted, error) {
listener func(f *fronted), workingFronts workingFronts) (*fronted, error) {
if workingFronts == nil {
return nil, fmt.Errorf("workingFronts must not be nil")
}
size := 0
for _, p := range providers {
size += len(p.Masquerades)
Expand Down

0 comments on commit bd8e939

Please sign in to comment.