mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-12 09:10:21 +08:00
fcee603081
Previously if the only names defined by _test packages were examples, the gotest script would emit an incorrect _testmain.go file. I worked around that by marking the example_test.go files +build ignored. This CL changes the gotest script to handle this case correctly, and removes the now-unnecessary build tags. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/214039 From-SVN: r280085
23 lines
433 B
Go
23 lines
433 B
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package suffixarray_test
|
|
|
|
import (
|
|
"fmt"
|
|
"index/suffixarray"
|
|
)
|
|
|
|
func ExampleIndex_Lookup() {
|
|
index := suffixarray.New([]byte("banana"))
|
|
offsets := index.Lookup([]byte("ana"), -1)
|
|
for _, off := range offsets {
|
|
fmt.Println(off)
|
|
}
|
|
|
|
// Unordered output:
|
|
// 1
|
|
// 3
|
|
}
|