Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
55 changes: 30 additions & 25 deletions .github/workflows/eventlist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: tools/eventlist/go.mod
cache: false
check-latest: true

- name: Initialize CodeQL
Expand Down Expand Up @@ -119,19 +120,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: tools/eventlist/go.mod
cache: false
check-latest: true

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v9
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
skip-cache: true
skip-save-cache: true
working-directory: ./tools/eventlist

format:
Expand All @@ -140,12 +143,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: tools/eventlist/go.mod
cache: false
check-latest: true

- name: Create build folder
Expand Down Expand Up @@ -182,12 +186,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository code
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: tools/eventlist/go.mod
cache: false
check-latest: true

- name: Create build folder
Expand Down Expand Up @@ -222,27 +227,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download unit test report windows
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: unit-test-result-windows-2022
path: testreports/

- name: Download unit test report linux
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: unit-test-result-ubuntu-24.04
path: testreports/

- name: Download unit test report macos
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: unit-test-result-macos-14
path: testreports/

- name: publish test results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
uses: EnricoMi/publish-unit-test-result-action/linux@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
report_individual_runs: true
junit_files: "testreports/*.xml"

Expand All @@ -255,12 +259,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: tools/eventlist/go.mod
cache: false
check-latest: true

- name: Create build folder
Expand All @@ -273,7 +278,7 @@ jobs:
COVERAGE=$(go tool cover -func build/cover.out | tail -1 | awk '{print $3}' | tr -d '%')
echo "Test Coverage: $COVERAGE%"
COVERAGE_INT=$(echo "$COVERAGE * 10 / 1" | bc)
test "$COVERAGE_INT" -gt 975
test "$COVERAGE_INT" -gt 920
working-directory: ./tools/eventlist

# Temporarily disabled until we move on codeclimate
Expand All @@ -290,7 +295,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout devtools
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: Create distribution folders
run: |
Expand Down Expand Up @@ -320,37 +325,37 @@ jobs:
cp tools/eventlist/third_party_licenses.md release/eventlist-windows-arm64/

- name: Download eventlist linux
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: eventlist-linux-amd64
path: release/eventlist-linux-amd64/

- name: Download eventlist linux
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: eventlist-linux-arm64
path: release/eventlist-linux-arm64/

- name: Download eventlist macos
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: eventlist-darwin-amd64
path: release/eventlist-darwin-amd64/

- name: Download eventlist macos
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: eventlist-darwin-arm64
path: release/eventlist-darwin-arm64/

- name: Download eventlist windows
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: eventlist-windows-amd64
path: release/eventlist-windows-amd64/

- name: Download eventlist windows
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: eventlist-windows-arm64
path: release/eventlist-windows-arm64/
Expand Down
34 changes: 20 additions & 14 deletions tools/eventlist/.golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
version: "2"
run:
build-tags:
- integration
linters:
enable:
- errname
- errorlint
- goerr113
- makezero
- nilerr
- paralleltest
- prealloc
- predeclared
- revive
- thelper
- unconvert
- unparam
- wastedassign
default: none
enable:
- bodyclose
- errcheck
- gosec
- govet
- ineffassign
- staticcheck
- unused
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
8 changes: 4 additions & 4 deletions tools/eventlist/cmd/eventlist/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func Test_includes_Set(t *testing.T) {
}
}

