diff --git a/Makefile b/Makefile
index 954dc7464f..6159fa7a83 100644
--- a/Makefile
+++ b/Makefile
@@ -154,7 +154,7 @@ lang: ## generates the lexer/parser for the language frontend
# build a `mgmt` binary for current host os/arch
$(PROGRAM): build/mgmt-${GOHOSTOS}-${GOHOSTARCH} ## build an mgmt binary for current host os/arch
- cp -a $< $@
+ @cp -a $< $@
$(PROGRAM).static: $(GO_FILES) $(MCL_FILES)
@echo "Building: $(PROGRAM).static, version: $(SVERSION)..."
diff --git a/converger/converger_test.go b/converger/converger_test.go
index 62aafc1948..ff4d1c23df 100644
--- a/converger/converger_test.go
+++ b/converger/converger_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package converger
diff --git a/engine/autoedge_test.go b/engine/autoedge_test.go
index 4b60280c80..ada1380328 100644
--- a/engine/autoedge_test.go
+++ b/engine/autoedge_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package engine
diff --git a/engine/graph/autogroup/autogroup_test.go b/engine/graph/autogroup/autogroup_test.go
index 3efb7ad3ef..41719425f4 100644
--- a/engine/graph/autogroup/autogroup_test.go
+++ b/engine/graph/autogroup/autogroup_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package autogroup
diff --git a/engine/graph/graph_test.go b/engine/graph/graph_test.go
index 1465a1ca78..1828adfd84 100644
--- a/engine/graph/graph_test.go
+++ b/engine/graph/graph_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package graph
diff --git a/engine/graph/semaphore_test.go b/engine/graph/semaphore_test.go
index 1fbb296310..c35bc68d84 100644
--- a/engine/graph/semaphore_test.go
+++ b/engine/graph/semaphore_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package graph
diff --git a/engine/metaparams_test.go b/engine/metaparams_test.go
index 0f600243cb..15a21497ef 100644
--- a/engine/metaparams_test.go
+++ b/engine/metaparams_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package engine
diff --git a/engine/resources/augeas.go b/engine/resources/augeas.go
index 9c6e098783..34c6dab669 100644
--- a/engine/resources/augeas.go
+++ b/engine/resources/augeas.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !noaugeas
// +build !noaugeas
package resources
diff --git a/engine/resources/docker_container.go b/engine/resources/docker_container.go
index 04dcfda71a..58c1cd394c 100644
--- a/engine/resources/docker_container.go
+++ b/engine/resources/docker_container.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !nodocker
// +build !nodocker
package resources
diff --git a/engine/resources/docker_container_test.go b/engine/resources/docker_container_test.go
index 8b8bb0eeb7..c2ded5c0eb 100644
--- a/engine/resources/docker_container_test.go
+++ b/engine/resources/docker_container_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !nodocker
// +build !nodocker
package resources
diff --git a/engine/resources/docker_image.go b/engine/resources/docker_image.go
index 6376c3fb81..d6ff84c4f7 100644
--- a/engine/resources/docker_image.go
+++ b/engine/resources/docker_image.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !nodocker
// +build !nodocker
package resources
diff --git a/engine/resources/exec_test.go b/engine/resources/exec_test.go
index 5e8c433ed5..103059ce16 100644
--- a/engine/resources/exec_test.go
+++ b/engine/resources/exec_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package resources
diff --git a/engine/resources/file_test.go b/engine/resources/file_test.go
index 1d081cd082..77b482c989 100644
--- a/engine/resources/file_test.go
+++ b/engine/resources/file_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package resources
diff --git a/engine/resources/mount_linux_test.go b/engine/resources/mount_linux_test.go
index 11a910d7f9..45b554a254 100644
--- a/engine/resources/mount_linux_test.go
+++ b/engine/resources/mount_linux_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root || !darwin
// +build !root !darwin
package resources
diff --git a/engine/resources/mount_test.go b/engine/resources/mount_test.go
index fbd0106952..865508d1c1 100644
--- a/engine/resources/mount_test.go
+++ b/engine/resources/mount_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package resources
diff --git a/engine/resources/msg_test.go b/engine/resources/msg_test.go
index 5299eec320..3e7ed95c29 100644
--- a/engine/resources/msg_test.go
+++ b/engine/resources/msg_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package resources
diff --git a/engine/resources/net.go b/engine/resources/net.go
index 2150e11b9f..629d90a3de 100644
--- a/engine/resources/net.go
+++ b/engine/resources/net.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !darwin
// +build !darwin
package resources
diff --git a/engine/resources/net_test.go b/engine/resources/net_test.go
index 9ec3afdce6..20c70a858b 100644
--- a/engine/resources/net_test.go
+++ b/engine/resources/net_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !darwin
// +build !darwin
package resources
diff --git a/engine/resources/noop_test.go b/engine/resources/noop_test.go
index 9a6934a857..361d24d644 100644
--- a/engine/resources/noop_test.go
+++ b/engine/resources/noop_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package resources
diff --git a/engine/resources/pippet_test.go b/engine/resources/pippet_test.go
index eeb8fa62df..7b5e36ab84 100644
--- a/engine/resources/pippet_test.go
+++ b/engine/resources/pippet_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package resources
diff --git a/engine/resources/pkg_test.go b/engine/resources/pkg_test.go
index 204276167b..daaa502833 100644
--- a/engine/resources/pkg_test.go
+++ b/engine/resources/pkg_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package resources
diff --git a/engine/resources/resources_test.go b/engine/resources/resources_test.go
index cdcfc99cf5..b7ea45da0f 100644
--- a/engine/resources/resources_test.go
+++ b/engine/resources/resources_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package resources
diff --git a/engine/resources/test_test.go b/engine/resources/test_test.go
index 08755483ff..f7587c756c 100644
--- a/engine/resources/test_test.go
+++ b/engine/resources/test_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package resources
diff --git a/engine/resources/virt.go b/engine/resources/virt.go
index 0ba4128739..680d76c887 100644
--- a/engine/resources/virt.go
+++ b/engine/resources/virt.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !novirt
// +build !novirt
package resources
diff --git a/engine/util/mode_test.go b/engine/util/mode_test.go
index 7f4c4d3841..4b4af19a2a 100644
--- a/engine/util/mode_test.go
+++ b/engine/util/mode_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package util
diff --git a/engine/util/util_test.go b/engine/util/util_test.go
index ddac263163..347cda7ee6 100644
--- a/engine/util/util_test.go
+++ b/engine/util/util_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package util
diff --git a/integration/basic_test.go b/integration/basic_test.go
index 30e8cf9853..990665a87e 100644
--- a/integration/basic_test.go
+++ b/integration/basic_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package integration
diff --git a/integration/util_test.go b/integration/util_test.go
index 365e35469a..09def4505a 100644
--- a/integration/util_test.go
+++ b/integration/util_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package integration
diff --git a/lang/funcs/core/core_test.go b/lang/funcs/core/core_test.go
index 641bacc84d..a55ff89dc0 100644
--- a/lang/funcs/core/core_test.go
+++ b/lang/funcs/core/core_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package core
diff --git a/lang/funcs/core/datetime/format_func_test.go b/lang/funcs/core/datetime/format_func_test.go
index 3a08b1a26b..d41c68c67c 100644
--- a/lang/funcs/core/datetime/format_func_test.go
+++ b/lang/funcs/core/datetime/format_func_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !darwin
// +build !darwin
package coredatetime
diff --git a/lang/funcs/core/sys/cpucount_fact.go b/lang/funcs/core/sys/cpucount_fact.go
index c1fd3c250d..a048a02a29 100644
--- a/lang/funcs/core/sys/cpucount_fact.go
+++ b/lang/funcs/core/sys/cpucount_fact.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !darwin
// +build !darwin
package coresys
diff --git a/lang/funcs/core/sys/cpucount_fact_test.go b/lang/funcs/core/sys/cpucount_fact_test.go
index bbbad3cbb5..151c6c2efa 100644
--- a/lang/funcs/core/sys/cpucount_fact_test.go
+++ b/lang/funcs/core/sys/cpucount_fact_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !darwin
// +build !darwin
package coresys
diff --git a/lang/funcs/core/sys/load_fact_darwin.go b/lang/funcs/core/sys/load_fact_darwin.go
index 5e1b614af4..32143461f0 100644
--- a/lang/funcs/core/sys/load_fact_darwin.go
+++ b/lang/funcs/core/sys/load_fact_darwin.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build darwin
// +build darwin
package coresys
diff --git a/lang/funcs/core/sys/load_fact_posix.go b/lang/funcs/core/sys/load_fact_posix.go
index d5ffff3f0f..c77259ad5e 100644
--- a/lang/funcs/core/sys/load_fact_posix.go
+++ b/lang/funcs/core/sys/load_fact_posix.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !darwin
// +build !darwin
package coresys
diff --git a/lang/funcs/core/sys/uptime_fact_darwin.go b/lang/funcs/core/sys/uptime_fact_darwin.go
index 3a71fd3da7..4abbc48662 100644
--- a/lang/funcs/core/sys/uptime_fact_darwin.go
+++ b/lang/funcs/core/sys/uptime_fact_darwin.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build darwin
// +build darwin
package coresys
diff --git a/lang/funcs/core/sys/uptime_fact_posix.go b/lang/funcs/core/sys/uptime_fact_posix.go
index 999349bfbf..6c829ac751 100644
--- a/lang/funcs/core/sys/uptime_fact_posix.go
+++ b/lang/funcs/core/sys/uptime_fact_posix.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !darwin
// +build !darwin
package coresys
diff --git a/lang/funcs/facts/func_test.go b/lang/funcs/facts/func_test.go
index 803f319393..6ffea65797 100644
--- a/lang/funcs/facts/func_test.go
+++ b/lang/funcs/facts/func_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package facts
diff --git a/lang/funcs/funcs_test.go b/lang/funcs/funcs_test.go
index b7b94b3e5e..7225702397 100644
--- a/lang/funcs/funcs_test.go
+++ b/lang/funcs/funcs_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package funcs
diff --git a/lang/interfaces/metadata_test.go b/lang/interfaces/metadata_test.go
index de299af6be..fdbe6e0cff 100644
--- a/lang/interfaces/metadata_test.go
+++ b/lang/interfaces/metadata_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package interfaces
diff --git a/lang/interpolate_test.go b/lang/interpolate_test.go
index d5971023ab..1b2ee6c48a 100644
--- a/lang/interpolate_test.go
+++ b/lang/interpolate_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package lang
diff --git a/lang/interpret_test.go b/lang/interpret_test.go
index e45eb0c4c5..a19eee1202 100644
--- a/lang/interpret_test.go
+++ b/lang/interpret_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package lang
diff --git a/lang/lang_test.go b/lang/lang_test.go
index 2187975673..3102f07688 100644
--- a/lang/lang_test.go
+++ b/lang/lang_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package lang
diff --git a/lang/lexparse_test.go b/lang/lexparse_test.go
index 87fb3e396d..d3dffa7e78 100644
--- a/lang/lexparse_test.go
+++ b/lang/lexparse_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package lang
diff --git a/lang/scope_test.go b/lang/scope_test.go
index 55870a29cf..583dba57db 100644
--- a/lang/scope_test.go
+++ b/lang/scope_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package lang
diff --git a/lang/types/type_test.go b/lang/types/type_test.go
index c074a0bd99..85063bed35 100644
--- a/lang/types/type_test.go
+++ b/lang/types/type_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package types
diff --git a/lang/types/value_test.go b/lang/types/value_test.go
index d793324d5c..ab3acb7086 100644
--- a/lang/types/value_test.go
+++ b/lang/types/value_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package types
diff --git a/lang/unification_test.go b/lang/unification_test.go
index 733ed33fcb..15ed9de755 100644
--- a/lang/unification_test.go
+++ b/lang/unification_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package lang
diff --git a/lib/main_test.go b/lib/main_test.go
index 6bce73b7e1..533fe4563e 100644
--- a/lib/main_test.go
+++ b/lib/main_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package lib
diff --git a/misc/make-deps.sh b/misc/make-deps.sh
index 70fc25e14e..6ca10e77ae 100755
--- a/misc/make-deps.sh
+++ b/misc/make-deps.sh
@@ -1,8 +1,7 @@
#!/bin/bash
# setup a simple golang environment
-XPWD=`pwd`
-ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" # dir!
-cd "${ROOT}" >/dev/null
+ROOT="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd)" # dir!
+pushd "${ROOT}" >/dev/null || exit 1
. ${ROOT}/test/util.sh
@@ -126,14 +125,13 @@ fi
[ -e "$GOBIN/mgmt" ] && rm -f "$GOBIN/mgmt" # the `go get` version has no -X
fold_start "Install golang tools"
-# TODO: change this for golang 1.17
-go get github.com/blynn/nex # for lexing
-go get golang.org/x/tools/cmd/goyacc # formerly `go tool yacc`
-go get golang.org/x/tools/cmd/stringer # for automatic stringer-ing
-go get golang.org/x/lint/golint # for `golint`-ing
-go get golang.org/x/tools/cmd/goimports # for fmt
-go get github.com/kevinburke/go-bindata/go-bindata # for compiling in non golang files
-go get github.com/dvyukov/go-fuzz/go-fuzz # for fuzzing the mcl lang bits
+go install github.com/blynn/nex@latest # for lexing
+go install golang.org/x/tools/cmd/goyacc@latest # formerly `go tool yacc`
+go install golang.org/x/tools/cmd/stringer@latest # for automatic stringer-ing
+go install golang.org/x/lint/golint@latest # for `golint`-ing
+go install golang.org/x/tools/cmd/goimports@latest # for fmt
+go install github.com/kevinburke/go-bindata/go-bindata@latest # for compiling in non golang files
+go install github.com/dvyukov/go-fuzz/go-fuzz@latest # for fuzzing the mcl lang bits
fold_end "Install golang tools"
fold_start "Install miscellaneous tools"
@@ -141,4 +139,4 @@ command -v mdl &>/dev/null || gem install mdl --no-document || true # for lintin
command -v fpm &>/dev/null || gem install fpm --no-document || true # for cross distro packaging
fold_end "Install miscellaneous tools"
-cd "$XPWD" >/dev/null
+popd
diff --git a/pgraph/graphsync_test.go b/pgraph/graphsync_test.go
index 2af41f812f..792cfbf208 100644
--- a/pgraph/graphsync_test.go
+++ b/pgraph/graphsync_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package pgraph
diff --git a/pgraph/pgraph_test.go b/pgraph/pgraph_test.go
index 709b753bf8..97b37bb011 100644
--- a/pgraph/pgraph_test.go
+++ b/pgraph/pgraph_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package pgraph
diff --git a/pgraph/subgraph_test.go b/pgraph/subgraph_test.go
index 86fde4ef5d..6c96173fc3 100644
--- a/pgraph/subgraph_test.go
+++ b/pgraph/subgraph_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package pgraph
diff --git a/pgraph/util_test.go b/pgraph/util_test.go
index 060aaf846c..27c95d6884 100644
--- a/pgraph/util_test.go
+++ b/pgraph/util_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package pgraph
diff --git a/prometheus/prometheus_test.go b/prometheus/prometheus_test.go
index 0086d2479b..c25af9b188 100644
--- a/prometheus/prometheus_test.go
+++ b/prometheus/prometheus_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package prometheus
diff --git a/spec.in b/spec.in
index fa3faf9c1a..0e01cedb65 100644
--- a/spec.in
+++ b/spec.in
@@ -27,6 +27,7 @@ A next generation config management prototype!
%setup -q
%build
+go mod download
make build
%install
diff --git a/test/test-examples.sh b/test/test-examples.sh
index f7f2f94c78..7e457ec0f0 100755
--- a/test/test-examples.sh
+++ b/test/test-examples.sh
@@ -14,28 +14,18 @@ failures=''
# TODO: test examples/lang/ directory to see if the .mcl files compile correctly
buildout='test-examples.out'
-# make symlink to outside of package
-linkto="`pwd`/examples/lib/"
-tmpdir="`$mktemp --tmpdir -d tmp.XXX`" # get a dir outside of the main package
-cd "$tmpdir"
-ln -s "$linkto" # symlink outside of dir
-cd `basename "$linkto"`
+
+trap 'rm -fv "$buildout"' EXIT # clean up build mess
# loop through individual *.go files in working dir
-for file in `find . -maxdepth 9 -type f -name '*.go'`; do
- #echo "running test on: $file"
- run-test go build -i -o "$buildout" "$file" || fail_test "could not build: $file"
+find examples/lib -maxdepth 9 -type f -name '*.go' | while read -r file; do
+ echo "running test on: $file"
+ run-test go build -o "$buildout" "$file" || fail_test "could not build: $file"
done
-rm "$buildout" || true # clean up build mess
-
-cd - >/dev/null # back to tmp dir
-rm `basename "$linkto"`
-cd ..
-rmdir "$tmpdir" # cleanup
if [[ -n "$failures" ]]; then
echo 'FAIL'
- echo "The following tests (in: ${linkto}) have failed:"
+ echo "The following tests have failed:"
echo -e "$failures"
echo
exit 1
diff --git a/util/afero_test.go b/util/afero_test.go
index b88a20dbc7..911851f392 100644
--- a/util/afero_test.go
+++ b/util/afero_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package util
diff --git a/util/code_test.go b/util/code_test.go
index a37767ebf3..91a4e0b2c6 100644
--- a/util/code_test.go
+++ b/util/code_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package util
diff --git a/util/context_test.go b/util/context_test.go
index 3e1e621aa1..1e259a1a26 100644
--- a/util/context_test.go
+++ b/util/context_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package util
diff --git a/util/errwrap/errwrap_test.go b/util/errwrap/errwrap_test.go
index b4cc9b1e00..9049374375 100644
--- a/util/errwrap/errwrap_test.go
+++ b/util/errwrap/errwrap_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package errwrap
diff --git a/util/home_test.go b/util/home_test.go
index d71e0d2be2..85a36f16c5 100644
--- a/util/home_test.go
+++ b/util/home_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package util
diff --git a/util/root_test.go b/util/root_test.go
index cb1f40986d..0aebeb4edd 100644
--- a/util/root_test.go
+++ b/util/root_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build root
// +build root
package util
diff --git a/util/socketset/socketset.go b/util/socketset/socketset.go
index bf24927610..6d4ea431a6 100644
--- a/util/socketset/socketset.go
+++ b/util/socketset/socketset.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !darwin
// +build !darwin
// Package socketset is in API for creating a select style netlink socket to
diff --git a/util/socketset/socketset_test.go b/util/socketset/socketset_test.go
index da3cfa5a16..c0734c4036 100644
--- a/util/socketset/socketset_test.go
+++ b/util/socketset/socketset_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !darwin
// +build !darwin
package socketset
diff --git a/util/sync_test.go b/util/sync_test.go
index 215f02d0f1..0c2ea7ce75 100644
--- a/util/sync_test.go
+++ b/util/sync_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package util
diff --git a/util/util_test.go b/util/util_test.go
index 0b41668c8d..f334c65508 100644
--- a/util/util_test.go
+++ b/util/util_test.go
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+//go:build !root
// +build !root
package util