Skip to content

Commit 37393bc

Browse files
Support building with Go 1.20 (#3)
* Support building with Go 1.20 * Remove use of features requiring Go 1.22
1 parent e2b2978 commit 37393bc

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/huntresslabs/go-systemd
22

3-
go 1.23
3+
go 1.20
44

55
require github.com/godbus/dbus/v5 v5.1.0

import1/dbus_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func cleanupImport(t *testing.T, name string) {
3636
err error
3737
dur = 500 * time.Millisecond
3838
)
39-
for range 5 {
39+
for i := 0; i < 5; i++ {
4040
time.Sleep(dur)
4141
out, err = exec.Command("machinectl", "remove", name).CombinedOutput()
4242
if err == nil {

internal/dlopen/dlopen_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func TestDlopenThreadSafety(t *testing.T) {
8888
wg := sync.WaitGroup{}
8989
wg.Add(count)
9090

91-
for range count {
91+
for i := 0; i < count; i++ {
9292
go func() {
9393
defer wg.Done()
9494
lib, err := GetHandle(libs)

sdjournal/journal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func TestJournalGetCatalog(t *testing.T) {
406406

407407
// Look for an entry with MESSAGE_ID (required for GetCatalog).
408408
found := false
409-
for range 100 {
409+
for i := 0; i < 100; i++ {
410410
n, err := j.Next()
411411
if err != nil {
412412
t.Fatalf("Error reading journal: %s", err)

unit/option.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func AllMatch(u1 []*UnitOption, u2 []*UnitOption) bool {
4949
return false
5050
}
5151

52-
for i := range length {
52+
for i := 0; i < length; i++ {
5353
if !u1[i].Match(u2[i]) {
5454
return false
5555
}

0 commit comments

Comments
 (0)