From 3475e91902deb917d8e3eb2d471dab3017bc3873 Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Mon, 16 Nov 2020 01:40:22 +0200 Subject: [PATCH 1/2] Readme: fix error handling --- gofrompython/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gofrompython/README.md b/gofrompython/README.md index ffc59d2..a117e60 100644 --- a/gofrompython/README.md +++ b/gofrompython/README.md @@ -44,7 +44,7 @@ that file has a `func main()` declared, that funciton will not be called. You can [view the source here](./src/dns/dnscmd/dnscmd.go), and below: -``` +```go package main import ( @@ -60,7 +60,7 @@ func main() { You can [view the source of the library here](./src/dns/dnslib/dnslib.go) and below. Note that the spacing of the `//export` is specific - there should be no space between the `//` and the `export` text: -``` +```go package dnslib import ( @@ -72,7 +72,7 @@ import ( func ReturnString(val string) *C.char { cname, err := net.LookupCNAME(val) if err != nil { - C.CString("Could not find CNAME") + return C.CString("Could not find CNAME") } return C.CString(cname) } From babf3e15f1f3dfee402a2da0924890e9913962f5 Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Mon, 16 Nov 2020 01:38:15 +0200 Subject: [PATCH 2/2] Fix error handling --- gofrompython/src/dns/dnslib/dnslib.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gofrompython/src/dns/dnslib/dnslib.go b/gofrompython/src/dns/dnslib/dnslib.go index 325d5b0..01c0a55 100644 --- a/gofrompython/src/dns/dnslib/dnslib.go +++ b/gofrompython/src/dns/dnslib/dnslib.go @@ -22,7 +22,7 @@ import ( func ReturnString(val string) *C.char { cname, err := net.LookupCNAME(val) if err != nil { - C.CString("Could not find CNAME") + return C.CString("Could not find CNAME") } return C.CString(cname) }