New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make gokogiri compile with go 1.6 #93

Closed
wants to merge 4 commits into
base: master
from

Conversation

3 participants
@nightlyone

nightlyone commented Mar 17, 2016

In Go 1.6 it is basically forbidden to pass a Go pointer to Go functions that are used as callbacks from C.

Fix this by funneling those pointers through global variables.

Fixes #92

Ingo Oeser added some commits Mar 17, 2016

Ingo Oeser
Make SetContent work with Go1.6
by passing the callback argument (a Go pointer) via global variable.
This allows only one SetContent to happen at any time in the program,
but works for now.
Ingo Oeser
make serialize work in go.16
by passing the WriteBuffer in a global variable
Ingo Oeser
do version check the way libxml2 intended it
So we only check X == Y where
  * X is the version we are compiled against
  * Y is the version we are dynamically linked against on startup
Ingo Oeser
save the variable scope to a global map
since callbacks in Go1.6 ar not allowed to take Go pointers
@nightlyone

This comment has been minimized.

nightlyone commented Mar 30, 2016

Ping, and feedback on this?

@jbowtie

This comment has been minimized.

Contributor

jbowtie commented Mar 30, 2016

Looks like a reasonable approach to me, but I haven't yet had a chance to test it.

@andreastt

This comment has been minimized.

andreastt commented Apr 27, 2016

I can confirm that this resolves the same issue I was having with gokogiri on FreeBSD as well as Linux.

@jbowtie

This comment has been minimized.

Contributor

jbowtie commented Apr 28, 2016

I've incorporated this into my fork, and it works fine on both 1.5 and 1.6 as far as I can tell.

@andreastt

This comment has been minimized.

andreastt commented Apr 28, 2016

I should add that it’s possible to work around the runtime checks in Go 1.6 by using the GODEBUG=cgocheck=0 environmental variable.

@nightlyone

This comment has been minimized.

nightlyone commented May 20, 2016

Any feedback on this from you @cin210 or is the fork from @jbowtie now the official one and this one is orphaned?

afeld added a commit to opencontrol/fedramp-templater that referenced this pull request May 27, 2016

@nightlyone

This comment has been minimized.

nightlyone commented Jun 19, 2016

OK, will close it, since everyone interested in a maintained package uses the fork from @jbowtie anyway 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment