Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Solving make run errors under Go vendor mode. #1807

Closed
wants to merge 1 commit into from

Conversation

village-way
Copy link
Contributor

What type of PR is this?

kind cleanup

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

@alculquicondor

Does this PR introduce a user-facing change?


@k8s-ci-robot
Copy link
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Mar 6, 2024
Copy link

linux-foundation-easycla bot commented Mar 6, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: village-way
Once this PR has been reviewed and has the lgtm label, please assign alculquicondor for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Mar 6, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 6, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @village-way!

It looks like this is your first PR to kubernetes-sigs/kueue 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kueue has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 6, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @village-way. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 6, 2024
Copy link

netlify bot commented Mar 6, 2024

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 9761017
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/65e815cf7a76550008ed0fb7

Signed-off-by: wangdepeng <wangdepeng_yewu@cmss.chinamobile.com>
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 6, 2024
@village-way
Copy link
Contributor Author

/easycla

Copy link
Contributor

@trasc trasc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a specific use-case for this?

Depending on what you want to do, in my opinion , it's easier to just install and deploy

@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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controller-gen should use the version set in go.mod

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Please revert this line, as the version is locked in go.mod #1720

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Please revert this line, as the version is locked in go.mod #1720
I am a novice in Go and Kubernetes development. I wanted to address the following issue, which is why I changed that line of code.

image

@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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Please revert this line, as the version is locked in go.mod #1720

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

