github.com/v2fly/tools@v0.100.0/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  	switch {
    14  	case true:
    15  		if true {
    16  			fmt.Println("true")
    17  		} else {
    18  			fmt.Println("false")
    19  		}
    20  	case false:
    21  		fmt.Println("false")
    22  	default:
    23  		fmt.Println("default")
    24  	}
    25  	_ = []int{
    26  		1,
    27  		2,
    28  		3,
    29  	}
    30  	_ = [2]string{"d",
    31  		"e",
    32  	}
    33  	_ = map[string]int{
    34  		"a": 1,
    35  		"b": 2,
    36  		"c": 3,
    37  	}
    38  	type T struct {
    39  		f string
    40  		g int
    41  		h string
    42  	}
    43  	_ = T{
    44  		f: "j",
    45  		g: 4,
    46  		h: "i",
    47  	}
    48  	x, y := make(chan bool), make(chan bool)
    49  	select {
    50  	case val := <-x:
    51  		if val {
    52  			fmt.Println("true from x")
    53  		} else {
    54  			fmt.Println("false from x")
    55  		}
    56  	case <-y:
    57  		fmt.Println("y")
    58  	default:
    59  		fmt.Println("default")
    60  	}
    61  	// This is a multiline comment
    62  	// that is not a doc comment.
    63  	return `
    64  this string
    65  is not indented`
    66  }