...

Source file src/cmd/vet/testdata/composite/composite.go

Documentation: cmd/vet/testdata/composite

     1  // Copyright 2012 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  // This file contains the test for untagged struct literals.
     6  
     7  package composite
     8  
     9  import "flag"
    10  
    11  // Testing is awkward because we need to reference things from a separate package
    12  // to trigger the warnings.
    13  
    14  var goodStructLiteral = flag.Flag{
    15  	Name:  "Name",
    16  	Usage: "Usage",
    17  }
    18  
    19  var badStructLiteral = flag.Flag{ // ERROR "unkeyed fields"
    20  	"Name",
    21  	"Usage",
    22  	nil, // Value
    23  	"DefValue",
    24  }
    25  

View as plain text