KUEUE_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]})"/..))
if [ -d "vendor" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you have a vendor folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you have a vendor folder?

"The 'go mod vendor' command automatically generates the 'vendor' directory. If this command is not used to copy dependencies to the project space, the GoLang editor cannot automatically locate dependencies such as 'sigs.k8s.io/controller-runtime', resulting in red error indicators indicating that the dependencies cannot be found."

@village-way
Copy link
Contributor Author

Do you have a specific use-case for this?

Depending on what you want to do, in my opinion , it's easier to just install and deploy

I just want to start the kueue main.go process and debug the code in the goland, so want to run that in make run with flags or in the goland Run/Debug configurations

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 8, 2024
@tenzen-y
Copy link
Member

tenzen-y commented Mar 8, 2024

Do you have a specific use-case for this?
Depending on what you want to do, in my opinion , it's easier to just install and deploy

I just want to start the kueue main.go process and debug the code in the goland, so want to run that in make run with flags or in the goland Run/Debug configurations

I'm not sure why we should have the vendor if we use Goland.

@alculquicondor
Copy link
Contributor

Can you make sure you are using go v1.21 or newer and that you enable go modules support in golang? https://www.jetbrains.com/help/go/create-a-project-with-go-modules-integration.html#using-go-modules-in-your-project

You should not run go mod vendor

@village-way
Copy link
Contributor Author

Can you make sure you are using go v1.21 or newer and that you enable go modules support in golang? https://www.jetbrains.com/help/go/create-a-project-with-go-modules-integration.html#using-go-modules-in-your-project

You should not run go mod vendor
this is the go env

GO111MODULE='on'
GOARCH='amd64'
GOBIN='/Users/devine/go'
GOCACHE='/Users/devine/Library/Caches/go-build'
GOENV='/Users/devine/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/devine/go/pkg/mod'
GONOPROXY='gitlab.*.com'
GONOSUMDB='gitlab.*.com'
GOOS='darwin'
GOPATH='/Users/devine/go'
GOPRIVATE='gitlab.*.com'
GOPROXY='https://goproxy.cn,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22.1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/devine/GolandProjects/kueue/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/fm/sp8j2q9d5q55x1rdzlywfzs00000gp/T/go-build1822828399=/tmp/go-build -gno-record-gcc-switches -fno-common'

if not run go mod vendor everythings is ok, after run go mod vendor the make run this command, will occurs cannot find module providing package sigs.k8s.io/controller-tools/cmd/controller-gen: import lookup disabled by -mod=vendor (Go version in go.mod is at least 1.14 and vendor directory exists.) make: *** [controller-gen] Error 1 that's why i add the version for the controller-gen in the script dependencies. Only run go mod vendor, the goland can find the dependencies. The config of goland is
image

@village-way
Copy link
Contributor Author

Do you have a specific use-case for this?
Depending on what you want to do, in my opinion , it's easier to just install and deploy

I just want to start the kueue main.go process and debug the code in the goland, so want to run that in make run with flags or in the goland Run/Debug configurations

I'm not sure why we should have the vendor if we use Goland.

Every time GoLand is opened, it executes go list. However, this go list command fails, and it's unclear if this is the cause. Executing go mod vendor is just to allow GoLand to find dependencies without prompting that they can't be found.

image

@tenzen-y
Copy link
Member

tenzen-y commented Mar 9, 2024

Do you have a specific use-case for this?
Depending on what you want to do, in my opinion , it's easier to just install and deploy

I just want to start the kueue main.go process and debug the code in the goland, so want to run that in make run with flags or in the goland Run/Debug configurations

I'm not sure why we should have the vendor if we use Goland.

Every time GoLand is opened, it executes go list. However, this go list command fails, and it's unclear if this is the cause. Executing go mod vendor is just to allow GoLand to find dependencies without prompting that they can't be found.

image

That problem could be fixed by #1345.

@village-way
Copy link
Contributor Author

village-way commented Mar 9, 2024

Do you have a specific use-case for this?
Depending on what you want to do, in my opinion , it's easier to just install and deploy

I just want to start the kueue main.go process and debug the code in the goland, so want to run that in make run with flags or in the goland Run/Debug configurations

I'm not sure why we should have the vendor if we use Goland.

Every time GoLand is opened, it executes go list. However, this go list command fails, and it's unclear if this is the cause. Executing go mod vendor is just to allow GoLand to find dependencies without prompting that they can't be found.
image

That problem could be fixed by #1345.

Thank you very much, according to #1345 , this problem can be fixed and we don't need run go mod vendor, so why not add this lines to go.mod file ? @tenzen-y

replace (
	k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.3
	k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.28.3
	k8s.io/kubectl => k8s.io/kubectl v0.28.3
	k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.28.3
)

@tenzen-y
Copy link
Member

tenzen-y commented Mar 9, 2024

Do you have a specific use-case for this?
Depending on what you want to do, in my opinion , it's easier to just install and deploy

I just want to start the kueue main.go process and debug the code in the goland, so want to run that in make run with flags or in the goland Run/Debug configurations

I'm not sure why we should have the vendor if we use Goland.

Every time GoLand is opened, it executes go list. However, this go list command fails, and it's unclear if this is the cause. Executing go mod vendor is just to allow GoLand to find dependencies without prompting that they can't be found.
image

That problem could be fixed by #1345.

Thank you very much, according to #1345 , this problem can be fixed and we don't need run go mod vendor, so why not add this lines to go.mod file ? @tenzen-y

replace (
	k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.3
	k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.28.3
	k8s.io/kubectl => k8s.io/kubectl v0.28.3
	k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.28.3
)

I don't think so since after #1345 is fixed, we don't need such imports.
We're working on fixing it in the autoscaler repository.

@village-way
Copy link
Contributor Author

Do you have a specific use-case for this?
Depending on what you want to do, in my opinion , it's easier to just install and deploy

I just want to start the kueue main.go process and debug the code in the goland, so want to run that in make run with flags or in the goland Run/Debug configurations

I'm not sure why we should have the vendor if we use Goland.

Every time GoLand is opened, it executes go list. However, this go list command fails, and it's unclear if this is the cause. Executing go mod vendor is just to allow GoLand to find dependencies without prompting that they can't be found.
image

That problem could be fixed by #1345.

Thank you very much, according to #1345 , this problem can be fixed and we don't need run go mod vendor, so why not add this lines to go.mod file ? @tenzen-y

replace (
	k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.3
	k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.28.3
	k8s.io/kubectl => k8s.io/kubectl v0.28.3
	k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.28.3
)

I don't think so since after #1345 is fixed, we don't need such imports. We're working on fixing it in the autoscaler repository.

I saw the PR you mentioned at kubernetes/autoscaler#6315. I'm not very familiar with the Go module dependencies, but I roughly understand that the issue arises because the clusterAutoscale is trying to reuse the code from Schedule without it being a separate Go module. However, I'm still quite confused about this area. Could you please help explain why this problem occurred? I'm looking forward to your reply. ♥

@alculquicondor
Copy link
Contributor

@tenzen-y do you think we are close to merging the split of cluster-autoscaler packages?
If it's taking too long, maybe it's worth introducing the replace for now?

@tenzen-y
Copy link
Member

tenzen-y commented Mar 11, 2024

do you think we are close to merging the split of cluster-autoscaler packages?
If it's taking too long, maybe it's worth introducing the replace for now?

All tasks have already been done. I'm waiting for approval from @x13n (for CA approval) and @mwielgus (for autoscaler repository approval). Both approvals are necessary.

@tenzen-y
Copy link
Member

do you think we are close to merging the split of cluster-autoscaler packages?
If it's taking too long, maybe it's worth introducing the replace for now?

All tasks have already been done. I'm waiting for approval from @x13n (for CA approval) and @mwielgus (for autoscaler repository approval). Both approvals are necessary.

Or only approval from @mwielgus should be fine since @x13n already approved that PR.

@tenzen-y
Copy link
Member

Do you have a specific use-case for this?
Depending on what you want to do, in my opinion , it's easier to just install and deploy

I just want to start the kueue main.go process and debug the code in the goland, so want to run that in make run with flags or in the goland Run/Debug configurations

I'm not sure why we should have the vendor if we use Goland.

Every time GoLand is opened, it executes go list. However, this go list command fails, and it's unclear if this is the cause. Executing go mod vendor is just to allow GoLand to find dependencies without prompting that they can't be found.
image

That problem could be fixed by #1345.

Thank you very much, according to #1345 , this problem can be fixed and we don't need run go mod vendor, so why not add this lines to go.mod file ? @tenzen-y

replace (
	k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.3
	k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.28.3
	k8s.io/kubectl => k8s.io/kubectl v0.28.3
	k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.28.3
)

I don't think so since after #1345 is fixed, we don't need such imports. We're working on fixing it in the autoscaler repository.

I saw the PR you mentioned at kubernetes/autoscaler#6315. I'm not very familiar with the Go module dependencies, but I roughly understand that the issue arises because the clusterAutoscale is trying to reuse the code from Schedule without it being a separate Go module. However, I'm still quite confused about this area. Could you please help explain why this problem occurred? I'm looking forward to your reply. ♥

k/k repository is not assumed to be used as a go module. This issue might be helpful for you to understand reasons: kubernetes/kubernetes#79384

@village-way
Copy link
Contributor Author

Do you have a specific use-case for this?
Depending on what you want to do, in my opinion , it's easier to just install and deploy

I just want to start the kueue main.go process and debug the code in the goland, so want to run that in make run with flags or in the goland Run/Debug configurations

I'm not sure why we should have the vendor if we use Goland.

Every time GoLand is opened, it executes go list. However, this go list command fails, and it's unclear if this is the cause. Executing go mod vendor is just to allow GoLand to find dependencies without prompting that they can't be found.
image

That problem could be fixed by #1345.

Thank you very much, according to #1345 , this problem can be fixed and we don't need run go mod vendor, so why not add this lines to go.mod file ? @tenzen-y

replace (
	k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.3
	k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.28.3
	k8s.io/kubectl => k8s.io/kubectl v0.28.3
	k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.28.3
)

I don't think so since after #1345 is fixed, we don't need such imports. We're working on fixing it in the autoscaler repository.

I saw the PR you mentioned at kubernetes/autoscaler#6315. I'm not very familiar with the Go module dependencies, but I roughly understand that the issue arises because the clusterAutoscale is trying to reuse the code from Schedule without it being a separate Go module. However, I'm still quite confused about this area. Could you please help explain why this problem occurred? I'm looking forward to your reply. ♥

k/k repository is not assumed to be used as a go module. This issue might be helpful for you to understand reasons: kubernetes/kubernetes#79384

thanks, this pr can be closed as the related issue solved.

@tenzen-y
Copy link
Member

In favor of #1872
/close

@k8s-ci-robot
Copy link
Contributor

@tenzen-y: Closed this PR.

In response to this:

In favor of #1872
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants