diff options
Diffstat (limited to 'bug')
-rw-r--r-- | bug/interface.go | 6 | ||||
-rw-r--r-- | bug/op_edit_comment.go | 9 |
2 files changed, 6 insertions, 9 deletions
diff --git a/bug/interface.go b/bug/interface.go index 796ee569..5c8f2729 100644 --- a/bug/interface.go +++ b/bug/interface.go @@ -46,11 +46,11 @@ type Interface interface { } func bugFromInterface(bug Interface) *Bug { - switch bug.(type) { + switch bug := bug.(type) { case *Bug: - return bug.(*Bug) + return bug case *WithSnapshot: - return bug.(*WithSnapshot).Bug + return bug.Bug default: panic("missing type case") } diff --git a/bug/op_edit_comment.go b/bug/op_edit_comment.go index a37ce8f7..48020421 100644 --- a/bug/op_edit_comment.go +++ b/bug/op_edit_comment.go @@ -59,14 +59,11 @@ func (op *EditCommentOperation) Apply(snapshot *Snapshot) { UnixTime: timestamp.Timestamp(op.UnixTime), } - switch target.(type) { + switch target := target.(type) { case *CreateTimelineItem: - item := target.(*CreateTimelineItem) - item.Append(comment) - + target.Append(comment) case *AddCommentTimelineItem: - item := target.(*AddCommentTimelineItem) - item.Append(comment) + target.Append(comment) } // Updating the corresponding comment |