1 // Copyright 2018 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 alignment
6
7 // ----------------------------------------------------------------------------
8 // Examples from issue #7335.
9
10 func main() {
11 z := MyStruct{
12 Foo: "foo",
13 Bar: "bar",
14 Name: "name",
15 LongName: "longname",
16 Baz: "baz",
17 }
18 y := MyStruct{
19 Foo: "foo",
20 Bar: "bar",
21 NameXX: "name",
22 LongNameXXXXXXXXXXXXX: "longname",
23 Baz: "baz",
24 }
25 z := MyStruct{
26 Foo: "foo",
27 Bar: "bar",
28 Name: "name",
29 LongNameXXXXXXXXXXXXX: "longname",
30 Baz: "baz",
31 }
32 }
33
34 // ----------------------------------------------------------------------------
35 // Examples from issue #10392.
36
37 var kcfg = KubeletConfig{
38 Address: s.Address,
39 AllowPrivileged: s.AllowPrivileged,
40 HostNetworkSources: hostNetworkSources,
41 HostnameOverride: s.HostnameOverride,
42 RootDirectory: s.RootDirectory,
43 ConfigFile: s.Config,
44 ManifestURL: s.ManifestURL,
45 FileCheckFrequency: s.FileCheckFrequency,
46 HTTPCheckFrequency: s.HTTPCheckFrequency,
47 PodInfraContainerImage: s.PodInfraContainerImage,
48 SyncFrequency: s.SyncFrequency,
49 RegistryPullQPS: s.RegistryPullQPS,
50 RegistryBurst: s.RegistryBurst,
51 MinimumGCAge: s.MinimumGCAge,
52 MaxPerPodContainerCount: s.MaxPerPodContainerCount,
53 MaxContainerCount: s.MaxContainerCount,
54 ClusterDomain: s.ClusterDomain,
55 ClusterDNS: s.ClusterDNS,
56 Runonce: s.RunOnce,
57 Port: s.Port,
58 ReadOnlyPort: s.ReadOnlyPort,
59 CadvisorInterface: cadvisorInterface,
60 EnableServer: s.EnableServer,
61 EnableDebuggingHandlers: s.EnableDebuggingHandlers,
62 DockerClient: dockertools.ConnectToDockerOrDie(s.DockerEndpoint),
63 KubeClient: client,
64 MasterServiceNamespace: s.MasterServiceNamespace,
65 VolumePlugins: ProbeVolumePlugins(),
66 NetworkPlugins: ProbeNetworkPlugins(),
67 NetworkPluginName: s.NetworkPluginName,
68 StreamingConnectionIdleTimeout: s.StreamingConnectionIdleTimeout,
69 TLSOptions: tlsOptions,
70 ImageGCPolicy: imageGCPolicy,imageGCPolicy,
71 Cloud: cloud,
72 NodeStatusUpdateFrequency: s.NodeStatusUpdateFrequency,
73 }
74
75 var a = A{
76 Long: 1,
77 LongLong: 1,
78 LongLongLong: 1,
79 LongLongLongLong: 1,
80 LongLongLongLongLong: 1,
81 LongLongLongLongLongLong: 1,
82 LongLongLongLongLongLongLong: 1,
83 LongLongLongLongLongLongLongLong: 1,
84 Short: 1,
85 LongLongLongLongLongLongLongLongLong: 3,
86 }
87
88 // ----------------------------------------------------------------------------
89 // Examples from issue #22852.
90
91 var fmtMap = map[string]string{
92 "1": "123",
93 "12": "123",
94 "123": "123",
95 "1234": "123",
96 "12345": "123",
97 "123456": "123",
98 "12345678901234567890123456789": "123",
99 "abcde": "123",
100 "123456789012345678901234567890": "123",
101 "1234567": "123",
102 "abcdefghijklmnopqrstuvwxyzabcd": "123",
103 "abcd": "123",
104 }
105
106 type Fmt struct {
107 abcdefghijklmnopqrstuvwx string
108 abcdefghijklmnopqrstuvwxy string
109 abcdefghijklmnopqrstuvwxyz string
110 abcdefghijklmnopqrstuvwxyza string
111 abcdefghijklmnopqrstuvwxyzab string
112 abcdefghijklmnopqrstuvwxyzabc string
113 abcde string
114 abcdefghijklmnopqrstuvwxyzabcde string
115 abcdefg string
116 }
117
118 func main() {
119 _ := Fmt{
120 abcdefghijklmnopqrstuvwx: "foo",
121 abcdefghijklmnopqrstuvwxyza: "foo",
122 abcdefghijklmnopqrstuvwxyzab: "foo",
123 abcdefghijklmnopqrstuvwxyzabc: "foo",
124 abcde: "foo",
125 abcdefghijklmnopqrstuvwxyzabcde: "foo",
126 abcdefg: "foo",
127 abcdefghijklmnopqrstuvwxy: "foo",
128 abcdefghijklmnopqrstuvwxyz: "foo",
129 }
130 }
131
132 // ----------------------------------------------------------------------------
133 // Examples from issue #26352.
134
135 var _ = map[int]string{
136 1: "",
137
138 12345678901234567890123456789: "",
139 12345678901234567890123456789012345678: "",
140 }
141
142 func f() {
143 _ = map[int]string{
144 1: "",
145
146 12345678901234567: "",
147 12345678901234567890123456789012345678901: "",
148 }
149 }
150
151 // ----------------------------------------------------------------------------
152 // Examples from issue #26930.
153
154 var _ = S{
155 F1: []string{
156 },
157 F2____: []string{},
158 }
159
160 var _ = S{
161 F1: []string{
162
163
164 },
165 F2____: []string{},
166 }
167
168 var _ = S{
169 F1____: []string{
170 },
171 F2: []string{},
172 }
173
174 var _ = S{
175 F1____: []string{
176
177 },
178 F2: []string{},
179 }
180
View as plain text