diff --git a/.github/actions/build-dependencies/action.yaml b/.github/actions/build-dependencies/action.yaml index a7767cd2..3753c2c0 100644 --- a/.github/actions/build-dependencies/action.yaml +++ b/.github/actions/build-dependencies/action.yaml @@ -7,7 +7,7 @@ runs: - name: Setup Go uses: actions/setup-go@v2 with: - go-version: "1.17" + go-version: "1.18" - name: Install Compilers & Formatters run: | sudo apt-get update diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index c0038f2e..973b8b39 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -8,7 +8,7 @@ on: jobs: unit-tests: name: Unit Tests - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout Code uses: actions/checkout@v2 @@ -19,7 +19,7 @@ jobs: make helpers-test-static-run self-tests: name: Selftests - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout Code uses: actions/checkout@v2 diff --git a/builder/prepare-ubuntu.sh b/builder/prepare-ubuntu.sh index 18b1abd1..5d0eff49 100755 --- a/builder/prepare-ubuntu.sh +++ b/builder/prepare-ubuntu.sh @@ -7,7 +7,7 @@ # variables -[ -z "${GO_VERSION}" ] && GO_VERSION="1.17" +[ -z "${GO_VERSION}" ] && GO_VERSION="1.18" [ -z "${CLANG_VERSION}" ] && CLANG_VERSION="12" [ -z "${ARCH}" ] && ARCH="amd64" diff --git a/go.mod b/go.mod index 09fe5a0b..7a20f399 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/aquasecurity/libbpfgo -go 1.19 +go 1.18 diff --git a/go.sum b/go.sum deleted file mode 100644 index e69de29b..00000000 diff --git a/go.work b/go.work new file mode 100644 index 00000000..28f13025 --- /dev/null +++ b/go.work @@ -0,0 +1,6 @@ +go 1.18 + +use ( + . + ./helpers +) diff --git a/helpers/go.mod b/helpers/go.mod index 7d82139b..e37ee642 100644 --- a/helpers/go.mod +++ b/helpers/go.mod @@ -1,3 +1,15 @@ module github.com/aquasecurity/libbpfgo/helpers -go 1.19 +go 1.18 + +require ( + github.com/aquasecurity/libbpfgo v0.4.0-libbpf-1.0.0.0.20221004153638-7139cb41036f + github.com/stretchr/testify v1.8.0 + golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/helpers/go.sum b/helpers/go.sum new file mode 100644 index 00000000..2c69cbfe --- /dev/null +++ b/helpers/go.sum @@ -0,0 +1,19 @@ +github.com/aquasecurity/libbpfgo v0.4.0-libbpf-1.0.0.0.20221004153638-7139cb41036f h1:8vfY/LaTk096KJ6pi6IdOzIIjZxQqP/jhH4CtZ4rM7I= +github.com/aquasecurity/libbpfgo v0.4.0-libbpf-1.0.0.0.20221004153638-7139cb41036f/go.mod h1:BUFy1KtlXJD5rWElGW+jOl3FD167uDx9+02zIuH2v1A= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/rwArray_test.go b/rwArray_test.go index bef3b82a..4abf10e9 100644 --- a/rwArray_test.go +++ b/rwArray_test.go @@ -29,7 +29,7 @@ func TestRWArrayWrite(t *testing.T) { t.Fatalf("slot1 (%v) < slot2 (%v)", slot1, slot2) } - a.Remove(uint(slot2)) + a.remove(uint(slot2)) last = slot2 } @@ -71,7 +71,7 @@ func TestRWArrayRead(t *testing.T) { } for i := 0; i < 1000; i++ { - v := a.Get(uint(i)).(*int) + v := a.get(uint(i)).(*int) if *v != i { t.Errorf("Get returned wrong valuue; expected=%v, got=%v", i, *v) } @@ -92,7 +92,7 @@ func TestRWArrayConcurrent(t *testing.T) { a.put(&v) } for i := uint(1); i < capacity; i += 2 { - a.Remove(i) + a.remove(i) } writer := func() { @@ -104,7 +104,7 @@ func TestRWArrayConcurrent(t *testing.T) { // make some holes for i := uint(1); i < capacity; i += 2 { - a.Remove(i) + a.remove(i) } // time to exit? @@ -119,7 +119,7 @@ func TestRWArrayConcurrent(t *testing.T) { reader := func() { for rounds := 0; rounds < 10; rounds++ { for i := uint(0); i < capacity; i += 2 { - a.Get(i) + a.get(i) } } diff --git a/selftest/tracing/go.mod b/selftest/tracing/go.mod index 80be14b6..c67b71e7 100644 --- a/selftest/tracing/go.mod +++ b/selftest/tracing/go.mod @@ -1,12 +1,14 @@ -module github.com/aquasecurity/libbpfgo/selftest/perfbuffers +module github.com/aquasecurity/libbpfgo/selftest/tracing go 1.18 -require github.com/aquasecurity/libbpfgo v0.2.1-libbpf-0.4.0 - require ( - github.com/aquasecurity/libbpfgo/helpers v0.0.0-20220919184217-8ef1425cccdf // indirect - golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect + github.com/aquasecurity/libbpfgo v0.4.0-libbpf-1.0.0.0.20221004153638-7139cb41036f + github.com/aquasecurity/libbpfgo/helpers v0.0.0-20221004153638-7139cb41036f ) +require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect + replace github.com/aquasecurity/libbpfgo => ../../ + +replace github.com/aquasecurity/libbpfgo/helpers => ../../helpers diff --git a/selftest/tracing/go.sum b/selftest/tracing/go.sum index 1ec00734..5e33bead 100644 --- a/selftest/tracing/go.sum +++ b/selftest/tracing/go.sum @@ -1,14 +1,6 @@ -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/aquasecurity/libbpfgo/helpers v0.0.0-20220919184217-8ef1425cccdf h1:HNzXWDHFjYZ8jP6vCHW1R8NLblm7vKIM3Y0y+r4OX9E= -github.com/aquasecurity/libbpfgo/helpers v0.0.0-20220919184217-8ef1425cccdf/go.mod h1:oCaNN2RsEVEErc1PyvJn1ttVoxAKAGRKPrHY9n3QqS0= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 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.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/selftest/uprobe/go.mod b/selftest/uprobe/go.mod index f6f62041..132ac619 100644 --- a/selftest/uprobe/go.mod +++ b/selftest/uprobe/go.mod @@ -2,8 +2,13 @@ module github.com/aquasecurity/libbpfgo/selftest/uprobe go 1.18 -require github.com/aquasecurity/libbpfgo v0.2.1-libbpf-0.4.0 +require ( + github.com/aquasecurity/libbpfgo v0.4.0-libbpf-1.0.0.0.20221004153638-7139cb41036f + github.com/aquasecurity/libbpfgo/helpers v0.0.0-20221004153638-7139cb41036f +) -require golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect +require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect replace github.com/aquasecurity/libbpfgo => ../../ + +replace github.com/aquasecurity/libbpfgo/helpers => ../../helpers diff --git a/selftest/uprobe/go.sum b/selftest/uprobe/go.sum index b0f21d61..5e33bead 100644 --- a/selftest/uprobe/go.sum +++ b/selftest/uprobe/go.sum @@ -1,12 +1,6 @@ -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/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 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.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=