1
0
mirror of https://github.com/golang/go synced 2024-11-18 01:04:48 -07:00

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>
This commit is contained in:
Rebecca Stambler 2020-09-01 14:51:25 -04:00
parent cf97e2b30f
commit bf6e7d25bf
2 changed files with 1 additions and 4 deletions

View File

@ -15,9 +15,6 @@ import (
// 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")
}

View File

@ -29,7 +29,7 @@ var toUTF16Tests = []struct {
{
scenario: "cursor missing content",
input: nil,
err: "ToUTF16Column: missing content",
err: "ToUTF16Column: point is missing position",
},
{
scenario: "cursor missing position",