1<!doctype html>
2<html lang="en">
3<head>
4<meta charset="utf-8">
5<meta name="viewport" content="width=device-width, initial-scale=1">
6<meta name="color-scheme" content="light dark">
7<title>main.go · files · example.test</title>
8<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff">
9<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#0c0c0c">
10<meta name="apple-mobile-web-app-title" content="ermite">
11<link rel="icon" type="image/svg+xml" href="/-/static/img/icon.HASH.svg">
12<link rel="apple-touch-icon" href="/-/static/app/apple-touch-icon.HASH.png">
13<link rel="manifest" href="/-/static/app/manifest.HASH.webmanifest">
14<link rel="preload" href="/-/static/fonts/atkinson-next.HASH.woff2" as="font" type="font/woff2" crossorigin>
15<link rel="stylesheet" href="/-/static/css/ermite.HASH.css">
16<meta name="htmx-config" content='{"history":false,"includeIndicatorCSS":false,"extensions":"sse, hx-live"}'>
17<script src="/-/static/js/htmx.min.HASH.js" defer>
18</script>
19<script src="/-/static/js/hx-live.min.HASH.js" defer>
20</script>
21<script src="/-/static/js/hx-sse.min.HASH.js" defer>
22</script>
23<script src="/-/static/js/store.HASH.js" defer>
24</script>
25<script src="/-/static/js/ermite.HASH.js" defer>
26</script>
27<script src="/-/static/js/files.HASH.js" defer>
28</script>
29<script src="/-/static/js/passkey.HASH.js" defer>
30</script>
31<script src="/-/static/js/log.HASH.js" defer>
32</script>
33</head>
34<body data-ref="main" data-sha="SHA40" data-sel="" data-nav="" data-paths="/files/paths/SHA40" data-blob="/files/blob/main">
35<a class="skip" href="#main">skip to content</a>
36<header class="hdr">
37<div class="hdr-top">
38<a class="brand" href="/" data-g="h" aria-label="home" title="home (g h)">
39<span class="brand-mark" aria-hidden="true">
40</span>
41</a>
42<nav class="crumbs" aria-label="Path">
43<ol>
44<li>
45<a href="/files">files</a>
46</li>
47<li>
48<a href="/files/tree/main">blob</a>
49</li>
50<li>
51<a href="/files/tree/main">main</a>
52</li>
53<li>
54<a href="/files/blob/main/main.go" aria-current="page">main.go</a>
55</li>
56</ol>
57</nav>
58<div class="hdr-acts">
59<a class="btn ref" href="/files/refs" data-fire="refs" aria-keyshortcuts="b" title="switch branch or tag (b)">
60<span class="ico i-branch" aria-hidden="true">
61</span>
62<span class="ref-name">main</span>
63<span class="sha">SHA7</span>
64</a>
65<button type="button" class="btn search" data-js aria-haspopup="dialog" aria-controls="panel-cmd" aria-keyshortcuts="Control+K :" title="go to a section, ref, file or repo (ctrl k or :)" data-fire="cmd">
66<span class="ico i-search" aria-hidden="true">
67</span>
68<span class="search-label">Go to…</span>
69<kbd aria-hidden="true">ctrl k</kbd>
70</button>
71</div>
72</div>
73<nav class="tabs" aria-label="Sections">
74<ul>
75<li>
76<a href="/files" data-key="s" aria-keyshortcuts="s">Summary <kbd aria-hidden="true">s</kbd>
77</a>
78</li>
79<li>
80<a href="/files/tree/main" data-key="t" aria-keyshortcuts="t" aria-current="page">Files <kbd aria-hidden="true">t</kbd>
81</a>
82</li>
83<li>
84<a href="/files/commits/main" data-key="c" aria-keyshortcuts="c">Commits <kbd aria-hidden="true">c</kbd>
85</a>
86</li>
87<li>
88<a href="/files/refs" data-key="r" aria-keyshortcuts="r">Branches & tags <kbd aria-hidden="true">r</kbd>
89</a>
90</li>
91<li>
92<a href="/files/merge-requests" data-key="m" aria-keyshortcuts="m">Merge requests <kbd aria-hidden="true">m</kbd>
93</a>
94</li>
95<li>
96<a href="/files/actions" data-key="a" aria-keyshortcuts="a">Actions <kbd aria-hidden="true">a</kbd>
97</a>
98</li>
99</ul>
100</nav>
101</header>
102<div class="work has-rail">
103<main id="main" tabindex="-1">
104<h1 class="file-h">
105<span>main.go</span>
106<span class="acts">
107<a class="btn" href="/files/raw/main/main.go">Raw</a>
108<a class="btn" href="/files/commits/main/main.go">History</a>
109<a class="btn" href="/files/tree/main">Folder</a>
110</span>
111</h1>
112<pre class="chroma code" data-anchor="" hx-on:click="let a = event.target.closest('a.ln'); if (!a) return; event.preventDefault();
113 let n = +a.textContent; if (!event.shiftKey || !data.anchor) data.anchor = n;
114 let lo = Math.min(+data.anchor, n), hi = Math.max(+data.anchor, n);
115 history.replaceState(null, '', '#L' + lo + (hi > lo ? '-L' + hi : '')); trigger('sel')" hx-on:sel="let m = location.hash.match(/^#L(\d+)(?:-L(\d+))?$/); let lo = m ? +m[1] : 0, hi = m ? +(m[2] || m[1]) : 0;
116 q('.line in this').arr().forEach(l => { let k = +l.id.slice(1); l.classList.toggle('sel', k >= lo && k <= hi) });
117 document.body.dataset.sel = lo ? 'L' + lo + (hi > lo ? '-L' + hi + ' · ' + (hi - lo + 1) + ' lines' : '') : '';
118 if (lo && event.detail?.scroll) document.getElementById('L' + lo)?.scrollIntoView({ block: 'center' })" hx-live="if (!data.ready) { data.ready = '1'; trigger('sel', { scroll: true }) }" data-ready="">
119<code hx-ignore>
120<span class="line" id="L1">
121<a class="ln" href="#L1">1</a>
122<span class="kn">package</span>
123<span class="w">
124</span>
125<span class="nx">main</span>
126</span>
127<span class="line" id="L2">
128<a class="ln" href="#L2">2</a>
129</span>
130<span class="line" id="L3">
131<a class="ln" href="#L3">3</a>
132<span class="kn">import</span>
133<span class="w">
134</span>
135<span class="s">"fmt"</span>
136</span>
137<span class="line" id="L4">
138<a class="ln" href="#L4">4</a>
139</span>
140<span class="line" id="L5">
141<a class="ln" href="#L5">5</a>
142<span class="c1">// main prints.</span>
143</span>
144<span class="line" id="L6">
145<a class="ln" href="#L6">6</a>
146<span class="kd">func</span>
147<span class="w">
148</span>
149<span class="nf">main</span>
150<span class="p">()</span>
151<span class="w">
152</span>
153<span class="p">{</span>
154</span>
155<span class="line" id="L7">
156<a class="ln" href="#L7">7</a>
157<span class="w">
158</span>
159<span class="nx">fmt</span>
160<span class="p">.</span>
161<span class="nf">Println</span>
162<span class="p">(</span>
163<span class="s">"hi <b>"</span>
164<span class="p">,</span>
165<span class="w">
166</span>
167<span class="mi">42</span>
168<span class="p">)</span>
169</span>
170<span class="line" id="L8">
171<a class="ln" href="#L8">8</a>
172<span class="p">}</span>
173</span>
174</code>
175</pre>
176</main>
177<aside class="rail" aria-label="Context">
178<section aria-labelledby="r-file">
179<h2 id="r-file">File</h2>
180<dl class="kv">
181<dt>size</dt>
182<dd>87 B</dd>
183<dt>lines</dt>
184<dd>8</dd>
185<dt>type</dt>
186<dd>Go</dd>
187</dl>
188</section>
189<section aria-labelledby="r-last">
190<h2 id="r-last">Last change <a href="/files/commits/main/main.go">History</a>
191</h2>
192<p>
193<a href="/files/commit/SHA40">SHA7</a> add main.go</p>
194<p class="dim">T · <time datetime="STAMP" title="STAMP">AGO</time>
195</p>
196</section>
197<section aria-labelledby="r-sel">
198<h2 id="r-sel">Selection</h2>
199<p :text="document.body.dataset.sel || 'none · click a line number, shift-click extends'">none · click a line number, shift-click extends</p>
200<p class="dim">y copies a permalink pinned to the commit sha</p>
201</section>
202</aside>
203</div>
204<footer class="foot">
205<span>ermite devel</span>
206<a href="http://example.test/ermite" rel="noopener" title="source of this version (AGPL-3.0-or-later)">source</a>
207<button type="button" class="foot-keys" data-js data-fire="help" aria-haspopup="dialog" aria-controls="panel-help" aria-keyshortcuts="?">
208<kbd aria-hidden="true">?</kbd> keyboard shortcuts</button>
209</footer>
210<div class="hint" role="status" aria-live="polite">
211<span class="hint-nav" :text="document.body.dataset.nav || ''">
212</span>
213<span class="hint-sel" :text="document.body.dataset.sel ? document.body.dataset.sel + ' · y permalink' : ''">
214</span>
215<span class="hint-flash" :text="document.body.dataset.flash || ''">
216</span>
217</div>
218<dialog id="panel-help" class="panel modal" aria-label="Keyboard shortcuts" hx-on:keydown="event.key === 'Escape' && (event.preventDefault(), this.close())" hx-on:click="event.target === this && this.close()">
219<div class="panel-head">
220<h2>Keyboard shortcuts</h2>
221<button type="button" class="panel-x" aria-label="Close" hx-on:click="closest('dialog').close()">
222<kbd>esc</kbd> close</button>
223</div>
224<div class="keys-pref">
225<label>
226<input type="checkbox" id="keys-off" aria-describedby="keys-note" hx-on:change="ermite.setKeysOff(this.checked)"> Turn off single-key shortcuts</label>
227<p id="keys-note" class="dim">Single-key shortcuts are on. ctrl k and esc work whatever this says.</p>
228</div>
229<dl class="keys">
230<div>
231<dt>
232<kbd>ctrl k</kbd>
233<kbd>:</kbd>
234</dt>
235<dd>go to a section, branch, tag, file or repository</dd>
236</div>
237<div>
238<dt>
239<kbd>?</kbd>
240</dt>
241<dd>this list</dd>
242</div>
243<div>
244<dt>
245<kbd>j</kbd>
246<kbd>k</kbd>
247</dt>
248<dd>move the row cursor down / up</dd>
249</div>
250<div>
251<dt>
252<kbd>enter</kbd>
253</dt>
254<dd>open the row under the cursor; on Files, a directory opens or closes in place</dd>
255</div>
256<div>
257<dt>
258<kbd>↑</kbd>
259<kbd>↓</kbd>
260<kbd>←</kbd>
261<kbd>→</kbd>
262<kbd>home</kbd>
263<kbd>end</kbd>
264</dt>
265<dd>in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file</dd>
266</div>
267<div>
268<dt>
269<kbd>l</kbd>
270<kbd>h</kbd>
271</dt>
272<dd>on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls</dd>
273</div>
274<div>
275<dt>
276<kbd>g g</kbd>
277<kbd>G</kbd>
278</dt>
279<dd>first / last row</dd>
280</div>
281<div>
282<dt>
283<kbd>/</kbd>
284</dt>
285<dd>filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)</dd>
286</div>
287<div>
288<dt>
289<kbd>b</kbd>
290</dt>
291<dd>switch branch or tag</dd>
292</div>
293<div>
294<dt>
295<kbd>s</kbd>
296<kbd>t</kbd>
297<kbd>c</kbd>
298<kbd>r</kbd>
299<kbd>m</kbd>
300</dt>
301<dd>tabs: summary, files, commits, branches & tags, merge requests</dd>
302</div>
303<div>
304<dt>
305<kbd>g h</kbd>
306</dt>
307<dd>home</dd>
308</div>
309<div>
310<dt>
311<kbd>y</kbd>
312</dt>
313<dd>copy a permalink pinned to the commit</dd>
314</div>
315<div>
316<dt>
317<kbd>d</kbd>
318<kbd>u</kbd>
319<kbd>x</kbd>
320</dt>
321<dd>diff: split / unified / collapse or expand all</dd>
322</div>
323<div>
324<dt>
325<kbd>e</kbd>
326<kbd>E</kbd>
327</dt>
328<dd>diff: the whole file in view / every file, with the lines the hunks hide</dd>
329</div>
330<div>
331<dt>
332<kbd>n</kbd>
333</dt>
334<dd>merge request: next note in the diff</dd>
335</div>
336<div>
337<dt>
338<kbd>esc</kbd>
339</dt>
340<dd>close a dialog, leave a field</dd>
341</div>
342</dl>
343</dialog>
344<dialog id="panel-refs" class="panel modal" aria-label="Switch ref" hx-on:keydown="event.key === 'Escape' && (event.preventDefault(), this.close())" hx-on:click="event.target === this && this.close()">
345<div class="panel-head">
346<label for="refs-filter" class="sr">filter branches and tags</label>
347<input id="refs-filter" type="search" placeholder="Switch branch or tag…" autocomplete="off" data-pick="#panel-refs li" hx-on:input="ermite.filter(this)">
348<button type="button" class="panel-x" aria-label="Close" hx-on:click="closest('dialog').close()">
349<kbd>esc</kbd>
350</button>
351</div>
352<div class="panel-cols" data-picklist>
353<section aria-label="Branches">
354<h2>Branches <span class="count">2</span>
355</h2>
356<ul>
357<li>
358<a href="/files/tree/feature/x">
359<span class="mark" aria-hidden="true"> </span>feature/x</a>
360</li>
361<li>
362<a href="/files/tree/main" aria-current="true">
363<span class="mark" aria-hidden="true">●</span>main</a>
364</li>
365</ul>
366</section>
367<section aria-label="Tags">
368<h2>Tags <span class="count">1</span>
369</h2>
370<ul>
371<li>
372<a href="/files/tree/v1.0">
373<span class="mark" aria-hidden="true"> </span>v1.0</a>
374</li>
375</ul>
376</section>
377</div>
378</dialog>
379<dialog id="panel-cmd" class="panel modal" aria-label="Go to" hx-on:close="ermiteFinder.paletteClose()" hx-on:keydown="event.key === 'Escape' && (event.preventDefault(), this.close())" hx-on:click="event.target === this && this.close()">
380<div class="panel-head">
381<label for="cmd-q" class="sr">go to</label>
382<input id="cmd-q" type="search" placeholder="Go to a section, branch, tag, file or repository…" autocomplete="off" spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" aria-controls="cmd-list" aria-activedescendant="cmd-o0" hx-on:input="ermite.cmdFilter(this); ermiteFinder.palette(this)" hx-on:keydown="ermite.cmdKey(event)">
383<button type="button" class="panel-x" aria-label="Close" hx-on:click="closest('dialog').close()">
384<kbd>esc</kbd>
385</button>
386</div>
387<ul id="cmd-list" class="cmd-list" role="listbox" aria-label="Targets">
388<li id="cmd-o0" role="option" aria-selected="true" data-k="go home" data-cursor>
389<a href="/" tabindex="-1">
390<span class="lbl">home</span>
391<span class="k">go</span>
392</a>
393</li>
394<li id="cmd-o1" role="option" aria-selected="false" data-k="section summary">
395<a href="/files" tabindex="-1">
396<span class="lbl">summary</span>
397<span class="k">section</span>
398</a>
399</li>
400<li id="cmd-o2" role="option" aria-selected="false" data-k="section files">
401<a href="/files/tree/main" tabindex="-1">
402<span class="lbl">files</span>
403<span class="k">section</span>
404</a>
405</li>
406<li id="cmd-o3" role="option" aria-selected="false" data-k="section commits">
407<a href="/files/commits/main" tabindex="-1">
408<span class="lbl">commits</span>
409<span class="k">section</span>
410</a>
411</li>
412<li id="cmd-o4" role="option" aria-selected="false" data-k="section branches & tags">
413<a href="/files/refs" tabindex="-1">
414<span class="lbl">branches & tags</span>
415<span class="k">section</span>
416</a>
417</li>
418<li id="cmd-o5" role="option" aria-selected="false" data-k="section merge requests">
419<a href="/files/merge-requests" tabindex="-1">
420<span class="lbl">merge requests</span>
421<span class="k">section</span>
422</a>
423</li>
424<li id="cmd-o6" role="option" aria-selected="false" data-k="section actions">
425<a href="/files/actions" tabindex="-1">
426<span class="lbl">actions</span>
427<span class="k">section</span>
428</a>
429</li>
430<li id="cmd-o7" role="option" aria-selected="false" data-k="branch feature/x">
431<a href="/files/tree/feature/x" tabindex="-1">
432<span class="lbl">feature/x</span>
433<span class="k">branch</span>
434</a>
435</li>
436<li id="cmd-o8" role="option" aria-selected="false" data-k="branch main">
437<a href="/files/tree/main" tabindex="-1">
438<span class="lbl">main</span>
439<span class="k">branch</span>
440</a>
441</li>
442<li id="cmd-o9" role="option" aria-selected="false" data-k="tag v1.0">
443<a href="/files/tree/v1.0" tabindex="-1">
444<span class="lbl">v1.0</span>
445<span class="k">tag</span>
446</a>
447</li>
448<li id="cmd-o10" role="option" aria-selected="false" data-k="action turn single-key shortcuts on off keyboard">
449<a href="#" data-fire="keys" tabindex="-1">
450<span class="lbl">turn single-key shortcuts off</span>
451<span class="k">action</span>
452</a>
453</li>
454</ul>
455<p class="panel-foot">
456<span>
457<kbd>↑</kbd>
458<kbd>↓</kbd> move</span>
459<span>
460<kbd>enter</kbd> open</span>
461<span>
462<kbd>esc</kbd> close</span>
463</p>
464</dialog>
465<div id="keys" hidden hx-on="k-j from:body -> ermite.move(1);
466 k-k from:body -> ermite.move(-1);
467 k-top from:body -> ermite.edge(false);
468 k-bottom from:body -> ermite.edge(true);
469 k-open from:body -> ermite.open();
470 k-right from:body -> ermite.rail(true);
471 k-left from:body -> ermite.rail(false);
472 k-esc from:body -> ermite.closeDialogs();
473 k-help from:body -> ermite.dialog('panel-help');
474 k-refs from:body -> ermite.dialog('panel-refs', 'refs-filter');
475 k-cmd from:body -> ermite.dialog('panel-cmd', 'cmd-q'); ermiteFinder.load();
476 k-filter from:body -> ermite.focusFilter();
477 k-gh from:body -> ermite.go('.brand');
478 k-s from:body -> ermite.tab('s');
479 k-t from:body -> ermite.tab('t');
480 k-c from:body -> ermite.tab('c');
481 k-r from:body -> ermite.tab('r');
482 k-m from:body -> ermite.tab('m');
483 k-next from:body -> ermite.nextNote();
484 k-split from:body -> ermite.layout('split');
485 k-unified from:body -> ermite.layout('unified');
486 k-collapse from:body -> ermite.collapse();
487 k-expand from:body -> ermite.expandFile();
488 k-expandAll from:body -> ermite.expandAll();
489 k-permalink from:body -> ermite.permalink();
490 k-merge from:body -> window.ermiteMR?.openMerge();
491 k-read from:body -> window.ermiteMR?.markRead();
492 k-gf from:body -> window.ermiteMR?.focusFiles();
493 k-keys from:body -> ermite.toggleKeys()">
494</div>
495</body>
496</html>