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
+13k Golang : Get terminal width and height example
+6k Golang : How to verify input is rune?
+19.2k Golang : Delete item from slice based on index/key position
+11.1k Golang : Roll the dice example
+14.2k Golang : Fix image: unknown format error
+5.1k Linux : How to set root password in Linux Mint
+17.8k Golang : Iterate linked list example
+6.5k Golang : Map within a map example
+9.2k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+6.9k Golang : Pat multiplexer routing example
+43.5k Golang : Get hardware information such as disk, memory and CPU usage
+11.1k Golang : Simple image viewer with Go-GTK