Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
more comments
Browse files Browse the repository at this point in the history
Signed-off-by: soorena776 <[email protected]>
  • Loading branch information
soorena776 committed Oct 1, 2019
1 parent aca8f13 commit 7b2e1e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
32 changes: 17 additions & 15 deletions makelib/golang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,10 @@ GO_VENDOR_UPDATE_TARGET = go.vendor.update
# switch for go modules
ifeq ($(GO111MODULE),on)

# set GOPATH to $(WORK_DIR), so that the go modules are installed there, instead of $HOME/go/pkg/mod

GO_MOD_DIR := $(abspath $(WORK_DIR)/mod)
export GOPATH=$(GO_MOD_DIR)/$(PLATFORM)
# set GOPATH to $(GO_PKG_DIR), so that the go modules are installed there, instead of $HOME/go/pkg/mod
export GOPATH=$(abspath $(GO_PKG_DIR))
export GO111MODULE=on

GO_STATIC_FLAGS += -mod=vendor
GO_INIT_REQUIRED_TARGETS = go.mod.verify
GO_VENDOR_TARGET = go.mod.vendor
GO_VENDOR_CHECK_TARGET = go.mod.verify
Expand Down Expand Up @@ -280,8 +277,8 @@ go.mod.vendor:

go.clean:
@# make all read-only go modules folder writable, so they can be deleted
@if [ -d $(GO_MOD_DIR) ]; then \
find $(GO_MOD_DIR) -wholename '*pkg/mod' | \
@if [ -d $(abspath $(WORK_DIR)) ]; then \
find $(abspath $(WORK_DIR)) -wholename '*pkg/mod' | \
while read folder ; do find $$folder -type d -exec chmod +w {} \; \
; done \
fi
Expand All @@ -291,7 +288,13 @@ go.clean:
go.distclean:
@rm -rf $(GO_VENDOR_DIR) $(GO_PKG_DIR)

.PHONY: go.init go.build go.install go.test.unit go.test.integration go.test.codecov go.lint go.vet go.fmt
go.generate: $(GOIMPORTS)
@$(INFO) go generate $(PLATFORM)
@CGO_ENABLED=0 $(GOHOST) generate $(GO_COMMON_FLAGS) $(GO_PACKAGES) $(GO_INTEGRATION_TEST_PACKAGES) || $(FAIL)
@$(OK) go generate $(PLATFORM)
@find $(GO_SUBDIRS) $(GO_INTEGRATION_TESTS_SUBDIRS) -type f -name 'zz_generated*' -exec $(GOIMPORTS) -l -w -local $(GO_PROJECT) {} \;

.PHONY: go.init go.build go.install go.test.unit go.test.integration go.test.codecov go.lint go.vet go.fmt go.generate
.PHONY: go.validate go.vendor.lite go.vendor go.vendor.check go.vendor.update go.clean go.distclean go.mod.vendor go.mod.verify go.mod.update go.mod.vendor

# ====================================================================================
Expand Down Expand Up @@ -321,7 +324,8 @@ vet: go.vet

define GO_HELPTEXT
Go Targets:
fmt Checks go source code for formatting issues.
go.generate Runs go code generation followed by goimports on generated files.
fmt Checks go source code for formatting issues.
fmt.simplify Format, simplify, update source files.
imports Checks go source code import lines for issues.
imports.fix Updates go source files to fix issues with import lines.
Expand Down Expand Up @@ -380,15 +384,13 @@ go.get:
@$(INFO) installing $(GOPKG)
$(eval GO_GET_GOPATH := $(GOPATH))
ifneq ($(GO111MODULE),on)
$(eval GO_GET_GOPATH := $(TOOLS_HOST_DIR)/tmp)
@mkdir -p $(GO_GET_GOPATH) || $(FAIL)
@# set gopath to a temporary folder, where src folders will reside
$(eval GO_GET_GOPATH := $(WORK_DIR)/tmp)
endif
@GOPATH=$(GO_GET_GOPATH) GOBIN=$(TOOLS_HOST_DIR) $(GOHOST) get $(GOPKG) || $(FAIL)
ifneq ($(GO111MODULE),on)
@rm -rf $(GO_GET_GOPATH)
else
ifeq ($(GO111MODULE),on)
@# the below command reverts the go.mod modification because of running `go get`
@# otherwise the build becomes dirty and won't be published
@$(GOHOST) mod tidy
endif
@$(OK) installed $(GOPKG)
@$(OK) installed $(GOPKG)
6 changes: 3 additions & 3 deletions makelib/kubebuilder.mk
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ test.init: $(KUBEBUILDER)

define KUBEBULDER_HELPTEXT
Kubebuilder Targets:
bin run kubebuilder binary, pass args by setting ARGS=""
generate Runs go code generation followed by goimports on generated files.
manifests Generates Kubernetes custom resources manifests (e.g. CRDs RBACs, ...)
bin run kubebuilder binary, pass args by setting ARGS=""
generate,codegen Runs go code generation, to execute controller-gen tool
manifests Generates Kubernetes custom resources manifests (e.g. CRDs RBACs, ...)

endef
export KUBEBULDER_HELPTEXT
Expand Down

0 comments on commit 7b2e1e3

Please sign in to comment.