func Test_infoOpt(t *testing.T) { //nolint:golint,paralleltest
func Test_infoOpt(t *testing.T) { //nolint:paralleltest
type args struct {
sopt string
lopt string
Expand Down Expand Up @@ -119,7 +119,7 @@ func Test_infoOpt(t *testing.T) { //nolint:golint,paralleltest
" -a, --cd arg unknown option\n"},
}
_ = flag.Set("test.run", "yy")
for _, tt := range tests { //nolint:golint,paralleltest
for _, tt := range tests { //nolint:paralleltest
t.Run(tt.name, func(t *testing.T) {
oldOut := os.Stdout
restore := func() {
Expand All @@ -138,7 +138,7 @@ func Test_infoOpt(t *testing.T) { //nolint:golint,paralleltest
}
}

func Test_main(t *testing.T) { //nolint:golint,paralleltest
func Test_main(t *testing.T) { //nolint:paralleltest
outFile := "out.out"

lines1 :=
Expand Down Expand Up @@ -202,7 +202,7 @@ func Test_main(t *testing.T) { //nolint:golint,paralleltest
{"-I", []string{"-I", "../../testdata/nix", "xxx"}, ".*: open ../../testdata/nix: (no such file or directory|The system cannot find the file specified.)\\n", ""},
}
savedArgs := os.Args
for _, tt := range tests { //nolint:golint,paralleltest
for _, tt := range tests { //nolint:paralleltest
t.Run(tt.name, func(t *testing.T) {
oldOut := os.Stdout
restore := func() {
Expand Down
18 changes: 9 additions & 9 deletions tools/eventlist/cmd/make/make.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,23 @@ type runner struct {
}

func (r runner) run(command string) {
switch {
case command == "build":
switch command {
case "build":
versionInfo, err := createResourceInfoFile(r.options.targetArch)
if err != nil {
fmt.Println(err.Error())
return
}
info := versionInfo.StringFileInfo.FileVersion + " " + versionInfo.StringFileInfo.LegalCopyright
info := versionInfo.StringFileInfo.FileVersion + " " + versionInfo.LegalCopyright
if err = r.build(r.options, info); err != nil {
fmt.Println(err.Error())
}
case command == "test":
case "test":
if err := r.test(); err != nil {
fmt.Println(err.Error())
return
}
case command == "coverage":
case "coverage":
if r.options.covReport == "" {
if err := r.coverage(); err != nil {
fmt.Println(err.Error())
Expand All @@ -91,9 +91,9 @@ func (r runner) run(command string) {
return
}
}
case command == "lint":
case "lint":
r.lint()
case command == "format":
case "format":
r.format()
}
}
Expand Down Expand Up @@ -233,7 +233,7 @@ func createResourceInfoFile(arch string) (version goversioninfo.VersionInfo, err
ProductVersion: gitVersion.String(),
LegalCopyright: "Copyright (c) 2022-" + gitYear + " " + legalCopyright,
}
verInfo.VarFileInfo.Translation = goversioninfo.Translation{
verInfo.Translation = goversioninfo.Translation{
LangID: 1033,
CharsetID: 1200,
}
Expand Down Expand Up @@ -291,7 +291,7 @@ func newVersion(verStr string) (ver version, err error) {
tokens := strings.Split(versionStr, "-")
numTokens := len(tokens)

if !(numTokens == 1 || numTokens == 3) {
if numTokens != 1 && numTokens != 3 {
return ver, reportError(ErrVersion, "invalid version string")
}
verParts := strings.Split(tokens[0], ".")
Expand Down
9 changes: 4 additions & 5 deletions tools/eventlist/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
module eventlist

go 1.20
go 1.26

require (
github.com/akavel/rsrc v0.10.2 // indirect
github.com/josephspurrier/goversioninfo v1.4.0
)
require github.com/josephspurrier/goversioninfo v1.4.0

require github.com/akavel/rsrc v0.10.2 // indirect
5 changes: 4 additions & 1 deletion tools/eventlist/go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8=
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8=
github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
9 changes: 7 additions & 2 deletions tools/eventlist/pkg/elf/elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ func (s *sections) Readelf(name *string) error {
func (s *sections) GetString(addr uint64) string {
for _, es := range s.sections {
if addr >= es.addr && addr < es.addr+uint64(len(es.data)) {
l := strings.IndexByte(string(es.data[addr-es.addr:]), 0)
return string(es.data[addr-es.addr : addr-es.addr+uint64(l)])
start := addr - es.addr
data := es.data[start:]
l := strings.IndexByte(string(data), 0)
if l < 0 {
return string(data)
}
return string(data[:l])
}
}
return ""
Expand Down
4 changes: 2 additions & 2 deletions tools/eventlist/pkg/elf/elf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"testing"
)

func Test_sections_Readelf(t *testing.T) { //nolint:golint,paralleltest
func Test_sections_Readelf(t *testing.T) { //nolint:paralleltest
fileTest := "../../testdata/elftest.elf"
fileNix := "../../testdata/nix.elf"
fileSym := "../../testdata/elfsym.elf"
Expand All @@ -43,7 +43,7 @@ func Test_sections_Readelf(t *testing.T) { //nolint:golint,paralleltest
{"test", &sections{}, args{name: &fileTest}, 0, false},
{"errName", &sections{}, args{name: &fileNix}, 0, true},
}
for _, tt := range tests { //nolint:golint,paralleltest
for _, tt := range tests { //nolint:paralleltest
t.Run(tt.name, func(t *testing.T) {
var err error
if err = tt.s.Readelf(tt.args.name); (err != nil) != tt.wantErr {
Expand Down
Loading
Loading