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
+6.3k Javascript : Generate random key with specific length
+27.6k PHP : Convert(cast) string to bigInt
+20.9k PHP : Convert(cast) int to double/float
+11.6k SSL : The certificate is not trusted because no issuer chain was provided
+5.7k Golang : ROT32768 (rotate by 0x80) UTF-8 strings example
+14.4k Golang : Recombine chunked files example
+19k Golang : Padding data for encryption and un-padding data for decryption
+9.3k Golang : Temperatures conversion example
+6k Golang : Convert Chinese UTF8 characters to Pin Yin
+17k Golang : Get input from keyboard
+17.7k Golang : Read data from config file and assign to variables
+16.9k Golang : Read integer from file into array