Re: [go-nuts] What happens if the hash retrieved from sumdb and the one in go.sum file of the main module are different?

2019-09-11 Thread Ian Lance Taylor
The go tool reports a checksum mismatch error.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcX9%2BCBq50wBJ_aDUTQ_fuJE2dPEkZ9yJ7o4ANT9DQs-NA%40mail.gmail.com.


[go-nuts] How to Unmarshal diameter client different request to different struct at diamter server side

2019-09-11 Thread afriyie . abraham


Hi,


Am developing a diameter server using go-diameter package that need to 
perform EAP-AKA authentication. 

In the DER/DEA process, the client will be sending multiple request to the 
server,

that is first the client sends an identity request to the server, the 
server respond with

RAND, MAC, etc to the client, the client then sends second request to the 
server, in this case with

different parameters(RES, MAC, etc) to the server. 

The server need to handle the second request using the same handle if am 
right since in DER/DEA,

the server handle only DER. My question is how can i handle the second 
request coming from the client

using the same handle(DER) at the diameter server side. That using the same 
DER handle to response to

diameter client multiple request. Depending on the received message the 
server unmarshal the set of AVPs to the right structure.

 Is it possible, if possible any help. Currently i have at the server side 
this request handle


//First server response to cleint should containg this payload

func AKA_Challenge_Request(settings sm.Settings, w io.Writer, m 
*diam.Message) (n int64, err error) {

PayloadSlice := []byte(`RAND, AUTHN, MAC, RESULT_ID`)

m.NewAVP(avp.EAPPayload, avp.Mbit, 0, 
datatype.OctetString(PayloadSlice))

return m.WriteTo(w)

}


//Second server response to cleint should containg this payload

func AKA_Success_Notification(settings sm.Settings, w io.Writer, m 
*diam.Message) (n int64, err error) {

EAPSlice := []byte(`EAP_Success`)

MSKSlice := []byte(`EAP-Master-Session-Key`)

m.NewAVP(avp.EAPPayload, avp.Mbit, 0, datatype.OctetString(EAPSlice))

m.NewAVP(avp.EAPMasterSessionKey, avp.Mbit, 0, 
datatype.OctetString(MSKSlice))

return m.WriteTo(w)

}


// Handle funtion at the server side

func HandleDER(settings sm.Settings) diam.HandlerFunc {


// If received AVP messages are of this struct format, Unmarshal message to 
this structure

type HandleDERRequest struct {

SessionID datatype.UTF8String   `avp:"Session-Id"`

OriginHostdatatype.DiameterIdentity `avp:"Origin-Host"`

OriginRealm   datatype.DiameterIdentity `avp:"Origin-Realm"`

DestinationHost   datatype.DiameterIdentity `avp:"Destination-Host"`

DestinationRealm  datatype.DiameterIdentity 
`avp:"Destination-Realm"`

UserName  datatype.UTF8String   `avp:"User-Name"`

AuthSessionState  datatype.Enumerated   
`avp:"Auth-Session-State"`

AuthApplicationID datatype.Unsigned32   
`avp:"Auth-Application-Id"`

AuthRequestType   datatype.Enumerated   
`avp:"Auth-Request-Type"`

EAPPayloaddatatype.OctetString  `avp:"EAP-Payload"`

RATType   datatype.Enumerated   `avp:"RAT-Type"`

ANID  datatype.UTF8String   `avp:"ANID"`

}


// If received AVP messages are of this struct format, Unmarshal message to 
this structure

type HandleDERRequest struct {

SessionID datatype.UTF8String   `avp:"Session-Id"`

OriginHostdatatype.DiameterIdentity `avp:"Origin-Host"`

OriginRealm   datatype.DiameterIdentity `avp:"Origin-Realm"`

DestinationHost   datatype.DiameterIdentity `avp:"Destination-Host"`

DestinationRealm  datatype.DiameterIdentity 
`avp:"Destination-Realm"`

EAPPayloaddatatype.OctetString  `avp:"EAP-Payload"`

}


return func(c diam.Conn, m *diam.Message) {


var err error = nil

var req HandleDERRequest

var code uint32 = diam.Success


err = m.Unmarshal()

if err != nil {

err = fmt.Errorf("Unmarshal failed: %s", err)

code = diam.UnableToComply

log.Printf("Invalid DER(%d): %s\n", code, err.Error())

} else {

code = diam.Success

}

fmt.Println(string(req.EAPPayload))

a := m.Answer(code)

a.NewAVP(avp.SessionID, avp.Mbit, 0, req.SessionID)

a.NewAVP(avp.OriginHost, avp.Mbit, 0, req.DestinationHost)

a.NewAVP(avp.OriginRealm, avp.Mbit, 0, req.DestinationRealm)

a.NewAVP(avp.OriginStateID, avp.Mbit, 0, settings.OriginStateID)

  //Respond with first payload

_, err = AKA_Challenge_Request(settings, c, a)

if err != nil {

log.Printf("Failed to send AAA challenge request: %s", 
err.Error())

}

}

}


