Closed source go libraries possible?

1,161 views
Skip to first unread message

Dougx

unread,
Feb 5, 2013, 11:47:31 PM2/5/13
to golan...@googlegroups.com
Someone at work asked me about this today, and after looking blank for a while I figured I have no idea, so I thought I'd put it out there.

Can you easily write and distribute a closed source go library?

It's trivial to generate executables for various platforms, and go install lets you generate all the .a files in the pkg/ folder, but how distributable are these?

Could you conceivably distribute just this folder (pkg) to people and it would be enough (with documentation somewhere) to import and use the library? Obviously you'd have to do a build for all platforms you wanted to support.

Or would the only real way of doing this be to build a closed source c-based library, distribute the dll/.so/whatever and have an open source .go (cgo) wrapper around it? 

Just curious.

Nb. Yes, I saw the previous thread about the legality of this. I get it. I'm interested in the technical aspect of this only.

~
Doug.

Dave Cheney

unread,
Feb 5, 2013, 11:51:20 PM2/5/13
to Dougx, golan...@googlegroups.com
> Can you easily write and distribute a closed source go library?

Yes, assuming library == package and command == binary.

> It's trivial to generate executables for various platforms, and go install
> lets you generate all the .a files in the pkg/ folder, but how distributable
> are these?

There is no tooling for this, however the method is described in
http://code.google.com/p/go/issues/detail?id=2775. Using the native
package manager of your OS distribution may help, pay attention to
mtimes.


> Could you conceivably distribute just this folder (pkg) to people and it
> would be enough (with documentation somewhere) to import and use the
> library? Obviously you'd have to do a build for all platforms you wanted to
> support.

Yes, see above

> Or would the only real way of doing this be to build a closed source c-based
> library, distribute the dll/.so/whatever and have an open source .go (cgo)
> wrapper around it?

Potentially, but expect issues as you are working with binary
artifacts for two different systems, c and go, at the same time.

Dave

Dougx

unread,
Feb 5, 2013, 11:56:17 PM2/5/13
to golan...@googlegroups.com, Dougx
Yes, exactly. That's great; thanks for the quick reply too.
(for what its worth, the reply from the office was: "oh, that's cooler than I expected. nice." :)

Greg Ward

unread,
Feb 6, 2013, 1:50:27 PM2/6/13
to Dougx, golan...@googlegroups.com
On 05 February 2013, Dougx said:
> Someone at work asked me about this today, and after looking blank for a
> while I figured I have no idea, so I thought I'd put it out there.
>
> Can you easily write and distribute a closed source go library?

I'm sure you *can*, but IMHO you *shouldn't*. This is nothing to do
with the ethics of free vs. closed software, just an observation that
it is far, far easier to understand and diagnose problems with open
source libraries. Even the best documented libraries will have odd
corner cases and strange problems that can most quickly be answered by
consulting the fine source code.

(Actually, I guess that's really just an argument for disclosing
source code to your users, which does not necessarily make it open
source. But what the hell, if you're going to do the right thing and
disclose source code, you might as well go all the way and make it
open source. IHMO.)

Greg
--
Greg Ward http://www.gerg.ca
<gr...@gerg.ca> @gergdotca

Nate Finch

unread,
Feb 6, 2013, 3:00:52 PM2/6/13
to golan...@googlegroups.com, Dougx, gr...@gerg.ca
It's a valid question for companies that want to sell packages. I agree that in general it's better to open source your code, but it's a lot harder to make money off it if people aren't paying you for it (I know it's not impossible, but it's harder).
Reply all
Reply to author
Forward
0 new messages