1 /*
2 A real block comment that mentions the import form must not be scanned as one.
3 4 The dependency scanner walked every line looking for a line that is exactly
5 `import (` and then took the first quoted string on the lines that followed,
6 with no notion of comments. Inside a line comment that cannot happen, because
7 every line begins with `//`. Inside a real block comment it can, and the scanner
8 then adds a package that exists only in prose to the import list:
9 10 import (
11 "example.com/not/a/real/package"
12 )
13 14 The prose block's closing delimiter is spelled out in words here, because a
15 literal one would end this comment: the scan also kept consuming the rest of the
16 file looking for a line that is exactly a closing paren.
17 extractImports now delegates to scanFileRegions, which classifies each line's
18 CODE and tracks block-comment state, so one comment-aware scanner replaces two
19 that could drift.
20 */
21 package main
22 23 import (
24 "time"
25 )
26 27 func main() {
28 // Termination: a batch program must still be stoppable, so the entry
29 // handles the channel the runtime closes on SIGINT/SIGTERM.
30 select {
31 case <-shutdown:
32 return
33 default:
34 }
35 36 if time.UTC() == nil {
37 panic("no UTC")
38 }
39 }
40