mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: don't let #cgo directives mess up line numbering
Fixes #5272. R=golang-dev, r CC=golang-dev https://golang.org/cl/13498046
This commit is contained in:
parent
0ba7ffe289
commit
f68c23e2bb
4 changed files with 41 additions and 0 deletions
|
|
@ -76,6 +76,8 @@ func (f *File) DiscardCgoDirectives() {
|
|||
l := strings.TrimSpace(line)
|
||||
if len(l) < 5 || l[:4] != "#cgo" || !unicode.IsSpace(rune(l[4])) {
|
||||
linesOut = append(linesOut, line)
|
||||
} else {
|
||||
linesOut = append(linesOut, "")
|
||||
}
|
||||
}
|
||||
f.Preamble = strings.Join(linesOut, "\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue