Reputation: 677
I'm brand new to Go and trying to inspect a method argument. I've got the following code
func (c *controller) OrderNew(ctx echo.Context) error {
When I try either:
fmt.println(ctx)
fmt.Printf("%v \n", ctx)
I get
&{0xc4200f21e0 0xc4202302d0 /order [] [] map[] 0x4092860 map[site_key:2] 0xc4200bb6c0}
I realize *controller is a pointer and the values returned contain addresses, but not sure how to really debug or inspect further. I also see functions called on cxt like
ctx.Get and ctx.Render
which I realize are functions in echo.Context
Any help/clarification is appreciated. Thanks!
Upvotes: 4
Views: 7435
Reputation: 821
https://echo.labstack.com/guide/context is an excellent source for looking into echo.
offline there is godoc
functionality, which helps with understanding any package(which is downloaded in your machine). In your case this can be done, godoc github.com/labstack/echo Context
on your command line.
There are GOTO functionalities many editors that lets you see the library source, while you are coding, https://github.com/fatih/vim-go, https://github.com/DisposaBoy/GoSublime are such examples. What they allow you to do is to navigate these functions and structs to the point where they are defined. Hopefully, someone will have written, a crisp documentary comment there.
if all you want is to watch the execution of your code, you can use debugging tools, like delve https://github.com/derekparker/delve.
Upvotes: 0