golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/codeaction/extract-variadic-63287.txt (about)

     1  This test exercises extract on a variadic function.
     2  It is a regression test for bug #63287 in which
     3  the final paramater's "..." would go missing.
     4  
     5  -- go.mod --
     6  module example.com
     7  go 1.18
     8  
     9  -- a/a.go --
    10  package a
    11  
    12  //@codeactionedit(block, "refactor.extract", out, "Extract function")
    13  
    14  func _() {
    15  	var logf func(string, ...any)
    16  	{ println(logf) } //@loc(block, re`{.*}`)
    17  }
    18  
    19  -- @out/a/a.go --
    20  @@ -7 +7 @@
    21  -	{ println(logf) } //@loc(block, re`{.*}`)
    22  +	{ newFunction(logf) } //@loc(block, re`{.*}`)
    23  @@ -10 +10,4 @@
    24  +func newFunction(logf func( string,  ...any)) {
    25  +	println(logf)
    26  +}
    27  +
    28  -- end --