-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Util dir refactor #649
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
Util dir refactor #649
Conversation
5b3b4dd
to
e44cb2e
Compare
96addfd
to
37d640d
Compare
I would like to propose I like the move to internal for our internal utilities with specific packages for each! I have not gone through the PR in detail but I would like to 👍 the approach and make sure that enough people agree then do a more thorough review. |
Yeah
|
@hasbro17 if |
Note: this is failing because |
…onstants instead of hard-coded strings for dirs and filenames
15b5715
to
622339f
Compare
3c354e5
to
d2f13df
Compare
pkg/scaffold/cmd.go
Outdated
@@ -42,7 +44,7 @@ import ( | |||
"{{ .Repo }}/pkg/apis" | |||
"{{ .Repo }}/pkg/controller" | |||
|
|||
k8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" | |||
k8sutil "github.com/operator-framework/operator-sdk/pkg/k8s" |
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 think we can keep this as pkg/k8sutil
. That's more descriptive than pkg/k8s
imo.
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.
Especially give that we're aliasing it as k8sutil.
test/e2e/memcached_test.go
Outdated
// https://github.com/golang/dep/pull/1658 | ||
solveFailRe := regexp.MustCompile(`(?m)^[ \t]*Solving failure:.+github\.com/operator-framework/operator-sdk.+:$`) | ||
if solveFailRe.Match(cmdOut) { | ||
prSlug, ok := os.LookupEnv("TRAVIS_PULL_REQUEST_SLUG") |
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 don't think it's necessary to duplicate this code. Since this has to be run at some point anyway, I think we should just run the gopkg fix immediately after the new
command in all cases instead of later in the code. In that case, the regex check only contains a t.Fatal
and we don't have duplicate code.
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.
LGTM
fa77761
to
3edece9
Compare
…e exported commands/operator-sdk/cmd/*: use internal/util packages and get rid of command/.../cmdutil pkg/util/*: move all pkg utilities into pkg/util
06807f2
to
6e1be93
Compare
commands/.../add/*,new.go: update to 'internal/util' imports
Description of the change:
internal
dir, with autil
sub dir that will contain utility packages with specific designations, ex.internal/util/fileutil
will only contain functions, types, etc. that operate on files.commands/operator-sdk/cmd/cmdutil/util.go
pkg/util/file_util.go
tointernal/util/fileutil
pkg/tlsutil
topkg/tls
andpkg/util/k8sutil
topkg/k8sutil
Motivation for the change: General utility packages and files containing disparate data are best avoided, especially those exported such that users can access internal data. As per @shawn-hurley's concerns, the way the SDK handle's utility functions needs reassessment. This is an attempt at doing so, and is open to modification/being thrown out.