Skip to content

Commit 1e5c4ed

Browse files
committed
fix: build talosctl image cache-serve non-linux
Fix failing non-linux builds of talosctl Signed-off-by: Mateusz Urbanek <mateusz.urbanek@siderolabs.com>
1 parent dbdd2b2 commit 1e5c4ed

File tree

4 files changed

+56
-11
lines changed

4 files changed

+56
-11
lines changed

internal/app/machined/pkg/system/services/registry/store.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ import (
99
"errors"
1010
"fmt"
1111
"io/fs"
12-
"os"
1312
"path/filepath"
1413
"strings"
15-
"syscall"
16-
"time"
1714

1815
"github.com/containerd/containerd/v2/core/content"
1916
"github.com/containerd/errdefs"
@@ -106,11 +103,3 @@ func (s *singleFileStore) blobPath(dgst digest.Digest) (string, error) {
106103
}
107104

108105
var errUnimplemented = errors.New("unimplemented")
109-
110-
func getATime(fi os.FileInfo) time.Time {
111-
if st, ok := fi.Sys().(*syscall.Stat_t); ok {
112-
return time.Unix(st.Atim.Unix())
113-
}
114-
115-
return fi.ModTime()
116-
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This Source Code Form is subject to the terms of the Mozilla Public
2+
// License, v. 2.0. If a copy of the MPL was not distributed with this
3+
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
5+
package registry
6+
7+
import (
8+
"os"
9+
"syscall"
10+
"time"
11+
)
12+
13+
func getATime(fi os.FileInfo) time.Time {
14+
if st, ok := fi.Sys().(*syscall.Stat_t); ok {
15+
return time.Unix(st.Atim.Unix())
16+
}
17+
18+
return fi.ModTime()
19+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// This Source Code Form is subject to the terms of the Mozilla Public
2+
// License, v. 2.0. If a copy of the MPL was not distributed with this
3+
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
5+
//go:build darwin || freebsd || openbsd || netbsd || dragonfly
6+
7+
package registry
8+
9+
import (
10+
"os"
11+
"syscall"
12+
"time"
13+
)
14+
15+
func getATime(fi os.FileInfo) time.Time {
16+
if st, ok := fi.Sys().(*syscall.Stat_t); ok {
17+
return time.Unix(int64(st.Atimespec.Sec), int64(st.Atimespec.Nsec))
18+
}
19+
20+
return fi.ModTime()
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This Source Code Form is subject to the terms of the Mozilla Public
2+
// License, v. 2.0. If a copy of the MPL was not distributed with this
3+
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
5+
//go:build windows
6+
7+
package registry
8+
9+
import (
10+
"os"
11+
"time"
12+
)
13+
14+
func getATime(fi os.FileInfo) time.Time {
15+
return fi.ModTime()
16+
}

0 commit comments

Comments
 (0)