diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ecbab3372..dece41f6f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,11 +49,6 @@ jobs: os: ubuntu-latest test_fuse: true - - job_name: Linux - go: 1.25.x - os: ubuntu-latest - test_fuse: true - name: ${{ matrix.job_name }} Go ${{ matrix.go }} runs-on: ${{ matrix.os }} diff --git a/build.go b/build.go index a1447d9b0..f4f5f5b04 100644 --- a/build.go +++ b/build.go @@ -59,7 +59,7 @@ var config = Config{ // see https://github.com/googleapis/google-cloud-go/issues/11448 DefaultBuildTags: []string{"selfupdate", "disable_grpc_modules"}, // specify build tags which are always used Tests: []string{"./..."}, // tests to run - MinVersion: GoVersion{Major: 1, Minor: 25, Patch: 0}, // minimum Go version supported + MinVersion: GoVersion{Major: 1, Minor: 26, Patch: 0}, // minimum Go version supported } // Config configures the build. diff --git a/changelog/unreleased/pull-22121 b/changelog/unreleased/pull-22121 new file mode 100644 index 000000000..ef8c01f21 --- /dev/null +++ b/changelog/unreleased/pull-22121 @@ -0,0 +1,5 @@ +Change: Require Go 1.26 or newer + +Building restic now requires Go 1.26 or newer. + +https://github.com/restic/restic/pull/22121 diff --git a/doc/020_installation.rst b/doc/020_installation.rst index ea09f2a44..517e5d54d 100644 --- a/doc/020_installation.rst +++ b/doc/020_installation.rst @@ -305,7 +305,7 @@ From source *********** restic is written in the Go programming language and you need at least -Go version 1.25. Building restic may also work with older versions of Go, +Go version 1.26. Building restic may also work with older versions of Go, but that's not supported. See the `Getting started `__ guide of the Go project for instructions how to install Go. diff --git a/go.mod b/go.mod index d5b49952f..ccc727673 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/restic/restic -go 1.25.8 +go 1.26.0 -toolchain go1.25.10 +toolchain go1.26.9 // keep the old behavior for reparse points on windows until handling reparse points has been improved in restic // https://forum.restic.net/t/windows-junction-backup-with-go1-23-or-later/8940 diff --git a/internal/backend/sftp/sftp.go b/internal/backend/sftp/sftp.go index f33f2b42d..4390e2815 100644 --- a/internal/backend/sftp/sftp.go +++ b/internal/backend/sftp/sftp.go @@ -625,8 +625,8 @@ func (r *SFTP) Close() error { return err } - // get the error, but ignore it - <-r.result + //nolint:staticcheck // get the error, but ignore it + _ = <-r.result return nil } diff --git a/internal/backend/test/tests.go b/internal/backend/test/tests.go index 2c996b2ac..8c7a99324 100644 --- a/internal/backend/test/tests.go +++ b/internal/backend/test/tests.go @@ -545,7 +545,7 @@ func (s *Suite[C]) TestSave(t *testing.T) { } if fi.Size != int64(len(data)) { - t.Errorf("Stat() returned different size, want %q, got %d", len(data), fi.Size) + t.Errorf("Stat() returned different size, want %d, got %d", len(data), fi.Size) } err = b.Remove(context.TODO(), h) diff --git a/internal/data/node.go b/internal/data/node.go index abcb75d11..e700e9e66 100644 --- a/internal/data/node.go +++ b/internal/data/node.go @@ -468,9 +468,7 @@ func OSAttrsToGenericAttributes(attributeType reflect.Type, attributeValuePtr *r attrs = make(map[GenericAttributeType]json.RawMessage) // Iterate over the fields of the struct - for i := 0; i < attributeType.NumField(); i++ { - field := attributeType.Field(i) - + for field := range attributeType.Fields() { // Get the field value using reflection fieldValue := attributeValue.FieldByName(field.Name) diff --git a/internal/fs/priv_windows_test.go b/internal/fs/priv_windows_test.go index 0db7144e8..504cc678f 100644 --- a/internal/fs/priv_windows_test.go +++ b/internal/fs/priv_windows_test.go @@ -25,11 +25,9 @@ func TestRestorePrivilegeBypassACL(t *testing.T) { testPath := testGetRestrictedFilePath(t) // Writable OpenFile needs explicit FILE_FLAG_BACKUP_SEMANTICS. - // Go with issue #73676 merged would allow: os.OpenFile(testPath, os.O_WRONLY|windows.O_FILE_FLAG_BACKUP_SEMANTICS, 0) - utf16Path := windows.StringToUTF16Ptr(testPath) - handle, err := windows.CreateFile(utf16Path, windows.GENERIC_WRITE, 0, nil, windows.OPEN_EXISTING, windows.FILE_ATTRIBUTE_NORMAL|windows.FILE_FLAG_BACKUP_SEMANTICS, 0) + testfile, err := os.OpenFile(testPath, os.O_WRONLY|windows.O_FILE_FLAG_BACKUP_SEMANTICS, 0) test.OK(t, errors.Wrapf(err, "failed to open file for writing: %s", testPath)) - test.OK(t, windows.Close(handle)) + test.OK(t, testfile.Close()) } func testGetRestrictedFilePath(t *testing.T) string {