Skip to content

Commit a3e3528

Browse files
committed
Fix linting
1 parent ff1ea42 commit a3e3528

File tree

11 files changed

+28
-72
lines changed

11 files changed

+28
-72
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
go-version: '1.24'
2020

2121
- name: Run golangci-lint
22-
uses: golangci/golangci-lint-action@v6
22+
uses: golangci/golangci-lint-action@v8
2323
with:
24-
version: latest
24+
version: v2.5
2525
args: --timeout=5m
2626

2727
format:

.github/workflows/security.yml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,6 @@ on:
88
- cron: '0 0 * * 1'
99

1010
jobs:
11-
gosec:
12-
name: gosec security scan
13-
runs-on: ubuntu-latest
14-
15-
steps:
16-
- name: Checkout code
17-
uses: actions/checkout@v4
18-
19-
- name: Set up Go
20-
uses: actions/setup-go@v5
21-
with:
22-
go-version: '1.24'
23-
24-
- name: Run gosec
25-
uses: securego/gosec@master
26-
with:
27-
args: '-fmt sarif -out results.sarif ./...'
28-
29-
- name: Upload SARIF file
30-
uses: github/codeql-action/upload-sarif@v3
31-
with:
32-
sarif_file: results.sarif
33-
3411
govulncheck:
3512
name: Go vulnerability check
3613
runs-on: ubuntu-latest

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ linters-settings:
6363
revive:
6464
confidence: 0.8
6565

66+
gosec:
67+
excludes:
68+
- G104 # Covered by errcheck linter
69+
6670
issues:
6771
exclude-dirs:
6872
- examples

.gosec.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
help:
55
@echo "Available targets:"
66
@echo " test - Run all tests"
7-
@echo " lint - Run linters (golangci-lint)"
8-
@echo " security - Run security scanner (gosec)"
7+
@echo " lint - Run linters (golangci-lint with gosec)"
8+
@echo " security - Run vulnerability check (govulncheck)"
99
@echo " coverage - Run tests with coverage report"
1010
@echo " benchmark - Run benchmarks"
1111
@echo " clean - Clean build artifacts"
@@ -24,14 +24,14 @@ lint:
2424
@echo "Running linters..."
2525
golangci-lint run
2626

27-
# Run security scanner
27+
# Run security scanner (vulnerability check)
2828
security:
29-
@echo "Running security scanner..."
30-
@if which gosec > /dev/null 2>&1; then \
31-
gosec -quiet ./...; \
29+
@echo "Running vulnerability check..."
30+
@if which govulncheck > /dev/null 2>&1; then \
31+
govulncheck ./...; \
3232
else \
33-
echo "WARNING: gosec not installed. Run 'make tools' to install it."; \
34-
echo "Skipping security scan..."; \
33+
echo "WARNING: govulncheck not installed. Run 'make tools' to install it."; \
34+
echo "Skipping vulnerability check..."; \
3535
fi
3636

3737
# Run tests with coverage
@@ -66,7 +66,7 @@ verify: fmt test lint security
6666
tools:
6767
@echo "Installing development tools..."
6868
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
69-
go install github.com/securego/gosec/v2/cmd/gosec@latest
69+
go install golang.org/x/vuln/cmd/govulncheck@latest
7070

7171
# CI pipeline checks (used in GitHub Actions)
7272
ci: test lint security

examples/basic/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//nolint:errcheck,gosec // Example code prioritizes readability over error handling
21
// Package main demonstrates basic go-netconf API usage.
32
//
43
// This example shows:
@@ -13,6 +12,8 @@
1312
// export NETCONF_USERNAME=admin
1413
// export NETCONF_PASSWORD=secret
1514
// go run main.go
15+
//
16+
//nolint:errcheck,gosec // Example code prioritizes readability over error handling
1617
package main
1718

1819
import (

examples/candidate/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//nolint:errcheck,gosec // Example code prioritizes readability over error handling
21
// Package main demonstrates candidate datastore workflow with go-netconf.
32
//
43
// This example shows:
@@ -14,6 +13,8 @@
1413
// export NETCONF_USERNAME=admin
1514
// export NETCONF_PASSWORD=secret
1615
// go run main.go
16+
//
17+
//nolint:errcheck,gosec // Example code prioritizes readability over error handling
1718
package main
1819

1920
import (

examples/concurrent/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//nolint:errcheck,gosec // Example code prioritizes readability over error handling
21
// Package main demonstrates concurrent operations with go-netconf.
32
//
43
// This example shows:
@@ -13,6 +12,8 @@
1312
// export NETCONF_USERNAME=admin
1413
// export NETCONF_PASSWORD=secret
1514
// go run main.go
15+
//
16+
//nolint:errcheck,gosec // Example code prioritizes readability over error handling
1617
package main
1718

1819
import (

examples/custom-rpc/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//nolint:errcheck,gosec // Example code prioritizes readability over error handling
21
// Package main demonstrates custom RPC operations with go-netconf.
32
//
43
// This example shows:
@@ -12,6 +11,8 @@
1211
// export NETCONF_USERNAME=admin
1312
// export NETCONF_PASSWORD=secret
1413
// go run main.go
14+
//
15+
//nolint:errcheck,gosec // Example code prioritizes readability over error handling
1516
package main
1617

1718
import (

examples/filters/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//nolint:errcheck,gosec // Example code prioritizes readability over error handling
21
// Package main demonstrates filter usage with go-netconf.
32
//
43
// This example shows:
@@ -12,6 +11,8 @@
1211
// export NETCONF_USERNAME=admin
1312
// export NETCONF_PASSWORD=secret
1413
// go run main.go
14+
//
15+
//nolint:errcheck,gosec // Example code prioritizes readability over error handling
1516
package main
1617

1718
import (

0 commit comments

Comments
 (0)