github.com/powerman/golang-tools@v0.1.11-0.20220410185822-5ad214d8d803/internal/lsp/testdata/folding/a.go (about)

     1  package folding //@fold("package")
     2  
     3  import (
     4  	"fmt"
     5  	_ "log"
     6  )
     7  
     8  import _ "os"
     9  
    10  // bar is a function.
    11  // With a multiline doc comment.
    12  func bar() string {
    13  	/* This is a single line comment */
    14  	switch {
    15  	case true:
    16  		if true {
    17  			fmt.Println("true")
    18  		} else {
    19  			fmt.Println("false")
    20  		}
    21  	case false:
    22  		fmt.Println("false")
    23  	default:
    24  		fmt.Println("default")
    25  	}
    26  	/* This is a multiline
    27  	block
    28  	comment */
    29  
    30  	/* This is a multiline
    31  	block
    32  	comment */
    33  	// Followed by another comment.
    34  	_ = []int{
    35  		1,
    36  		2,
    37  		3,
    38  	}
    39  	_ = [2]string{"d",
    40  		"e",
    41  	}
    42  	_ = map[string]int{
    43  		"a": 1,
    44  		"b": 2,
    45  		"c": 3,
    46  	}
    47  	type T struct {
    48  		f string
    49  		g int
    50  		h string
    51  	}
    52  	_ = T{
    53  		f: "j",
    54  		g: 4,
    55  		h: "i",
    56  	}
    57  	x, y := make(chan bool), make(chan bool)
    58  	select {
    59  	case val := <-x:
    60  		if val {
    61  			fmt.Println("true from x")
    62  		} else {
    63  			fmt.Println("false from x")
    64  		}
    65  	case <-y:
    66  		fmt.Println("y")
    67  	default:
    68  		fmt.Println("default")
    69  	}
    70  	// This is a multiline comment
    71  	// that is not a doc comment.
    72  	return `
    73  this string
    74  is not indented`
    75  }