Skip to content

Commit

Permalink
Rationalise build constraints for Go 1.19 onwards
Browse files Browse the repository at this point in the history
This mostly involves replacing anything that was trying to be "Not
Windows" with the new-in-Go-1.19 "unix" build-constraint. Effectively,
anything that contained both "linux" and "freebsd" but not "windows", or
excluded only "windows", is now "unix".

A couple of needless constraints were removed when the filenames already
carried the appropriate constraint.

A handful of files were renamed, so that now "unix"-suffixed files all
use the "unix" constraint, and "other" is used when the constraint is
more-complex, for "no specific implementation" cases.

Signed-off-by: Paul "TBBle" Hampson <[email protected]>
  • Loading branch information
TBBle committed Apr 8, 2024
1 parent 5fac99b commit b5117a2
Show file tree
Hide file tree
Showing 25 changed files with 18 additions and 28 deletions.
2 changes: 1 addition & 1 deletion cmd/nerdctl/container_top_unix_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux || darwin || freebsd || netbsd || openbsd
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/main_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/network_create_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/buildkitutil/buildkitutil_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cioutil/container_io_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 0 additions & 2 deletions pkg/cioutil/container_io_windows.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build windows

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/container/top_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux || darwin || freebsd || netbsd || openbsd
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/login/login_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/consoleutil/consoleutil_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/containerutil/container_network_manager_other.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build darwin || freebsd || netbsd || openbsd
//go:build !(linux || windows)

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/infoutil/infoutil_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/infoutil/infoutil_unix_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 0 additions & 2 deletions pkg/ipcutil/ipcutil_linux.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build linux

/*
Copyright The containerd Authors.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd
//go:build !(linux || windows)

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/lockutil/lockutil_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 0 additions & 2 deletions pkg/mountutil/mountutil_windows.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build windows

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/netutil/cni_plugin_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 0 additions & 2 deletions pkg/netutil/netutil_linux_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build linux

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/netutil/netutil_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 1 addition & 1 deletion pkg/netutil/netutil_unix_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down
2 changes: 0 additions & 2 deletions pkg/netutil/netutil_windows_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build windows

/*
Copyright The containerd Authors.
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/systemutil/socket_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd || linux
//go:build unix

/*
Copyright The containerd Authors.
Expand Down

0 comments on commit b5117a2

Please sign in to comment.