I want to debug a go code. I want to put breakpoint on a method (belonging to a named type) in a imported package. I went through a lot of online materials where they only put breakpoints on a line number in file (eg:breakpoint a.go:15
).
I have done a lot of debugging in 'C' where I put breakpoints on functions. Is this kind of debugging possible in go??
I have the following code in my main package.
clientContext := sdk.Context(fabsdk.WithUser("Admin"), fabsdk.WithOrg("ordererorg"))
.
I want to put breakpoints to
1) function WithUser()
which belongs to package fabsdk
in file github.com/hyperledger/fabric-sdk-go/pkg/fabsdk/context.go
.
2) method Context()
belonging to type FabricSDK
in file github.com/hyperledger/fabric-sdk-go/pkg/fabsdk/fabsdk.go
in package fabsdk
.
Is it possible to put breakpoints to method WithUser()
and context()
or Isbreakpoints only allowed at a line number in a file?? I could use either gdb or delve or any other debugger as well.