Skip to content

Incorrect slice diff output #238

Closed
@dsnet

Description

@dsnet

Consider the following snippet:

got := "Forwarding service bread:foo-http-jean has a same-env shard undrained: aa:jean-shard000. The quick brown fox jumped over the lazy dog."
want := "Forwarding service bread:foo-api-scary has a same-env shard undrained: bb:scary-shard000. The quick brown fox jumped over the lazy dog."
fmt.Println(cmp.Diff(got, want))

Depending on the randomization involved, this sometimes prints:

  strings.Join({
  	"Fo",
- 	"rwar",
+ 	"rwar",
  	"ding service bread:foo-",
- 	"http-jean",
+ 	"api-scary",
  	" has a same-env shard undrained: ",
- 	"aa:jean",
+ 	"bb:scary",
  	"-shard000. The quick brown fox jumped over the lazy dog.",
  }, "")

when it should print:

  strings.Join({
  	"Forwarding service bread:foo-",
- 	"http-jean",
+ 	"api-scary",
  	" has a same-env shard undrained: ",
- 	"aa:jean",
+ 	"bb:scary",
  	"-shard000. The quick brown fox jumped over the lazy dog.",
  }, "")

Not that it incorrectly reports that "rwar" is different?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions