golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/suggestedfix/missingfunction.txt (about)

     1  This test checks the quick fix for undefined functions.
     2  
     3  -- channels.go --
     4  package missingfunction
     5  
     6  func channels(s string) {
     7  	undefinedChannels(c()) //@suggestedfix("undefinedChannels", re"(undeclared|undefined)", channels)
     8  }
     9  
    10  func c() (<-chan string, chan string) {
    11  	return make(<-chan string), make(chan string)
    12  }
    13  -- @channels/channels.go --
    14  @@ -7 +7,4 @@
    15  +func undefinedChannels(ch1 <-chan string, ch2 chan string) {
    16  +	panic("unimplemented")
    17  +}
    18  +
    19  -- consecutive.go --
    20  package missingfunction
    21  
    22  func consecutiveParams() {
    23  	var s string
    24  	undefinedConsecutiveParams(s, s) //@suggestedfix("undefinedConsecutiveParams", re"(undeclared|undefined)", consecutive)
    25  }
    26  -- @consecutive/consecutive.go --
    27  @@ -7 +7,4 @@
    28  +
    29  +func undefinedConsecutiveParams(s1, s2 string) {
    30  +	panic("unimplemented")
    31  +}
    32  -- error.go --
    33  package missingfunction
    34  
    35  func errorParam() {
    36  	var err error
    37  	undefinedErrorParam(err) //@suggestedfix("undefinedErrorParam", re"(undeclared|undefined)", error)
    38  }
    39  -- @error/error.go --
    40  @@ -7 +7,4 @@
    41  +
    42  +func undefinedErrorParam(err error) {
    43  +	panic("unimplemented")
    44  +}
    45  -- literals.go --
    46  package missingfunction
    47  
    48  type T struct{}
    49  
    50  func literals() {
    51  	undefinedLiterals("hey compiler", T{}, &T{}) //@suggestedfix("undefinedLiterals", re"(undeclared|undefined)", literals)
    52  }
    53  -- @literals/literals.go --
    54  @@ -8 +8,4 @@
    55  +
    56  +func undefinedLiterals(s string, t1 T, t2 *T) {
    57  +	panic("unimplemented")
    58  +}
    59  -- operation.go --
    60  package missingfunction
    61  
    62  import "time"
    63  
    64  func operation() {
    65  	undefinedOperation(10 * time.Second) //@suggestedfix("undefinedOperation", re"(undeclared|undefined)", operation)
    66  }
    67  -- @operation/operation.go --
    68  @@ -8 +8,4 @@
    69  +
    70  +func undefinedOperation(duration time.Duration) {
    71  +	panic("unimplemented")
    72  +}
    73  -- selector.go --
    74  package missingfunction
    75  
    76  func selector() {
    77  	m := map[int]bool{}
    78  	undefinedSelector(m[1]) //@suggestedfix("undefinedSelector", re"(undeclared|undefined)", selector)
    79  }
    80  -- @selector/selector.go --
    81  @@ -7 +7,4 @@
    82  +
    83  +func undefinedSelector(b bool) {
    84  +	panic("unimplemented")
    85  +}
    86  -- slice.go --
    87  package missingfunction
    88  
    89  func slice() {
    90  	undefinedSlice([]int{1, 2}) //@suggestedfix("undefinedSlice", re"(undeclared|undefined)", slice)
    91  }
    92  -- @slice/slice.go --
    93  @@ -6 +6,4 @@
    94  +
    95  +func undefinedSlice(i []int) {
    96  +	panic("unimplemented")
    97  +}
    98  -- tuple.go --
    99  package missingfunction
   100  
   101  func tuple() {
   102  	undefinedTuple(b()) //@suggestedfix("undefinedTuple", re"(undeclared|undefined)", tuple)
   103  }
   104  
   105  func b() (string, error) {
   106  	return "", nil
   107  }
   108  -- @tuple/tuple.go --
   109  @@ -7 +7,4 @@
   110  +func undefinedTuple(s string, err error) {
   111  +	panic("unimplemented")
   112  +}
   113  +
   114  -- unique_params.go --
   115  package missingfunction
   116  
   117  func uniqueArguments() {
   118  	var s string
   119  	var i int
   120  	undefinedUniqueArguments(s, i, s) //@suggestedfix("undefinedUniqueArguments", re"(undeclared|undefined)", unique)
   121  }
   122  -- @unique/unique_params.go --
   123  @@ -8 +8,4 @@
   124  +
   125  +func undefinedUniqueArguments(s1 string, i int, s2 string) {
   126  +	panic("unimplemented")
   127  +}