Skip to content

Commit

Permalink
fix: Solving make run errors under Go vendor mode.
Browse files Browse the repository at this point in the history
Signed-off-by: wangdepeng <wangdepeng_yewu@cmss.chinamobile.com>
  • Loading branch information
village-way committed Mar 6, 2024
1 parent f1856b3 commit 9761017
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -219,7 +219,7 @@ build:

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
$(GO_CMD) run cmd/kueue/main.go
$(GO_CMD) run cmd/kueue/main.go $(ARGS)

# Build the multiplatform container image locally.
.PHONY: image-local-build
Expand Down Expand Up @@ -327,7 +327,7 @@ golangci-lint: ## Download golangci-lint locally if necessary.
CONTROLLER_GEN = $(PROJECT_DIR)/bin/controller-gen
.PHONY: controller-gen
controller-gen: ## Download controller-gen locally if necessary.
@GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install sigs.k8s.io/controller-tools/cmd/controller-gen
@GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0

KUSTOMIZE = $(PROJECT_DIR)/bin/kustomize
.PHONY: kustomize
Expand Down
13 changes: 8 additions & 5 deletions hack/update-codegen.sh
Expand Up @@ -19,11 +19,14 @@ set -o nounset
set -o pipefail

GO_CMD=${1:-go}
KUEUE_ROOT=$(realpath $(dirname ${BASH_SOURCE[0]})/..)
CODEGEN_PKG=$($GO_CMD list -m -f "{{.Dir}}" k8s.io/code-generator)

cd $(dirname ${BASH_SOURCE[0]})/..

KUEUE_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]})"/..))
if [ -d "vendor" ]; then
CODEGEN_PKG=$($GO_CMD list -m -f "vendor/k8s.io/code-generator" k8s.io/code-generator)
else
CODEGEN_PKG=$($GO_CMD list -m -f "{{.Dir}}" k8s.io/code-generator)
fi

cd $(dirname "${BASH_SOURCE[0]}")/..
source "${CODEGEN_PKG}/kube_codegen.sh"

# TODO: remove the workaround when the issue is solved in the code-generator
Expand Down

0 comments on commit 9761017

Please sign in to comment.