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 9afd7e6 commit 40950e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Makefile
Expand Up @@ -214,8 +214,8 @@ build:
$(GO_BUILD_ENV) $(GO_CMD) build -ldflags="$(LD_FLAGS)" -o bin/manager cmd/kueue/main.go

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

# Build the multiplatform container image locally.
.PHONY: image-local-build
Expand Down Expand Up @@ -323,7 +323,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 40950e9

Please sign in to comment.