-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 single-package constants from constants package #5430
Conversation
Hi @u5surf. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: u5surf 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 |
Can one of the admins verify this patch? |
Travis tests have failedHey @u5surf, 1st Buildmake test
TravisBuddy Request Identifier: 04551b30-dcf7-11e9-9623-414a91c7634f |
43012df
to
5cb6344
Compare
Travis tests have failedHey @u5surf, 1st Buildmake test
TravisBuddy Request Identifier: 5b221d30-dd08-11e9-9623-414a91c7634f |
Travis tests have failedHey @u5surf, 1st Buildmake test
TravisBuddy Request Identifier: 5a9948b0-dd09-11e9-9623-414a91c7634f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is huge! Thank you for making this important code cleanup happen. I have historically cringed every time I've had to open up constants.go.
Just some minor requests and we are good to merge once you feel ready for it.
cmd/minikube/cmd/cache.go
Outdated
@@ -25,6 +25,8 @@ import ( | |||
"k8s.io/minikube/pkg/minikube/machine" | |||
) | |||
|
|||
const cache = "cache" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't figure out what this constant is. Can you give it a clearer name and a comment describing what it's there for?
Update: I see from later that it's used for config maps. What do you think about something like:
# cacheImageConfigKey is the config field name used to store which images we have previously cached
const cacheImageConfigKey = 'cache'
I'm not normally a fan of long variable names, but a good rule of thumb is: the further away a variable is defined from it's usage, the longer it should be, as more context is required. consts are the perfect place to use longer names for clarity.
cmd/minikube/cmd/root.go
Outdated
@@ -40,6 +40,8 @@ import ( | |||
"k8s.io/minikube/pkg/minikube/translate" | |||
) | |||
|
|||
const defaultClusterBootstrapper = "kubeadm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to define this as a const: just inline it into the line where it is used (RootCmd.PersistentFlags().StringP(...)
)
cmd/minikube/cmd/start.go
Outdated
@@ -85,6 +85,11 @@ const ( | |||
kvmQemuURI = "kvm-qemu-uri" | |||
kvmGPU = "kvm-gpu" | |||
kvmHidden = "kvm-hidden" | |||
minikubeEnvPrefix = "MINIKUBE" | |||
defaultEmbedCerts = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless they are used elsewhere, inline all default flag values directly to where the flag is defined.
Travis tests have failedHey @u5surf, 1st Buildmake test
TravisBuddy Request Identifier: 50900c90-de6d-11e9-8141-977217faf2ea |
75c2703
to
58417e7
Compare
Travis tests have failedHey @u5surf, 1st Buildmake test
TravisBuddy Request Identifier: 506ea410-de7c-11e9-ad93-37b42dc0d4f9 |
Travis tests have failedHey @u5surf, 1st Buildmake test
TravisBuddy Request Identifier: ce6d4790-de7c-11e9-ad93-37b42dc0d4f9 |
Travis tests have failedHey @u5surf, 1st Buildmake test
TravisBuddy Request Identifier: a90eb860-de8d-11e9-ad93-37b42dc0d4f9 |
@minikube-bot OK to test |
Travis tests have failedHey @u5surf, 1st Buildmake test
TravisBuddy Request Identifier: 2b1c5430-df2d-11e9-ad93-37b42dc0d4f9 |
@@ -332,7 +333,7 @@ var Addons = map[string]*Addon{ | |||
// AddMinikubeDirAssets adds all addons and files to the list | |||
// of files to be copied to the vm. | |||
func AddMinikubeDirAssets(assets *[]CopyableFile) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tstromberg
I had moved GuestXXX
constant, and change to read vmpath
package. But It is failed...
Is there somthing wrong?
ci-result
https://travis-ci.org/kubernetes/minikube/jobs/589224590
golangci/golangci-lint info installed out/linters/golangci-lint
pkg/minikube/assets/addons.go:334:14: GuestAddonsDir not declared by package constants (typecheck)
constants.GuestAddonsDir,
^
and
# k8s.io/minikube/pkg/minikube/assets [k8s.io/minikube/pkg/minikube/assets.test]
pkg/minikube/assets/addons.go:334: undefined: constants.GuestAddonsDir
pkg/minikube/assets/addons.go:340: undefined: constants.GuestAddonsDir
pkg/minikube/assets/addons.go:346: undefined: constants.GuestAddonsDir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I have misunderstood to have already rebased upstream..
Travis tests have failedHey @u5surf, 1st Buildmake test
TravisBuddy Request Identifier: 8ecaa6e0-dfae-11e9-8484-95807c18f235 |
Since this PR adds a file ,you will need to run Once that's done, let's merge this! |
Travis tests have failedHey @u5surf, 1st Buildmake test
2nd Buildmake test
TravisBuddy Request Identifier: d3f7be70-dfee-11e9-a161-570cf9dcad8d |
Hey @u5surf, TravisBuddy Request Identifier: 26aad3c0-dff2-11e9-a161-570cf9dcad8d |
Hey @u5surf, TravisBuddy Request Identifier: fb7943f0-dff9-11e9-a161-570cf9dcad8d |
Hey @u5surf, TravisBuddy Request Identifier: 2a54d5b0-e002-11e9-a161-570cf9dcad8d |
/ok-to-test |
Do you mind resolving the merge conflict? Once that's done lets merge it so that further conflicts don't occur. |
Codecov Report
@@ Coverage Diff @@
## master #5430 +/- ##
=======================================
Coverage 36.57% 36.57%
=======================================
Files 102 102
Lines 7320 7320
=======================================
Hits 2677 2677
Misses 4292 4292
Partials 351 351
|
This is probably the happiest I've been merging a PR. Thank you! |
Fixes #5375
I refactored to remove all single package using constant.