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
+7.1k Golang : Gorrila mux.Vars() function example
+38.1k Golang : Read a text file and replace certain words
+29.3k Golang : Save map/struct to JSON or XML file
+12.6k Golang : Drop cookie to visitor's browser and http.SetCookie() example
+10.2k Golang : Use regular expression to get all upper case or lower case characters example
+9.4k Golang : How to protect your source code from client, hosting company or hacker?
+17.4k Golang : Get future or past hours, minutes or seconds
+6.3k WARNING: UNPROTECTED PRIVATE KEY FILE! error message
+15.8k Golang : How to login and logout with JWT example
+27.4k Golang : Convert CSV data to JSON format and save to file
+17.9k Golang : How to make a file read only and set it to writable again?
+4.7k Fix Google Analytics Redundant Hostnames problem