github.com/v2fly/tools@v0.100.0/internal/lsp/analysis/fillstruct/testdata/src/a/a.go (about)

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package fillstruct
     6  
     7  import (
     8  	data "b"
     9  	"go/ast"
    10  	"go/token"
    11  )
    12  
    13  type emptyStruct struct{}
    14  
    15  var _ = emptyStruct{}
    16  
    17  type basicStruct struct {
    18  	foo int
    19  }
    20  
    21  var _ = basicStruct{} // want ""
    22  
    23  type twoArgStruct struct {
    24  	foo int
    25  	bar string
    26  }
    27  
    28  var _ = twoArgStruct{} // want ""
    29  
    30  var _ = twoArgStruct{ // want ""
    31  	bar: "bar",
    32  }
    33  
    34  type nestedStruct struct {
    35  	bar   string
    36  	basic basicStruct
    37  }
    38  
    39  var _ = nestedStruct{} // want ""
    40  
    41  var _ = data.B{} // want ""
    42  
    43  type typedStruct struct {
    44  	m  map[string]int
    45  	s  []int
    46  	c  chan int
    47  	c1 <-chan int
    48  	a  [2]string
    49  }
    50  
    51  var _ = typedStruct{} // want ""
    52  
    53  type funStruct struct {
    54  	fn func(i int) int
    55  }
    56  
    57  var _ = funStruct{} // want ""
    58  
    59  type funStructCompex struct {
    60  	fn func(i int, s string) (string, int)
    61  }
    62  
    63  var _ = funStructCompex{} // want ""
    64  
    65  type funStructEmpty struct {
    66  	fn func()
    67  }
    68  
    69  var _ = funStructEmpty{} // want ""
    70  
    71  type Foo struct {
    72  	A int
    73  }
    74  
    75  type Bar struct {
    76  	X *Foo
    77  	Y *Foo
    78  }
    79  
    80  var _ = Bar{} // want ""
    81  
    82  type importedStruct struct {
    83  	m  map[*ast.CompositeLit]ast.Field
    84  	s  []ast.BadExpr
    85  	a  [3]token.Token
    86  	c  chan ast.EmptyStmt
    87  	fn func(ast_decl ast.DeclStmt) ast.Ellipsis
    88  	st ast.CompositeLit
    89  }
    90  
    91  var _ = importedStruct{} // want ""
    92  
    93  type pointerBuiltinStruct struct {
    94  	b *bool
    95  	s *string
    96  	i *int
    97  }
    98  
    99  var _ = pointerBuiltinStruct{} // want ""
   100  
   101  var _ = []ast.BasicLit{
   102  	{}, // want ""
   103  }
   104  
   105  var _ = []ast.BasicLit{{}, // want ""
   106  }