News for hackers. Stuff that matters.
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by scosman on Monday March 28, 2016 @12:15PM (#11375124)
I'm looking forward to when this exists for every almost language. Go added "c-archive" build mode in 1.5. There is no reason gobind couldn't support any language which can work with c libraries (ruby, node, etc).
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by vendakka on Monday March 28, 2016 @12:25PM (#11375199)
This exists for Python [0]. The reverse is also interesting (Go -> Java/Python/Ruby) and once I get some spare time, I'll play around with using libjvm to load and call jar files from Go.

[0] https://github.com/go-python/gopy

Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by rhodysurf on Monday March 28, 2016 @02:31PM (#11376231)
Its awesome. The problem is that only specific types are supported by a bunch of these types of libraries. In the case of gopy you cannot do anything with a nested slices in structs which limits things a bit.
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by vendakka on Monday March 28, 2016 @03:22PM (#11376628)
Yes this is definitely a little limiting. I'm also experimenting with a slightly different binding method, where passing pointers to structs is disallowed (gobind currently allows pointers to structs). All structs are only passed by value, which solves a lot of the underlying problems and allows for slices and nested structs. I'll have something tangible in a few weeks and might switch out the dependency on gobind.

EDIT: edited for clarity

Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by rhodysurf on Monday March 28, 2016 @04:12PM (#11376996)
Thats awesome news, Thanks for the explanation!
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by namelezz on Monday March 28, 2016 @03:07PM (#11376542)
Since GoJava generates jar binding, does it mean other JVM languages can use the jar to call Go too?

Edit: Java has generic Go doesn't, how do the bindings work for generic?

Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by vendakka on Monday March 28, 2016 @03:44PM (#11376786)
Regarding generics: the tool generates Java bindings from Go code. Since Go doesn't have generics we just generate non-generic bindings.
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by vendakka on Monday March 28, 2016 @03:24PM (#11376643)
Yes. The only constraint is that the jar will only work on the architecture it was built on.
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by meddlepal on Monday March 28, 2016 @04:41PM (#11377220)
Still pretty awesome and that's not really a big deal. I'm going to guess most Java these days is running on x86_64 or ARM.
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by pookeh on Monday March 28, 2016 @03:14PM (#11376576)
Yes
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by _JamesA_ on Monday March 28, 2016 @01:07PM (#11375577)
Go would benefit immensely from the ability to bind to JDBC drivers for database access.
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by dguaraglia on Monday March 28, 2016 @02:35PM (#11376264)
What makes you think so? Go has pretty solid native drivers for most SQL databases out there: https://github.com/golang/go/wiki/SQLDrivers
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by alpb on Monday March 28, 2016 @12:53PM (#11375454)
In case the author sees this, more documentation would be great.
Re:Show HN: GoJava – Server/desktop Java bindings to Go pack... by vendakka on Monday March 28, 2016 @12:57PM (#11375482)
Yup. I'll put together some more docs and usage examples this weekend.

Edit: https://github.com/sridharv/gojava/issues/6