Source file src/cmd/go/internal/doc/testdata/pkg_test.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package pkg
     6  
     7  import "fmt"
     8  
     9  // Package example.
    10  func Example() {
    11  	fmt.Println("Package example output")
    12  	// Output: Package example output
    13  }
    14  
    15  // Function example.
    16  func ExampleExportedFunc() {
    17  	fmt.Println("Function example output")
    18  	// Output: Function example output
    19  }
    20  
    21  // Function example two.
    22  func ExampleExportedFunc_two() {
    23  	fmt.Println("Function example two output")
    24  	// Output: Function example two output
    25  }
    26  
    27  // Type example.
    28  func ExampleExportedType() {
    29  	fmt.Println("Type example output")
    30  	// Output: Type example output
    31  }
    32  
    33  // Method example.
    34  func ExampleExportedType_ExportedMethod() {
    35  	fmt.Println("Method example output")
    36  	// Output: Method example output
    37  }
    38  
    39  // Multiline example.
    40  func Example_multiline() {
    41  	fmt.Println("Multiline\nexample\noutput")
    42  	// Output:
    43  	// Multiline
    44  	// example
    45  	// output
    46  }
    47  
    48  

View as plain text