Golang go/token.File.MergeLine function examples

package go/token

LineCount returns the number of lines in file f.

Golang go/token.File.LineCount function usage examples

Example 1:

 // determine line count
 var lineCount int
 prog.Fset.Iterate(func(f *token.File) bool {
 lineCount += f.LineCount()
 return true
 })

Example 2:

 f.AddLine(offset)
 if f.LineCount() != i+1 {
 t.Errorf("%s, AddLine: got unchanged line count %d; want %d", f.Name(), f.LineCount(), i+1)
 }

Reference :

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

Advertisement