On Wed, Dec 19, 2018 at 10:50 AM Peter Kleiweg <pklei...@xs4all.nl> wrote:
>
> How do I do what runtime/race does? Is it what I want?
>
> I have a package with C and Go files. I want to install that package. Then I 
> want to import that package into a program, and build that program without 
> recompiling the package. Because recompile fails.
>
> How do I do that? This was an issue before, and the provided solution: after 
> installation, mark the source as binary-only. That is a bit of a pain, but it 
> works.
>
> Starting with Go 1.13, Go is going to make its users work more difficult 
> again. Why?
>
> I just want to install a package and use it, without having to worry about 
> external stuff.

I assume that the recompile fails because compiling the C code fails.
You should compile the C code yourself, producing a .syso file.  You
should add that .syso file to your package directory.  You should
remove the C code from your package directory--you can still put it in
a subdirectory, of course, for reference.  Then a Go program can
import your package, compile the Go code as usual, and use the .syso
file for the C code.  Hopefully that won't be any more painful than
the approach you are using today, although it is different.

The reason for the change is that binary packages are hard to support
correctly.  There are many ways to modify how Go code is compiled,
with options like -buildmode and -gcflags.  If those options do not
match exactly how the binary package was built, it's easy for there to
be a silent error in the resulting program.  That is not a good
experience.

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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to