Skip to content

Commit b54fb29

Browse files
committed
ci: multiple updates
- bump Go toolchain to 1.25 - update actions versions - replace gokart with gosec - simplify format and lint checks - replace golint with revive
1 parent d05ba1b commit b54fb29

File tree

4 files changed

+72
-63
lines changed

4 files changed

+72
-63
lines changed

.github/workflows/go.yml

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,55 +11,60 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
1614
- name: Set up Go
17-
uses: actions/setup-go@v2
15+
uses: actions/setup-go@v6
1816
with:
19-
go-version: 1.17
17+
go-version: 1.25
2018

21-
- name: OVS setup
19+
- name: Set up OVS
2220
run: |
2321
sudo apt-get update
2422
sudo apt install openvswitch-switch
2523
sudo ovs-vsctl add-br ovsbr0
26-
27-
- name: Check and test
28-
run: |
29-
export GOPATH=/home/runner/work
30-
export PATH=$PATH:$GOPATH/bin
31-
mkdir $GOPATH/src $GOPATH/pkg $GOPATH/bin
32-
go install honnef.co/go/tools/cmd/staticcheck@2020.2.1
33-
NEW=$GOPATH/src/github.com/digitalocean/go-openvswitch
34-
mkdir -p $NEW
35-
cp -r ./* $NEW
36-
cd $NEW
37-
go mod download
38-
go get golang.org/x/lint/golint
39-
go get -d ./...
24+
25+
- uses: actions/checkout@v5
26+
27+
- name: License check
28+
run: |
4029
echo "=========START LICENSE CHECK============"
4130
./scripts/licensecheck.sh
42-
echo "=========START BUILD============"
43-
go build -v -tags=gofuzz ./...
44-
echo "=========START VET============"
31+
32+
- name: Download deps
33+
run: go mod download
34+
35+
- name: Lint
36+
run: |
37+
# install tools
38+
go install honnef.co/go/tools/cmd/staticcheck@latest
39+
go install golang.org/x/lint/golint@latest
40+
go install github.com/mgechev/revive@latest
41+
4542
go vet ./...
46-
echo "=========START GO FMT CHECK============"
47-
./scripts/gofmt.sh
48-
echo "=========START GO LINT CHECK============"
49-
./scripts/golint.sh
50-
echo "=========START STATICCHECK============"
43+
44+
GOFMT=$(gofmt -l .)
45+
if [[ -n $GOFMT ]]; then
46+
echo -e "Files that are not gofmt'd:\n"
47+
echo "$GOFMT"
48+
exit 1
49+
fi
50+
51+
revive ./...
52+
5153
staticcheck ./...
52-
echo "=========START LINT============"
53-
golint -set_exit_status ./cmd/... ./internal/...
54+
55+
- name: Run Gosec Security Scanner
56+
uses: securego/gosec@master
57+
with:
58+
args: -exclude=G115 ./...
59+
60+
- name: Build
61+
run: go build -v ./...
62+
63+
- name: Test
64+
run: |
5465
echo "=========START TESTS IN OVS============"
5566
go test -v -race -short ./ovs/
5667
echo "=========START TESTS IN OVSDB============"
57-
go test -v -race ./ovsdb/
58-
go test -c -race ./ovsdb
68+
sudo go test -v -race ./ovsdb/
5969
echo "=========START TESTS IN OVSNL============"
6070
go test -v -race ./ovsnl/
61-
echo "=========START OVSDB.TEST============"
62-
sudo ./ovsdb.test -test.v
63-
echo "=========START SECURITY SCANNING============"
64-
go install github.com/praetorian-inc/gokart@latest
65-
gokart scan

revive.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
ignoreGeneratedHeader = true
2+
severity = "warning"
3+
confidence = 0.8
4+
errorCode = 1
5+
warningCode = 1
6+
exclude = ["ovsnl/internal/ovsh"]
7+
8+
[rule.blank-imports]
9+
[rule.context-as-argument]
10+
[rule.context-keys-type]
11+
[rule.dot-imports]
12+
[rule.error-return]
13+
[rule.error-strings]
14+
[rule.error-naming]
15+
[rule.exported]
16+
[rule.increment-decrement]
17+
[rule.var-naming]
18+
[rule.var-declaration]
19+
[rule.package-comments]
20+
[rule.range]
21+
[rule.receiver-naming]
22+
[rule.time-naming]
23+
[rule.unexported-return]
24+
[rule.indent-error-flow]
25+
[rule.errorf]
26+
[rule.empty-block]
27+
[rule.superfluous-else]
28+
[rule.unused-parameter]
29+
Disabled = true
30+
[rule.unreachable-code]
31+
[rule.redefines-builtin-id]

scripts/gofmt.sh

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

scripts/golint.sh

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

0 commit comments

Comments
 (0)