-
Notifications
You must be signed in to change notification settings - Fork 553
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
mc: Inherit global flags for initialization messages. #2189
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2189 +/- ##
=========================================
- Coverage 9.12% 9.12% -0.01%
=========================================
Files 93 93
Lines 6902 6906 +4
=========================================
Hits 630 630
- Misses 6142 6146 +4
Partials 130 130
Continue to review full report at Codecov.
|
cmd/main.go
Outdated
@@ -174,14 +175,31 @@ func getSystemData() map[string]string { | |||
} | |||
} | |||
|
|||
type initMessage struct { |
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.
Can you add a comment here?
cmd/main.go
Outdated
} | ||
|
||
func (m initMessage) String() string { | ||
return m.Message |
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.
Missing some colors here (it was green)
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.
Some minors changes, LGTM otherwise.
Fixed all the comments @vadmeste |
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 & tested
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.
krishna@escape:~$ mc --no-color --quiet --json --config-folder=/tmp/cfg config host list
{"status":"success","msg":"Configuration written to `/tmp/cfg/config.json`. Please update your access credentials."}
{"status":"success","msg":"Successfully created `/tmp/cfg/share`."}
{"status":"success","msg":"Initialized share uploads `/tmp/cfg/share/uploads.json` file."}
{"status":"success","msg":"Initialized share downloads `/tmp/cfg/share/downloads.json` file."}
{"status":"success","alias":"gcs :","URL":"https://storage.googleapis.com","accessKey":"YOUR-ACCESS-KEY-HERE","secretKey":"YOUR-SECRET-KEY-HERE","api":"S3v2"}
{"status":"success","alias":"local:","URL":"http://localhost:9000"}
{"status":"success","alias":"play :","URL":"https://play.minio.io:9000","accessKey":"Q3AM3UQ867SPQQA43P2F","secretKey":"zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG","api":"S3v4"}
{"status":"success","alias":"s3 :","URL":"https://s3.amazonaws.com","accessKey":"YOUR-ACCESS-KEY-HERE","secretKey":"YOUR-SECRET-KEY-HERE","api":"S3v4"}
krishna@escape:~$
With this output, since we don't have a type field it will be tough for the parsers to know if it is an init message or a config-list message. Better not to intermix messages of different types? If we want to intermix then the message should contain a type field for the parsers to differentiate.
Json is free from those problems if the relevant fields don't exist they just are nil. So it is not a big deal this is just for consistency. Ideally this case is never hit and it is usually never parsed in this manner. |
I see it is better if we don't print init related messages when json is activated. It doesn't seem that someone will need that. Besides as @krishnasrinivas said, it intermixes json structure. |
Made the change check again @vadmeste @krishnasrinivas - please! |
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 and tested
Fixes #2089