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

     1  // +build go1.18
     2  //go:build go1.18
     3  
     4  package snippets
     5  
     6  type SyncMap[K comparable, V any] struct{}
     7  
     8  func NewSyncMap[K comparable, V any]() (result *SyncMap[K, V]) { //@item(NewSyncMap, "NewSyncMap", "", "")
     9  	return
    10  }
    11  
    12  func Identity[P ~int](p P) P { //@item(Identity, "Identity", "", "")
    13  	return p
    14  }
    15  
    16  func _() {
    17  	_ = NewSyncM //@snippet(" //", NewSyncMap, "NewSyncMap[${1:}]()", "NewSyncMap[${1:K comparable}, ${2:V any}]()")
    18  	_ = Identi //@snippet(" //", Identity, "Identity[${1:}](${2:})", "Identity[${1:P ~int}](${2:p P})")
    19  }