Skip to content

Commit

Permalink
Merge pull request containers#993 from kolyshkin/misc
Browse files Browse the repository at this point in the history
Makefile: simplify for modern Go
  • Loading branch information
openshift-merge-robot authored Apr 6, 2022
2 parents d2d52f4 + 1a23fcc commit 3dd66c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ env:


# Default, hard-coded max timeout is 2-hours.
timeout_in: 30m # no need to wait 2-hours before timing out
timeout_in: 60m # no need to wait 2-hours before timing out

gcp_credentials: ENCRYPTED[dd6a042d1805167e38d8b79494f691b86637e68f072eba24220901435afd8d71c63f9006803142447326319102f68b7f]

Expand Down
44 changes: 6 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,9 @@
export GO111MODULE=off

GO ?= go
GO_BUILD=$(GO) build
# Go module support: set `-mod=vendor` to use the vendored sources
ifeq ($(shell go help mod >/dev/null 2>&1 && echo true), true)
GO_BUILD=GO111MODULE=on $(GO) build -mod=vendor
endif
BUILDTAGS := containers_image_openpgp,systemd,exclude_graphdriver_devicemapper
DESTDIR ?=
PREFIX := /usr/local
CONFIGDIR := ${PREFIX}/share/containers
PROJECT := github.com/containers/common

# Enforce the GOPROXY to make sure dependencies are resovled consistently
# across different environments.
export GOPROXY := https://proxy.golang.org

# If GOPATH not specified, use one in the local directory
ifeq ($(GOPATH),)
export GOPATH := $(CURDIR)/_output
unexport GOBIN
endif
FIRST_GOPATH := $(firstword $(subst :, ,$(GOPATH)))
GOPKGDIR := $(FIRST_GOPATH)/src/$(PROJECT)
GOPKGBASEDIR ?= $(shell dirname "$(GOPKGDIR)")

GOBIN := $(shell $(GO) env GOBIN)
ifeq ($(GOBIN),)
GOBIN := $(FIRST_GOPATH)/bin
endif

define go-get
env GO111MODULE=off \
$(GO) get -u ${1}
endef

define go-build
CGO_ENABLED=0 \
Expand Down Expand Up @@ -90,9 +60,9 @@ vendor-in-container:

.PHONY: vendor
vendor:
GO111MODULE=on $(GO) mod tidy
GO111MODULE=on $(GO) mod vendor
GO111MODULE=on $(GO) mod verify
$(GO) mod tidy
$(GO) mod vendor
$(GO) mod verify

.PHONY: install.tools
install.tools: build/golangci-lint .install.md2man
Expand All @@ -106,9 +76,7 @@ build/golangci-lint:


.install.md2man:
if [ ! -x "$(GOBIN)/go-md2man" ]; then \
$(call go-get,github.com/cpuguy83/go-md2man); \
fi
$(GO) install github.com/cpuguy83/go-md2man/v2@latest

.PHONY: install
install:
Expand All @@ -124,8 +92,8 @@ test: test-unit
test-unit:
go test --tags $(BUILDTAGS) -v ./libimage
go test --tags $(BUILDTAGS) -v ./libnetwork/...
go test --tags $(BUILDTAGS) -v $(PROJECT)/pkg/...
go test --tags remote,seccomp,$(BUILDTAGS) -v $(PROJECT)/pkg/...
go test --tags $(BUILDTAGS) -v ./pkg/...
go test --tags remote,seccomp,$(BUILDTAGS) -v ./pkg/...

.PHONY: codespell
codespell:
Expand Down

0 comments on commit 3dd66c0

Please sign in to comment.