Any help?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/441a6c77-ec50-4a9c-833e-2e4bce1d0b79%40googlegroups.com.


[go-nuts] Marshaling structs to command line arguments

2019-09-11 Thread James Pettyjohn
Hi,

While not the most likely of scenarios, I'm having to write a lot of 
integration around existing command line tools and want a better way then 
passing strings/constants around.

While there are ample choices to go from command line arguments to structs 
etc, I'm not finding anything besides vanilla os/exec for command line 
construction.

Most encoding packagers go from a struct or the like and generate marshal 
the serialized item. Anyone seen this same thing but making an array of 
args consumable by exec?

- J

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6b1e926b-2f45-4b5f-bc50-a49da41ae74f%40googlegroups.com.


[go-nuts] What happens if the hash retrieved from sumdb and the one in go.sum file of the main module are different?

2019-09-11 Thread T L
.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/86617c09-5a81-4e5c-9c1d-2419c8382681%40googlegroups.com.


Re: [go-nuts] Re: x/mobile: Samples for reverse binding in gomobile

2019-09-11 Thread Elias Naur
On Wed Sep 11, 2019 at 7:20 AM Jay Sharma wrote:
> 
> 
> *Now, I want to create object of this class in go and want to call method 
> using that object from go. *
> 
> I was checking your proposal (https://github.com/golang/go/issues/16876) 
> but could not able to make it. :(

The proposal suggests calling the generated New method on the object.
Did you try that? If so, what went wrong?

-- elias

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BWXAZ4Z6L5WG.6AV43I4ZQQCC%40testmac.


[go-nuts] How to handle diamter client different request with one handle at diamter server side

2019-09-11 Thread afriyie . abraham
Hi,

Am developing a diameter server using go-diameter package that need to 
perform EAP-AKA authentication. 
In the DER/DEA process, the client will be sending multiple request to the 
server,
that is first the client sends an identity request to the server, the 
server respond with
RAND, MAC, etc to the client, the client then sends second request to the 
server, in this case with
different parameters(RES, MAC, etc) to the server. 
The server need to handle the second request using the same handle if am 
right since in DER/DEA,
the server handle only DER. My question is how can i handle the second 
request coming from the client
using the same handle(DER) at the diameter server side. That using the same 
DER handle to response to
diameter client multiple request. Is it possible, if possible any help. 
Currently i have at the server side this request handle

//First server response to cleint should containg this payload
func AKA_Challenge_Request(settings sm.Settings, w io.Writer, m 
*diam.Message) (n int64, err error) {
PayloadSlice := []byte(`RAND, AUTHN, MAC, RESULT_ID`)
m.NewAVP(avp.EAPPayload, avp.Mbit, 0, 
datatype.OctetString(PayloadSlice))
return m.WriteTo(w)
}

//Second server response to cleint should containg this payload
func AKA_Success_Notification(settings sm.Settings, w io.Writer, m 
*diam.Message) (n int64, err error) {
EAPSlice := []byte(`EAP_Success`)
MSKSlice := []byte(`EAP-Master-Session-Key`)
m.NewAVP(avp.EAPPayload, avp.Mbit, 0, datatype.OctetString(EAPSlice))
m.NewAVP(avp.EAPMasterSessionKey, avp.Mbit, 0, 
datatype.OctetString(MSKSlice))
return m.WriteTo(w)
}

// Handle funtion at the server side
func HandleDER(settings sm.Settings) diam.HandlerFunc {

type HandleDERRequest struct {
SessionID datatype.UTF8String   `avp:"Session-Id"`
OriginHostdatatype.DiameterIdentity `avp:"Origin-Host"`
OriginRealm   datatype.DiameterIdentity `avp:"Origin-Realm"`
DestinationHost   datatype.DiameterIdentity `avp:"Destination-Host"`
DestinationRealm  datatype.DiameterIdentity 
`avp:"Destination-Realm"`
UserName  datatype.UTF8String   `avp:"User-Name"`
AuthSessionState  datatype.Enumerated   
`avp:"Auth-Session-State"`
AuthApplicationID datatype.Unsigned32   
`avp:"Auth-Application-Id"`
AuthRequestType   datatype.Enumerated   
`avp:"Auth-Request-Type"`
EAPPayloaddatatype.OctetString  `avp:"EAP-Payload"`
RATType   datatype.Enumerated   `avp:"RAT-Type"`
ANID  datatype.UTF8String   `avp:"ANID"`
}
return func(c diam.Conn, m *diam.Message) {

var err error = nil
var req HandleDERRequest
var code uint32 = diam.Success

err = m.Unmarshal()
if err != nil {
err = fmt.Errorf("Unmarshal failed: %s", err)
code = diam.UnableToComply
log.Printf("Invalid DER(%d): %s\n", code, err.Error())
} else {
code = diam.Success
}
fmt.Println(string(req.EAPPayload))
a := m.Answer(code)
a.NewAVP(avp.SessionID, avp.Mbit, 0, req.SessionID)
a.NewAVP(avp.OriginHost, avp.Mbit, 0, req.DestinationHost)
a.NewAVP(avp.OriginRealm, avp.Mbit, 0, req.DestinationRealm)
a.NewAVP(avp.OriginStateID, avp.Mbit, 0, settings.OriginStateID)
  //Respond with first payload
_, err = AKA_Challenge_Request(settings, c, a)
if err != nil {
log.Printf("Failed to send AAA challenge request: %s", 
err.Error())
}
}
}

Any help?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e36ba859-85c9-4d03-aad4-2c7935d8a570%40googlegroups.com.


Re: [go-nuts] Re: x/mobile: Samples for reverse binding in gomobile

2019-09-11 Thread Jay Sharma
*Thank you very much Elias : with your suggestion it is working fine.*

Just last query:

Currently, I called *static method* of my java class: 

package reversebinding; 

public class RBinding { 
  public static String getStringFromJava() { 
  return "Hello from java !!"; 
 } 
 } 


*Now, I want to create object of this class in go and want to call method 
using that object from go. *

I was checking your proposal (https://github.com/golang/go/issues/16876) 
but could not able to make it. :(
Can you please help me , how to do that?

*Thanks*.


On Wednesday, September 11, 2019 at 4:36:20 PM UTC+5:30, Elias Naur wrote:
>
> On Wed Sep 11, 2019 at 3:51 AM Jay Sharma wrote: 
> > 
> > 
> > I have one doubt when we build using gomobile in that I am giving the 
> > classpath to my .class java file. 
> > *Will it be included in .aar or I have to include that .class file along 
> > with .aar in my android application. * 
> > 
>
> The class file is not automatically included, that wasn't clear from my 
> earlier 
> reply. Please include the class file in your project and try my suggestion 
> to 
> call your code from Java. 
>
> -- elias 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a486225f-f2f9-49d3-856c-11495c8dce78%40googlegroups.com.


[go-nuts] Re: html/template escaping problem

2019-09-11 Thread Jens-Uwe Mager
I finally got a workaround going, and that is to not have any moustache 
template in the javascript at all. By putting the {{area}} template in an 
data-xxx attribute of the  element I can access this from the javascript.

On Monday, September 9, 2019 at 1:53:34 PM UTC+2, Jens-Uwe Mager wrote:
>
> I am having a problem to properly escape javascript urls in my templates. 
> I do have the situation where I build a template that is having javascript 
> urls that are from variables in the go program (read from yaml files). The 
> go program generates static html, but the html is supposed to use 
> moustache.js to expand some further variables at render time. I am just not 
> able to preserve my javascript from the html/template escaping. Any ideas 
> what I am doing wrong? 
>
> The output is:
>
> {{test}}
>
>
> But I would like it to be:
>
> {{test}}
>
>
> package main
>
> import (
> "html/template"
> "os"
> )
>
> var t = template.Must(template.New("test").Funcs(template.FuncMap{
> "safeattr": func(value string) template.HTMLAttr {
> return template.HTMLAttr(value)
> },
> "safehtml": func(value string) template.HTML {
> return template.HTML(value)
> },
> "safejs": func(value string) template.JS {
> return template.JS(value)
> },
> "safecss": func(value string) template.CSS {
> return template.CSS(value)
> },
> "safeurl": func(value string) template.URL {
> return template.URL(value)
> },
> }).Parse(`
> {{safehtml .content}}
> `))
>
> func main() {
> data := map[string]string{
> "href":"javascript:doSlide('{{area}}');",
> "content": "{{test}}",
> }
> err := t.Execute(os.Stdout, data)
> if err != nil {
> panic(err)
> }
> }
>
>
>
> https://play.golang.org/p/F2EiuECCZWo
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/865e2df0-db52-4dd8-8c84-43c2cc56c599%40googlegroups.com.


Re: [go-nuts] Re: Running golang compiled binary on QNX

2019-09-11 Thread Ian Lance Taylor
On Wed, Sep 11, 2019 at 6:18 AM  wrote:
>
> Right. I could have my question better. The real question is whether there is 
> any hope of QNX support in go. It's no surprise that a GOARCH=386 GOOS=linux 
> binary would not work.

I don't see anything that would make it impossible to port Go to
support QNX.  So in that sense there is hope.

But to the best of my knowledge nobody is working on a QNX port and
nobody has ever expressed any interest in working on one.  It would
not be a simple job.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVs8dkZgnpJZeJ6vBB%3DN%2BC_vj0GYyb69T7uFBC%3DUMGQQg%40mail.gmail.com.


Re: [go-nuts] Re: Running golang compiled binary on QNX

2019-09-11 Thread scabooz
Right. I could have my question better. The real question is whether there 
is any hope of QNX support in go. It's no surprise that a GOARCH=386 
GOOS=linux binary would not work.

On Monday, September 9, 2019 at 10:30:06 PM UTC-4, Adrian Petrescu wrote:
>
> On 09/09 11:30AM, sca...@gmail.com  wrote:
>
>> It’s been at least 18 months since this question was asked. Has anything 
>> changed?
>>
>> On Tuesday, January 30, 2018 at 4:44:42 PM UTC-5, sbez…@cisco.com wrote:
>>
>>> Hello,
>>>
>>> I was wondering if anybody managed to get golang compiled binary to run 
>>> on 32-bit QNX?
>>>
>>> I compiled it with GOARCH=386 GOOS=linux go build -o blah
>>>
>> I might be missing some context here, but why would you expect a binary 
> compiled for Linux to run unaided on QNX? They’re two completely different 
> operating systems.
>
> This issue  seems to confirm 
> that there’s no special compatibility layer that would allow this to work.
>
> – Adrian
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0c3d5288-2b02-4935-bb8c-a6903279d832%40googlegroups.com.


Re: [go-nuts] nested or sub template by variable

2019-09-11 Thread dunlapg


On Tuesday, April 17, 2012 at 2:52:03 PM UTC+1, Rob 'Commander' Pike wrote:
>
> You can't, for safety reasons in html/template. The text/template
> package has the same property so the packages are consistent.
>
> The examples in the documentation for text/template show how the same
> effect can be achieved safely.
>

What's unsafe about the code above?

The basic issue I'm trying to solve is that I want to have a general 
"layout" framework for web pages, in which I have a navbar at the top, a 
navbar at the side, and content in the mail part.  The natural way to do 
this would be to have a template that looks like this:

{{define "page"}}
{{template "navbarTop" .NavbarTopArgs}}
{{template "navbarLeft" .NavbarLeftArgs}}
{{template .MainContent .MainContentArgs}}
{{end}}

Then you define templates for the different main pages, and call the "page" 
template at the top saying which of the templates to render.

Looking around, there are basically three alternate solutions to this 
problem, none of which are very satisfying:

* Solution 1: Multiple parsed templates

In this one, you define your main template like this:

{{define "page"}}
{{template "navbarTop" .NavbarTopArgs}}
{{template "navbarLeft" .NavbarLeftArgs}}
{{template "content" .MainContentArgs}}
{{end}}

Then for each "main content" page, you define a separate file that contains 
a "content" template.

But this means having a fully separate template variable, and all the 
template code, for each different view of the webpage.  This seems really 
repetitive an inefficient.

Examples suggesting this:

https://blog.rubylearning.com/go-web-programming-nesting-templates-f008418c6cc8

https://hackernoon.com/golang-template-2-template-composition-and-how-to-organize-template-files-4cb40bcdf8f6

* Solution 2: Invert the nesting

In this option, you have each "main content" template manually include the 
navbars, thus:

{{define "MainContentAbout"}}
{{template "navbarTop" .NavbarTopArgs}}
{{template "navbarLeft" .NavbarLeftArgs}}
... content of 'about' page...
{{end}}

This again is repetitive -- each page has to include the navbars, and if I 
(say) wanted to add a footer, I'd have to manually go and add it to each of 
my content pages; and I might make a mistake and miss some.

Examples suggesting this:

https://levelup.gitconnected.com/using-go-templates-for-effective-web-development-f7df10b0e4a0

The problem with both #1 and #2 is that they're violating the Don't Repeat 
Yourself principle.

* Solution 3: Work around the limitation with functions

In this case, you define a function that will do the work of 
programmatically nesting templates for you, like this:

{{define "page"}}
{{template "navbarTop" .NavbarTopArgs}}
{{template "navbarLeft" .NavbarLeftArgs}}
{{content .MainContentTemplate .MainContentArgs}}
{{end}}

And then implementing a function that looks like this:

funcs := template.FuncMap{
"content": func(t string, arg interface{}) (template.HTML, error) {
buf := bytes.NewBuffer(nil)
mtmpl, err := template.ParseFiles("templates/study.html.tmpl")
if err == nil {
err = mtmpl.ExecuteTemplate(w, t, arg)
}
return template.HTML(buf.String()), err
},
}

This has the benefit of being able to make our layout fully 
parameterisable.  But it means having this weird structure where we go into 
a template, go out into go, and go back into a *different* template.

Examples of people recommending this approach:

https://github.com/spbooks/go1/blob/master/chapter4/3_layouts/template.go

It seems like it would be much better to simply incorporate #3 into the 
language itself.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/70d7195c-6e3d-4091-97a1-0afd8da4775e%40googlegroups.com.


Re: [go-nuts] Re: x/mobile: Samples for reverse binding in gomobile

2019-09-11 Thread Elias Naur
On Wed Sep 11, 2019 at 3:51 AM Jay Sharma wrote:
> 
> 
> I have one doubt when we build using gomobile in that I am giving the 
> classpath to my .class java file. 
> *Will it be included in .aar or I have to include that .class file along 
> with .aar in my android application. *
> 

The class file is not automatically included, that wasn't clear from my earlier
reply. Please include the class file in your project and try my suggestion to
call your code from Java.

-- elias

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BWX4HNJBFFHC.1LTPFNFL2HB48%40themachine.


Re: [go-nuts] Re: x/mobile: Samples for reverse binding in gomobile

2019-09-11 Thread Jay Sharma
Hi Elias,

The provided logs: 
2019-09-10 16:36:54.199 9400-9430/com.sample  E/GoLog: 2019/09/10 11:06:54 
test.go:134: testFunction [Test]
2019-09-10 16:36:54.199 9400-9430/com.sample  E/GoLog: 2019/09/10 11:06:54 
test.go:136: [Test] Now going to call a java system function 
(System.CurrentTimeMillis())..
2019-09-10 16:36:54.200 9400-9434/com.sample  E/GoLog: 2019/09/10 11:06:54 
test.go:138: [Test] Called java function return value is:  1568113614199

*In this you can see I am able to call System.CurrentTimeMillis() and 
printing in logs.*

*This is the next line of code where I am trying to call my own class java 
function from go: *
2019-09-10 16:36:54.200 9400-9434/com.sample  E/GoLog: 2019/09/10 11:06:54 
test.go:140: [Test] Now going to call my java function

After this log I am actually calling like this: 
*RBinding.getStringFromJava() and it is crashing. *


I have one doubt when we build using gomobile in that I am giving the 
classpath to my .class java file. 
*Will it be included in .aar or I have to include that .class file along 
with .aar in my android application. *

Thanks.


On Tuesday, September 10, 2019 at 8:55:47 PM UTC+5:30, Elias Naur wrote:
>
> On Tue Sep 10, 2019 at 4:26 AM Jay Sharma wrote: 
> > --=_Part_1258_983331168.1568114760099 
> > Content-Type: text/plain; charset="UTF-8" 
> > 
> > Hello @elias, 
> > 
> > I tried the following: 
> > 
> > 1. Created a java class : 
> > 
> > package reversebinding; 
> > 
> > public class RBinding { 
> >  public static String getStringFromJava() { 
> > return "Hello from java !!"; 
> > } 
> > } 
> > 
> > 2. Generated the .class file for this file. 
> > 
> > 3. Generated the android binding using gomobile tool and used 
> > -classpath="Path to my .class file" 
> > 
> > 4. Binding is generated successfully. 
> > 
> > *But when I used that generated (.aar) file in my android app and tried 
> to 
> > trigger the api it is crashing; * 
> > 
> > 2019-09-10 16:36:54.199 9400-9430/com.sample  E/GoLog: 2019/09/10 
> 11:06:54 
> > test.go:134: testFunction [Test] 
> > 2019-09-10 16:36:54.199 9400-9430/com.sample  E/GoLog: 2019/09/10 
> 11:06:54 
> > test.go:136: [Test] Now going to call a java system function 
> > (System.CurrentTimeMillis()). 
> > 2019-09-10 16:36:54.200 9400-9434/com.sample  E/GoLog: 2019/09/10 
> 11:06:54 
> > test.go:138: [Test] Called java function return value is:  1568113614199 
> > 2019-09-10 16:36:54.200 9400-9434/com.sample  E/GoLog: 2019/09/10 
> 11:06:54 
> > test.go:140: [Test] Now going to call my java function. 
> > 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: panic: runtime error: 
> > invalid memory address or nil pointer dereference 
> > 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: [signal SIGSEGV: 
> > segmentation violation code=0x1 addr=0x0 pc=0x7568010708] 
> > 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: goroutine 17 [running, 
> > locked to thread]: 
> > 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: 
> > test.testFunction(0x400738) 
> > 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: 
> > /home/test/2019/test/test.go:141 +0x190 
> > 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: 
> > main.proxytest__testFunction(...) 
> > 2019-09-10 16:36:54.203 9400-0/com.sample com.sample E/Go: 
> > /tmp/gomobile-work-071468276/src/gobind/go_testmain.go:199 
> > 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: 
> > 
> main._cgoexpwrap_5427a26f9204_proxytest__testFunction(0x8020080280200802) 
> > 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: _cgo_gotypes.go:606 
> > +0x1c 
> > 2019-09-10 16:36:54.204 9400-9423/com.sample  A/libc: Fatal signal 6 
> > (SIGABRT), code -6 in tid 9423 (Thread-2) 
> > 
>
> The error is arguably not very helpful. Are you sure there is not another 
> error 
> before the nil pointer exception? In any case, did you ensure that the 
> .class 
> is included in the Android apk? An easy check is to try to call your 
> method 
> from Java before trying from Go. 
>
> -- elias 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a5d988ed-b057-49e5-b419-6a7302e7bdd2%40googlegroups.com.