composite.go 547 B

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