Skip to content

Commit

Permalink
nicer switch statement layout
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach committed Jan 27, 2025
1 parent d7349f7 commit 1162d86
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions go/vt/schemadiff/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,16 @@ func (a *TextualAnnotations) Removed() (r []*AnnotatedText) {
func (a *TextualAnnotations) Export() string {
textLines := make([]string, 0, len(a.texts))
for _, annotatedText := range a.texts {
switch annotatedText.typ {
case AddedTextualAnnotationType:
switch {
case annotatedText.typ == AddedTextualAnnotationType:
annotatedText.text = "+" + annotatedText.text
case RemovedTextualAnnotationType:
case annotatedText.typ == RemovedTextualAnnotationType:
annotatedText.text = "-" + annotatedText.text
case a.hasAnyChanges:
// This text is unchanged, but indented to align with changes
annotatedText.text = " " + annotatedText.text
default:
// text unchanged
if a.hasAnyChanges {
// If there is absolutely no change, we don't add a space anywhere
annotatedText.text = " " + annotatedText.text
}
// If there is absolutely no change, we don't add a space anywhere
}
textLines = append(textLines, annotatedText.text)
}
Expand Down

0 comments on commit 1162d86

Please sign in to comment.