3

Is it possible to install a Golang package system-wide and not need the source code afterwards in order to compile programs that use it?

More particularly, having just the pkg/linux_amd64_dynlink/ directory with, for example, libstringutil.so stringutil.a and stringutil.shlibname files, how can I compile a simple hello.go that imports stringutil?

user2424276
  • 591
  • 1
  • 5
  • 24
  • do you mean as library? – sfault Feb 23 '16 at 11:31
  • 1
    this stack question might help [building-and-linking-dynamically-from-a-go-binary](http://stackoverflow.com/questions/19431296/building-and-linking-dynamically-from-a-go-binary) – sfault Feb 23 '16 at 13:32
  • it seems support is limited, on mac it gives following error `-buildmode=shared not supported on darwin/amd64` – sfault Feb 23 '16 at 13:36
  • tldr: no, and it is a good thing. Best thing is to create a service that does the generic things and call that. – RickyA Feb 23 '16 at 14:02
  • Nobody has resolved this? I don't want those packages installed in my ~/go directory, I too want them system-wide so that it is available to other users in my Linux/Unix system. – Lord of Scripts Aug 02 '23 at 17:01

0 Answers0