internal/span: remove check for nil content
We should instead treat nil content as an empty file.
Change-Id: I45f1d1c9f3382d2ef7f6d9769c808fd871d603e3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/252122
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/internal/span/utf16.go b/internal/span/utf16.go
index 561b3fa..f06a246 100644
--- a/internal/span/utf16.go
+++ b/internal/span/utf16.go
@@ -15,9 +15,6 @@
// This is used to convert from the native (always in bytes) column
// representation and the utf16 counts used by some editors.
func ToUTF16Column(p Point, content []byte) (int, error) {
- if content == nil {
- return -1, fmt.Errorf("ToUTF16Column: missing content")
- }
if !p.HasPosition() {
return -1, fmt.Errorf("ToUTF16Column: point is missing position")
}
diff --git a/internal/span/utf16_test.go b/internal/span/utf16_test.go
index 0ae2749..1eae797 100644
--- a/internal/span/utf16_test.go
+++ b/internal/span/utf16_test.go
@@ -29,7 +29,7 @@
{
scenario: "cursor missing content",
input: nil,
- err: "ToUTF16Column: missing content",
+ err: "ToUTF16Column: point is missing position",
},
{
scenario: "cursor missing position",