Skip to content

Commit cc5d151

Browse files
dmcgowanthaJeztah
authored andcommitted
Update go list to respect build tags
This prevents packages with no Go included files due to build constraints being included in the package list. These packages cause the test command to fail with "can't load package build constraints exclude all Go files". Signed-off-by: Derek McGowan <[email protected]> (cherry picked from commit 3275a21) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 6b5fc7f commit cc5d151

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Makefile

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,22 @@ RELEASE=containerd-$(VERSION:v%=%).${GOOS}-${GOARCH}
6868

6969
PKG=github.com/containerd/containerd
7070

71+
# Project binaries.
72+
COMMANDS=ctr containerd containerd-stress
73+
MANPAGES=ctr.8 containerd.8 containerd-config.8 containerd-config.toml.5
74+
75+
ifdef BUILDTAGS
76+
GO_BUILDTAGS = ${BUILDTAGS}
77+
endif
78+
# Build tags apparmor and selinux are needed by CRI plugin.
79+
GO_BUILDTAGS ?= apparmor selinux
80+
GO_BUILDTAGS += ${DEBUG_TAGS}
81+
GO_TAGS=$(if $(GO_BUILDTAGS),-tags "$(GO_BUILDTAGS)",)
82+
GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)'
83+
SHIM_GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static" $(EXTRA_LDFLAGS)'
84+
7185
# Project packages.
72-
PACKAGES=$(shell go list ./... | grep -v /vendor/)
86+
PACKAGES=$(shell go list ${GO_TAGS} ./... | grep -v /vendor/)
7387
INTEGRATION_PACKAGE=${PKG}
7488
TEST_REQUIRES_ROOT_PACKAGES=$(filter \
7589
${PACKAGES}, \
@@ -86,20 +100,6 @@ ifdef SKIPTESTS
86100
TEST_REQUIRES_ROOT_PACKAGES:=$(filter-out ${SKIPTESTS},${TEST_REQUIRES_ROOT_PACKAGES})
87101
endif
88102

89-
# Project binaries.
90-
COMMANDS=ctr containerd containerd-stress
91-
MANPAGES=ctr.8 containerd.8 containerd-config.8 containerd-config.toml.5
92-
93-
ifdef BUILDTAGS
94-
GO_BUILDTAGS = ${BUILDTAGS}
95-
endif
96-
# Build tags apparmor and selinux are needed by CRI plugin.
97-
GO_BUILDTAGS ?= apparmor selinux
98-
GO_BUILDTAGS += ${DEBUG_TAGS}
99-
GO_TAGS=$(if $(GO_BUILDTAGS),-tags "$(GO_BUILDTAGS)",)
100-
GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)'
101-
SHIM_GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static" $(EXTRA_LDFLAGS)'
102-
103103
#Replaces ":" (*nix), ";" (windows) with newline for easy parsing
104104
GOPATHS=$(shell echo ${GOPATH} | tr ":" "\n" | tr ";" "\n")
105105

0 commit comments

Comments
 (0)