-
Notifications
You must be signed in to change notification settings - Fork 80
print more info when created record collides with others #174
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
Conversation
@dominikbraun |
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 looks pretty good to me! Maybe we can format the record start time using the Formatter
? In that case, you would have to return the colliding record from collides
as a second return value and format its time using the t.Formatter()
Something like t.Formatter().PrettyDateString() + " " + t.Formatter().TimeString()
should work (you also may create a new method for this).
@dominikbraun
|
@RedemptionC For 1. and 2.: Yes, I think that makes sense. Regarding 3., a table output might be a good fit indeed - you're free to test and play around a bit and we'll see what you prefer. |
@dominikbraun
you could review it again at your convenience |
@dominikbraun |
Hi @RedemptionC, sorry for the delay - I've been busy the last days, but I'm going to review it later today! |
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.
Looks great, I like it! I just added a minor suggestion.
core/timetrace.go
Outdated
@@ -273,6 +275,37 @@ func (t *Timetrace) latestNonEmptyDir(dirs []string) (string, error) { | |||
return "", ErrAllDirectoriesEmpty | |||
} | |||
|
|||
func printCollides(t *Timetrace, records []*Record) { |
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.
We may call this function printCollisions
.
printCollides to printCollisions
@dominikbraun |
You're right, now that Thanks for working on this! |
@dominikbraun |
Hi @RedemptionC, thanks! The tests look pretty good. In fact, you should always be cautious with |
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.
Code looks good, I'm going to test everything locally and merge this PR if everything is ok.
Thanks for pointing this out to me func checkConsistent(t *testing.T, expect, result []*Record) {
sameLen := len(result) == len(expect)
sameContent := true
if sameLen {
for i := range result {
if expect[i] != result[i] {
sameContent = false
}
}
}
if !(sameLen && sameContent) {
t.Errorf("should collide with :\n")
for _, r := range expect {
t.Errorf("%v\n", r)
}
t.Errorf("while collides return :\n")
for _, r := range result {
t.Errorf("%v\n", r)
}
}
} |
This approach is fine as well! 👍 |
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 works fine, thanks for implementing this change!
@dominikbraun |
resolve #173
first PR in this repo
I simply changed/added some print statements
any feedback will be appreciated
now the output is