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

Remove sub go.mod from cmd #424

Merged
merged 2 commits into from
Dec 4, 2019

Conversation

ferhatelmas
Copy link
Contributor

remove cmd/* gomod since they don't bring the benefits they were supposed to bring.

context of how it was realized: #422 (comment)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 4, 2019
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 4, 2019
@ahmetb
Copy link
Member

ahmetb commented Dec 4, 2019

Actually it helps us split dependencies between krew and these tools. It’s not the worst idea to keep these.

@corneliusweig
Copy link
Contributor

Interesting. Our linter doesn't find this issue when the go.{mod,sum} files in the submodule are present.

I think the biggest reason for removing the submodule is that we don't need to bother about keeping the krew version in sync with the main module there. However, we could also achieve that with a replace directive in go.mod.

On the other hand, it's nice that we can add dependencies to the submodules without poisoning the main krew module.


Overall, I'm slightly in favor of keeping the status quo. Just because it improves the separation of krew and its associated utils. But I'm open for other improvements which reduce the maintenance overhead.

@ahmetb
Copy link
Member

ahmetb commented Dec 4, 2019

Technically, the go.mod at the root should be requiring more pkgs now that the child go.mod's are deleted. But I don't see that happening, weird.

I feel like within travis it might be editing go.mod (during go mod download, or go test ./...). I wish we could easily globally set -mod=readonly, so we don't add new deps on the fly.

@ahmetb
Copy link
Member

ahmetb commented Dec 4, 2019

I guess indeed these two tools don't really add new deps to Krew.
So let's go ahead with this.

@ferhatelmas
Copy link
Contributor Author

ferhatelmas commented Dec 4, 2019

Our linter doesn't find this issue when the go.{mod,sum} files in the submodule are present.

Following is from go modules wiki:

go test ./... from the repository root will no longer test everything in the repository

Similarly, go/analysis (underlying package leveraged by golangci-lint) stops too when ./... is used or target is left out.

we could also achieve that with a replace directive in go.mod.

Still, for a release, it needs a version bump.

I guess indeed these two tools don't really add new deps to Krew.

Exactly.

So let's go ahead with this.

Sounds good, I will check what is failing.

@ahmetb
Copy link
Member

ahmetb commented Dec 4, 2019

cmd/generate-plugin-overview/generate-plugin-overview.go:111:2: ifElseChain: rewrite if-else to switch statement (gocritic)
	if matches := githubRepoPattern.FindStringSubmatch(homepage); matches != nil {
	^

stuff like these are intrusive. if we can disable these sometime, I really appreciate. It does the same for simple slice allocations without count specified, there's like no point.

@ferhatelmas
Copy link
Contributor Author

if we can disable these sometime, I really appreciate. It does the same for simple slice allocations without count specified, there's like no point.

Ok, I will make a separate pass for it.

@codecov-io
Copy link

codecov-io commented Dec 4, 2019

Codecov Report

Merging #424 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #424   +/-   ##
=======================================
  Coverage   56.41%   56.41%           
=======================================
  Files          19       19           
  Lines         927      927           
=======================================
  Hits          523      523           
  Misses        349      349           
  Partials       55       55

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab1c7f7...57b0880. Read the comment docs.

@ahmetb
Copy link
Member

ahmetb commented Dec 4, 2019

/lgtm
/approve

can you please make sure krew-index CI still works in terms of fetching these tools?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmetb, ferhatelmas

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

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 4, 2019
@corneliusweig
Copy link
Contributor

we could also achieve that with a replace directive in go.mod.

Still, for a release, it needs a version bump.

Mental note: need to understand this better.

@k8s-ci-robot k8s-ci-robot merged commit a31442b into kubernetes-sigs:master Dec 4, 2019
@ahmetb
Copy link
Member

ahmetb commented Dec 4, 2019

Also I think the replace directives are meant to be checked in only if they are used to "strictly pin" to a strict commit of a dependency.

Stuff like replace sigs.k8s.io => ../.. should not be checked in if the module is being go-get'ed (like these cmd/* tools).

@ferhatelmas
Copy link
Contributor Author

ferhatelmas commented Dec 4, 2019

can you please make sure krew-index CI still works in terms of fetching these tools?

@ahmetb Looks good.

@ferhatelmas ferhatelmas deleted the rm-sub-gomod branch December 4, 2019 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants