GoPLS Viewer

Home|gopls/cmd/stringer/testdata/gap.go
1// Copyright 2014 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// Gaps and an offset.
6
7package main
8
9import "fmt"
10
11type Gap int
12
13const (
14    Two    Gap = 2
15    Three  Gap = 3
16    Five   Gap = 5
17    Six    Gap = 6
18    Seven  Gap = 7
19    Eight  Gap = 8
20    Nine   Gap = 9
21    Eleven Gap = 11
22)
23
24func main() {
25    ck(0"Gap(0)")
26    ck(1"Gap(1)")
27    ck(Two"Two")
28    ck(Three"Three")
29    ck(4"Gap(4)")
30    ck(Five"Five")
31    ck(Six"Six")
32    ck(Seven"Seven")
33    ck(Eight"Eight")
34    ck(Nine"Nine")
35    ck(10"Gap(10)")
36    ck(Eleven"Eleven")
37    ck(12"Gap(12)")
38}
39
40func ck(gap Gapstr string) {
41    if fmt.Sprint(gap) != str {
42        panic("gap.go: " + str)
43    }
44}
45
MembersX
Five
Seven
ck.gap
Six
Eight
Nine
Eleven
Gap
Two
Three
Members
X