Black Lives Matter. Support the Equal Justice Initiative.

Source file src/go/doc/testdata/d2.go

Documentation: go/doc/testdata

     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  // Test cases for sort order of declarations.
     6  
     7  package d
     8  
     9  // C1 should be second.
    10  const C1 = 1
    11  
    12  // C0 should be first.
    13  const C0 = 0
    14  
    15  // V1 should be second.
    16  var V1 uint
    17  
    18  // V0 should be first.
    19  var V0 uintptr
    20  
    21  // CAx constants should appear after CBx constants.
    22  const (
    23  	CA2 = iota // before CA1
    24  	CA1        // before CA0
    25  	CA0        // at end
    26  )
    27  
    28  // VAx variables should appear after VBx variables.
    29  var (
    30  	VA2 int // before VA1
    31  	VA1 int // before VA0
    32  	VA0 int // at end
    33  )
    34  
    35  // T1 should be second.
    36  type T1 struct{}
    37  
    38  // T0 should be first.
    39  type T0 struct{}
    40  
    41  // F1 should be second.
    42  func F1() {}
    43  
    44  // F0 should be first.
    45  func F0() {}
    46  

View as plain text