Skip to content

Commit b9a3e7b

Browse files
authored
Merge pull request moby#5271 from slonopotamus/cleanup-linuxisms
Cleanup Linux-isms in code
2 parents 11a4a07 + c8c5024 commit b9a3e7b

11 files changed

+23
-45
lines changed

cmd/buildkitd/constants_unix.go

Lines changed: 0 additions & 8 deletions
This file was deleted.

cmd/buildkitd/constants_windows.go

Lines changed: 0 additions & 5 deletions
This file was deleted.

cmd/buildkitd/main_containerd_worker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func init() {
4343
}
4444

4545
if defaultConf.Workers.Containerd.Address == "" {
46-
defaultConf.Workers.Containerd.Address = defaultContainerdAddress
46+
defaultConf.Workers.Containerd.Address = defaults.DefaultAddress
4747
}
4848

4949
if defaultConf.Workers.Containerd.Namespace == "" {
@@ -178,7 +178,7 @@ func init() {
178178

179179
func applyContainerdFlags(c *cli.Context, cfg *config.Config) error {
180180
if cfg.Workers.Containerd.Address == "" {
181-
cfg.Workers.Containerd.Address = defaultContainerdAddress
181+
cfg.Workers.Containerd.Address = defaults.DefaultAddress
182182
}
183183

184184
if c.GlobalIsSet("containerd-worker") {

hack/Vagrantfile.freebsd13

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Vagrant.configure("2") do |config|
5757
#!/usr/bin/env bash
5858
set -eux -o pipefail
5959
mkdir -p /run/buildkit
60-
daemon -o /vagrant/.tmp/logs/buildkitd /usr/local/bin/buildkitd --addr=unix:///run/buildkit/buildkitd.sock
60+
daemon -o /vagrant/.tmp/logs/buildkitd /usr/local/bin/buildkitd
6161
sleep 3
6262
SHELL
6363
end

snapshot/diffapply_freebsd.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

snapshot/diffapply_unix.go renamed to snapshot/diffapply_linux.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//go:build !windows && !freebsd
2-
// +build !windows,!freebsd
3-
41
package snapshot
52

63
import (
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
//go:build windows
2-
// +build windows
1+
//go:build !linux
2+
// +build !linux
33

44
package snapshot
55

66
import (
77
"context"
8+
"runtime"
89

910
"github.com/containerd/containerd/leases"
1011
"github.com/containerd/containerd/snapshots"
1112
"github.com/pkg/errors"
1213
)
1314

1415
func (sn *mergeSnapshotter) diffApply(_ context.Context, _ Mountable, _ ...Diff) (_ snapshots.Usage, rerr error) {
15-
return snapshots.Usage{}, errors.New("diffApply not yet supported on windows")
16+
return snapshots.Usage{}, errors.New("diffApply not yet supported on " + runtime.GOOS)
1617
}
1718

1819
func needsUserXAttr(_ context.Context, _ Snapshotter, _ leases.Manager) (bool, error) {
19-
return false, errors.New("needs userxattr not supported on windows")
20+
return false, errors.New("needs userxattr not supported on " + runtime.GOOS)
2021
}

source/git/source_unix.go renamed to source/git/source_linux.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//go:build !windows && !freebsd
2-
// +build !windows,!freebsd
3-
41
package git
52

63
import (

util/appdefaults/appdefaults_linux.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package appdefaults
2+
3+
const (
4+
Address = "unix:///run/buildkit/buildkitd.sock"
5+
traceSocketPath = "/run/buildkit/otel-grpc.sock"
6+
)

util/appdefaults/appdefaults_unix.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
)
1111

1212
const (
13-
Address = "unix:///run/buildkit/buildkitd.sock"
1413
Root = "/var/lib/buildkit"
1514
ConfigDir = "/etc/buildkit"
1615
DefaultCNIBinDir = "/opt/cni/bin"
@@ -82,5 +81,5 @@ func TraceSocketPath(inUserNS bool) string {
8281
return filepath.Join(dirs[0], "buildkit", "otel-grpc.sock")
8382
}
8483
}
85-
return "/run/buildkit/otel-grpc.sock"
84+
return traceSocketPath
8685
}

0 commit comments

Comments
 (0)