Skip to content

Commit

Permalink
Merge pull request #392 from godbus/chore/bump_ci
Browse files Browse the repository at this point in the history
Bump CI versions
  • Loading branch information
guelfey authored Sep 21, 2024
2 parents 7623695 + fc0247f commit 6bb5ed0
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 36 deletions.
6 changes: 3 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
freebsd_instance:
image_family: freebsd-13-0
image_family: freebsd-14-0

task:
name: Test on FreeBSD
install_script: pkg install -y go119 dbus
install_script: pkg install -y go122 dbus
test_script: |
/usr/local/etc/rc.d/dbus onestart && \
eval `dbus-launch --sh-syntax` && \
go119 test -v ./...
go122 test -v ./...
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ permissions:
jobs:

lint:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
- uses: golangci/golangci-lint-action@v3
go-version: 1.23
- uses: golangci/golangci-lint-action@v6
with:
version: v1.50
version: v1.60

test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
go-version: ['1.16', '1.17', '1.18', '1.19', '1.20']
go-version: ['1.20', '1.21', '1.22', '1.23']

steps:

Expand All @@ -49,7 +49,7 @@ jobs:
run: go test -race -v ./...

codespell:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: codespell-project/actions-codespell@master
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ D-Bus message bus system.

### Installation

This packages requires Go 1.12 or later. It can be installed by running the command below:
This packages requires Go 1.20 or later. It can be installed by running the command below:

```
go get github.com/godbus/dbus/v5
Expand Down
3 changes: 1 addition & 2 deletions conn_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dbus

import (
"bufio"
"io/ioutil"
"os"
"os/exec"
"syscall"
Expand Down Expand Up @@ -46,7 +45,7 @@ func startDaemonInDifferentUserNamespace(t *testing.T) (string, *os.Process) {
</policy>
</busconfig>
`
cfg, err := ioutil.TempFile("", "")
cfg, err := os.CreateTemp("", "")
if err != nil {
t.Fatal(err)
}
Expand Down
3 changes: 1 addition & 2 deletions conn_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"os/user"
Expand Down Expand Up @@ -61,7 +60,7 @@ func tryDiscoverDbusSessionBusAddress() string {
// text file // containing the address of the socket, e.g.:
// DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-E1c73yNqrG

if f, err := ioutil.ReadFile(runUserSessionDbusFile); err == nil {
if f, err := os.ReadFile(runUserSessionDbusFile); err == nil {
fileContent := string(f)

prefix := "DBUS_SESSION_BUS_ADDRESS="
Expand Down
7 changes: 3 additions & 4 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/binary"
"fmt"
"io"
"io/ioutil"
"log"
"sync"
"testing"
Expand Down Expand Up @@ -171,7 +170,7 @@ func TestCloseBeforeSignal(t *testing.T) {
defer pipewriter.Close()
defer reader.Close()

bus, err := NewConn(rwc{Reader: reader, Writer: ioutil.Discard})
bus, err := NewConn(rwc{Reader: reader, Writer: io.Discard})
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -743,7 +742,7 @@ func TestDisconnectCancelsConnectionContext(t *testing.T) {
defer pipewriter.Close()
defer reader.Close()

bus, err := NewConn(rwc{Reader: reader, Writer: ioutil.Discard})
bus, err := NewConn(rwc{Reader: reader, Writer: io.Discard})
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -778,7 +777,7 @@ func TestCancellingContextClosesConnection(t *testing.T) {
defer pipewriter.Close()
defer reader.Close()

bus, err := NewConn(rwc{Reader: reader, Writer: ioutil.Discard}, WithContext(ctx))
bus, err := NewConn(rwc{Reader: reader, Writer: io.Discard}, WithContext(ctx))
if err != nil {
t.Fatal(err)
}
Expand Down
8 changes: 1 addition & 7 deletions decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,6 @@ func (c *stringConverter) String(b []byte) string {
}

// toString converts a byte slice to a string without allocating.
// Starting from Go 1.20 you should use unsafe.String.
func toString(b []byte) string {
var s string
h := (*reflect.StringHeader)(unsafe.Pointer(&s))
h.Data = uintptr(unsafe.Pointer(&b[0]))
h.Len = len(b)

return s
return unsafe.String(&b[0], len(b))
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/godbus/dbus/v5

go 1.12
go 1.20

require golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2
6 changes: 3 additions & 3 deletions proto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dbus
import (
"bytes"
"encoding/binary"
"io/ioutil"
"io"
"math"
"reflect"
"testing"
Expand Down Expand Up @@ -371,7 +371,7 @@ func BenchmarkDecodeMessageBig(b *testing.B) {
func BenchmarkEncodeMessageSmall(b *testing.B) {
var err error
for i := 0; i < b.N; i++ {
err = smallMessage.EncodeTo(ioutil.Discard, binary.LittleEndian)
err = smallMessage.EncodeTo(io.Discard, binary.LittleEndian)
if err != nil {
b.Fatal(err)
}
Expand All @@ -381,7 +381,7 @@ func BenchmarkEncodeMessageSmall(b *testing.B) {
func BenchmarkEncodeMessageBig(b *testing.B) {
var err error
for i := 0; i < b.N; i++ {
err = bigMessage.EncodeTo(ioutil.Discard, binary.LittleEndian)
err = bigMessage.EncodeTo(io.Discard, binary.LittleEndian)
if err != nil {
b.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions server_interfaces_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dbus

import (
"fmt"
"errors"
"sync"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -83,7 +83,7 @@ func (t *tester) LookupMethod(name string) (Method, bool) {
return t, true
case "Error":
return terrfn(func(in string) error {
return fmt.Errorf(in)
return errors.New(in)
}), true
case "Introspect":
return intro_fn(func() string {
Expand Down
4 changes: 2 additions & 2 deletions transport_nonce_tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package dbus

import (
"errors"
"io/ioutil"
"net"
"os"
)

func init() {
Expand All @@ -28,7 +28,7 @@ func newNonceTcpTransport(keys string) (transport, error) {
if err != nil {
return nil, err
}
b, err := ioutil.ReadFile(noncefile)
b, err := os.ReadFile(noncefile)
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions transport_nonce_tcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dbus

import (
"bufio"
"io/ioutil"
"os"
"os/exec"
"testing"
Expand Down Expand Up @@ -38,7 +37,7 @@ func TestTcpNonceConnection(t *testing.T) {
// startDaemon starts a dbus-daemon instance with the given config
// and returns its address string and underlying process.
func startDaemon(t *testing.T, config string) (string, *os.Process) {
cfg, err := ioutil.TempFile("", "")
cfg, err := os.CreateTemp("", "")
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 6bb5ed0

Please sign in to comment.