mirror of https://github.com/golang/go.git
Merge 9d90f935ac into 49cdf0c42e
This commit is contained in:
commit
5f44f202f4
|
|
@ -232,6 +232,9 @@ func playExample(file *ast.File, f *ast.FuncDecl) *ast.File {
|
|||
// We can't resolve dot imports (yet).
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
// Trim 'go-' prefix from package name (like done at runtime) to ensure match
|
||||
n = strings.TrimPrefix(n, "go-")
|
||||
}
|
||||
if unresolved[n] {
|
||||
// Copy the spec and its path to avoid modifying the original.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2022 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 foo_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/xxx/go-foo"
|
||||
)
|
||||
|
||||
func ExampleMyMethod() {
|
||||
fmt.Println(foo.MyMethod())
|
||||
// Output:
|
||||
// expected output
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
-- MyMethod.Play --
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/xxx/go-foo"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println(foo.MyMethod())
|
||||
}
|
||||
-- MyMethod.Output --
|
||||
expected output
|
||||
Loading…
Reference in New Issue