libct/*: remove linux build tag from some pkgs

Only some libcontainer packages can be built on non-linux platforms
(not that it make sense, but at least go build succeeds). Let's call
these "good" packages.

For all other packages (i.e. ones that fail to build with GOOS other
than linux), it does not make sense to have linux build tag (as they
are broken already, and thus are not and can not be used on anything
other than Linux).

Remove linux build tag for all non-"good" packages.

This was mostly done by the following script, with just a few manual
fixes on top.

function list_good_pkgs() {
	for pkg in $(find . -type d -print); do
		GOOS=freebsd go build $pkg 2>/dev/null \
		&& GOOS=solaris go build $pkg 2>/dev/null \
		&& echo $pkg
	done | sed -e 's|^./||' | tr '\n' '|' | sed -e 's/|$//'
}

function remove_tag() {
	sed -i -e '\|^// +build linux$|d' $1
	go fmt $1
}

SKIP="^("$(list_good_pkgs)")"
for f in $(git ls-files . | grep .go$); do
	if echo $f | grep -qE "$SKIP"; then
		echo skip $f
		continue
	fi
	echo proc $f
	remove_tag $f
done

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2021-08-30 20:43:12 -07:00
parent c5b0be78e8
commit dbb9fc03ae
62 changed files with 3 additions and 122 deletions
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package cgroups
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package cgroups
import (
@@ -1,5 +1,3 @@
// +build linux
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright (C) 2020 Aleksa Sarai <cyphar@cyphar.com>
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package cgroups
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
@@ -1,5 +1,3 @@
// +build linux
package fs
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
/*
Utility for testing cgroup operations.
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs2
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs2
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs2
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs2
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs2
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs2
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs2
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs2
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fs2
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package fscommon
import (
@@ -1,5 +1,3 @@
// +build linux
package fscommon
import (
+2 -1
View File
@@ -1,4 +1,5 @@
// +build linux,go1.16
//go:build go1.16
// +build go1.16
package cgroups
+1 -1
View File
@@ -1,4 +1,4 @@
// +build linux,!go1.16
// +build !go1.16
package cgroups
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package cgroups
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package cgroups
type ThrottlingData struct {
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package systemd
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package systemd
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package systemd
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package systemd
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package cgroups
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package cgroups
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package intelrdt
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package intelrdt
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package intelrdt
// The flag to indicate if Intel RDT/MBM is enabled
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package intelrdt
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package intelrdt
type L3CacheInfo struct {
-2
View File
@@ -1,5 +1,3 @@
// +build linux
/*
* Utility for testing Intel RDT operations.
* Creates a mock of the Intel RDT "resource control" filesystem for the duration of the test.
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package keys
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package libcontainer
import (
-2
View File
@@ -1,5 +1,3 @@
// +build linux
package utils
/*