Golang go/token.FileSet.Position function example
package go/token
Position converts a Pos(1st parameter) in the fileset into a general Position.
Golang go/token.FileSet.Position function usage example
callExpr, ok := node.(*ast.CallExpr)
if !ok {
return true
}
...
pos := fset.Position(callExpr.Rparen) // <-- here
methodCall := &methodCall{
Line: pos.Line,
Names: []string{},
}
References :
https://github.com/revel/revel/blob/master/harness/reflect.go
Advertisement
Something interesting
Tutorials
+14.6k Golang : How to get URL port?
+10.1k Golang : Get login name from environment and prompt for password
+3.6k Java : Get FX sentiment from website example
+37.7k Golang : Comparing date or timestamp
+12.1k Golang : Sort and reverse sort a slice of runes
+5.8k Golang : List all packages and search for certain package
+41.4k Golang : Convert string to array/slice
+15.8k Golang : Get digits from integer before and after given position example
+11.1k Golang : How to determine a prime number?
+5.4k Golang *File points to a file or directory ?
+10.5k Golang : Generate 403 Forbidden to protect a page or prevent indexing by search engine