Repository navigation
Refactoring the S2I command line interface - #760
Conversation
|
[test] |
|
@openshift/devex ptal |
| @@ -0,0 +1 @@ | |||
| package cmd | |||
There was a problem hiding this comment.
this must be a hideous golang requirement? (can't have empty directories that just contain sub-packages?)
There was a problem hiding this comment.
correct :(
Basically gives a "no files to compile error", I believe there is one or two in origin also
| var glog = utilglog.StderrLog | ||
|
|
||
| // NewCmdCLI implements the S2I command line functionality. | ||
| func NewCmdCLI(cfg *api.Config) *cobra.Command { |
There was a problem hiding this comment.
what's the point of this arg? seems like we only pass nil when we call NewCmdCLI....
| basename := filepath.Base(os.Args[0]) | ||
| command := cli.CommandFor(basename) | ||
| if err := command.Execute(); err != nil { | ||
| os.Exit(1) |
There was a problem hiding this comment.
shouldn't we dump this error before exiting?
|
|
||
| // NewCmdCLI implements the S2I command line functionality. | ||
| func NewCmdCLI() *cobra.Command { | ||
| rand.Seed(time.Now().UnixNano()) |
There was a problem hiding this comment.
can be removed - already done in main()
| // Make case-insensitive and strip executable suffix if present | ||
| if runtime.GOOS == "windows" { | ||
| basename = strings.ToLower(basename) | ||
| basename = strings.TrimSuffix(basename, ".exe") |
There was a problem hiding this comment.
afaics all this code does nothing as basename is not read after write?
|
Evaluated for source to image test up to 95ebbab |
|
Source To Image Test Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_s2i/550/) (Base Commit: 1077640) (PR Branch Commit: 95ebbab) |
|
@bparees @jim-minter updates made, ptal |
|
lgtm, will let @jim-minter have the final word. |
|
|
||
| func main() { | ||
| rand.Seed(time.Now().UTC().UnixNano()) | ||
| if len(os.Getenv("GOMAXPROCS")) == 0 { |
There was a problem hiding this comment.
I don't believe this is necessary - is there a specific reason for adding it out of interest?
There was a problem hiding this comment.
looks like it was cargo-culted from origin:
https://github.com/openshift/origin/blob/master/cmd/openshift/openshift.go#L30
i think it's a harmless (if probably unnecessary) optimization
There was a problem hiding this comment.
@jim-minter indeed since Go 1.5 (release notes):
By default, Go programs run with GOMAXPROCS set to the number of cores available; in prior releases it defaulted to 1.
This effectively does nothing, and, as Ben suggests, it must come as inheritance from the early v3 days ;)
|
nice refactor! lgtm - question about GOMAXPROCS is curiosity on my part |
|
[merge] |
|
Source To Image Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_s2i/550/) (Base Commit: 1077640) (PR Branch Commit: 95ebbab) |
|
Evaluated for source to image merge up to 95ebbab |
|
@jim-minter Thanks! |
Refactoring the S2I cli to fall in line with the openshift client code organization
Closes #443