-
Notifications
You must be signed in to change notification settings - Fork 950
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
bugfix: fix repeated strings reported by goconst #2454
bugfix: fix repeated strings reported by goconst #2454
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2454 +/- ##
=========================================
Coverage ? 68.87%
=========================================
Files ? 277
Lines ? 18296
Branches ? 0
=========================================
Hits ? 12602
Misses ? 4260
Partials ? 1434
|
7f03c69
to
ffb88e4
Compare
@@ -26,6 +26,12 @@ import ( | |||
"github.com/sirupsen/logrus" | |||
) | |||
|
|||
const ( | |||
unknownHostName = "<unknown>" |
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.
Is there is need to add three different const for "unknown", since they're all same ? Just looks weird
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.
Yeap, i have thought about this. Although their value are all same, they represent value of different system info field in unknown scene.
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 it depends on how the three value diverged, it's possible to be different in the future?
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.
It may be hard to confirm.
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.
Yep, I think it's ok here.
Maybe We can make verify step more accurate in desc, such as |
cri/metrics/metrics.go
Outdated
@@ -13,6 +13,23 @@ func init() { | |||
Register() | |||
} | |||
|
|||
// Action labels for different pod/image operations | |||
const ( |
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.
Thanks for your contribution. In fact, the pouch's HTTP server also needs to collect metrics. So could you please to do the samething for api/servers?
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.
Done.
2f569c5
to
882e19a
Compare
pkg/utils/metrics/actions.go
Outdated
|
||
// Action labels for different pod/container/image operations. | ||
const ( | ||
ActionCreate = "create" |
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.
How about changing all this const variables' naming to be XXXActionLabel?
I think this will be a little bit more readable.
daemon/mgr/spec_mount.go
Outdated
@@ -14,6 +14,21 @@ import ( | |||
"github.com/sirupsen/logrus" | |||
) | |||
|
|||
const ( | |||
// PropagationRPrivate represents mount propagation rprivate. | |||
PropagationRPrivate = "rprivate" |
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.
How about changing all this const variables' naming to be XXXXXPropagationMode?
I think this will be a little bit more readable.
882e19a
to
b16068f
Compare
@mathspanda How about you directly adding
Then no one needs to fix config.yml and goconst could serve all the following pull request. In addition, does the update satisfy you? @starnop |
Signed-off-by: mathspanda <mathspanda826@gmail.com>
Signed-off-by: mathspanda <mathspanda826@gmail.com>
b16068f
to
f6be76f
Compare
Done. |
That is so great to see this fixed in code and add a defender in circleCI. LGTM |
Signed-off-by: mathspanda mathspanda826@gmail.com
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
#2424
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
None
Ⅳ. Describe how to verify it
gometalinter --disable-all --skip vendor -E goconst ./...
Ⅴ. Special notes for reviews
None