diff --git a/cue/load/read.go b/cue/load/read.go index 2861f91f0cf..7548f42b604 100644 --- a/cue/load/read.go +++ b/cue/load/read.go @@ -208,18 +208,6 @@ func (r *importReader) readImport(imports *[]string) { r.readString(imports) } -// readComments is like io.ReadAll, except that it only reads the leading -// block of comments in the file. -func readComments(f io.Reader) ([]byte, errors.Error) { - r := &importReader{b: bufio.NewReader(f)} - r.peekByte(true) - if r.err == nil && !r.eof { - // Didn't reach EOF, so must have found a non-space byte. Remove it. - r.buf = r.buf[:len(r.buf)-1] - } - return r.buf, r.err -} - // readImports is like io.ReadAll, except that it expects a CUE file as // input and stops reading the input once the imports have completed. func readImports(f io.Reader, reportSyntaxError bool, imports *[]string) ([]byte, errors.Error) { diff --git a/cue/load/read_test.go b/cue/load/read_test.go index 826ed1971d1..e7e7a73dc56 100644 --- a/cue/load/read_test.go +++ b/cue/load/read_test.go @@ -49,9 +49,9 @@ var readImportsTests = []readTest{ }, { `package p - + // comment - + import "x" import _ "x" import a "x" @@ -76,28 +76,6 @@ var readImportsTests = []readTest{ }, } -var readCommentsTests = []readTest{ - { - `ℙpackage p`, - "", - }, - { - `ℙpackage p; import "x"`, - "", - }, - { - `ℙpackage p; import . "x"`, - "", - }, - { - `// foo - - // asdf - ℙHello, world`, - "", - }, -} - func testRead(t *testing.T, tests []readTest, read func(io.Reader) ([]byte, errors.Error)) { for i, tt := range tests { var in, testOut string @@ -140,10 +118,6 @@ func TestReadImports(t *testing.T) { }) } -func TestReadComments(t *testing.T) { - testRead(t, readCommentsTests, readComments) -} - var readFailuresTests = []readTest{ { `package`,