diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2019-12-03 17:16:13 +0000 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2019-12-03 17:16:13 +0000 |
commit | bf2456f380a7d21677d0c0cf116cc2cbb37bcc14 (patch) | |
tree | 1052f50ad2951feeee268f5df8fc5f0cfe894ae6 | |
parent | 30d510fc62ed7aec90820835926a784744c51d7f (diff) |
temp switch back to exported colstream
-rw-r--r-- | coords.go | 10 | ||||
-rw-r--r-- | coords_test.go | 8 |
2 files changed, 9 insertions, 9 deletions
@@ -16,22 +16,22 @@ const ( // ColAlpha returns an alpha representation of a column index. // index is an integer - ColAlpha(0) returns "A", etc. func ColIndexToAlpha(index int) (string, error) { - max := len(colstream) - 1 + max := len(Colstream) - 1 if index <= max { - return colstream[index], nil + return Colstream[index], nil } else { msg := fmt.Sprintf("cannot have more than %d columns", max) return "", errors.New(msg) } } -var colstream = cols(maxAlphabets) +var Colstream = cols(maxAlphabets) // ColLettersToIndex converts an alpha column // reference to a zero-based numeric column identifier. func ColAlphaToIndex(letters string) (int, error) { - max := len(colstream) - 1 - for i, v := range colstream { + max := len(Colstream) - 1 + for i, v := range Colstream { if i > max { msg := fmt.Sprintf("Cannot exceed maximum of %d", max) return 0, errors.New(msg) diff --git a/coords_test.go b/coords_test.go index 8f8f865..8244a85 100644 --- a/coords_test.go +++ b/coords_test.go @@ -5,12 +5,12 @@ import ( ) func TestAlphaStream(t *testing.T) { - if colstream[26] != "AA" { - t.Errorf("The test expected AA, got %v.", colstream[26]) + if Colstream[26] != "AA" { + t.Errorf("The test expected AA, got %v.", Colstream[26]) } - if len(colstream) > maxCols { + if len(Colstream) > maxCols { t.Errorf(`Number of columns in alphastream exceeds Excel maximum. - alphastream contains %d, maxCols is %d`, len(colstream), maxCols) + alphastream contains %d, maxCols is %d`, len(Colstream), maxCols) } } |