Golang go/token.File.AddLine function example

package go/token

AddLine adds the line offset for a new line. The line offset must be larger than the offset for the previous line and smaller than the file size; otherwise the line offset is ignored.

Golang go/token.File.AddLine function usage example

 file := b.fset.AddFile("<builtin>", -1, 1000)
 base := file.Base()
 ...
 off := base + i
 file.AddLine(off)

References :

https://gowalker.org/github.com/cznic/tmp/run/runc?f=build.go

http://golang.org/pkg/go/token/#File.AddLine

Advertisement