3

Hi I want to import a 3rd party library to GO playground, I saw an answer for this question: https://stackoverflow.com/a/27813778/6638204 but it said that this can not be done, but the xiam/go-playground library on github states that it can do this. I tried using it but I did not understand what should I exactly do. I successfully installed the library and used it to run programs that do not need third party libraries. but I did not get how can I import a third party library. ps: I have docker installed in my machine

Community
  • 1
  • 1
Said Saifi
  • 1,995
  • 7
  • 26
  • 45
  • So your question is: "How do I use xiam/go-playground?" – Volker Sep 07 '16 at 12:57
  • Possible duplicate of [Can I import 3rd party package into golang playground](http://stackoverflow.com/questions/27812164/can-i-import-3rd-party-package-into-golang-playground) – Martin Tournoij Sep 07 '16 at 18:28

2 Answers2

6

The answer is still the same: you can't do that on the "official" Go Playground (at https://play.golang.org/).

If you or someone else runs a custom, modified version of the Go Playground: then the answer is you can do there whatever is allowed, which may include the usage of external libraries which the custom engine may go get prior to compilation and execution.

Also see related question: Which packages may be imported in the go playground?

Community
  • 1
  • 1
icza
  • 389,944
  • 63
  • 907
  • 827
3

You might be able to do it since May 14th, 2019

See this tweet (from Brad Fitzpatrick)!

The #golang playground now supports third-party imports, pulling them in via https://proxy.golang.org/

Example: https://play.golang.org/p/eqEo7mqdS9l

Multi-file support & few other things up next.
Report bugs at golang/go issue 31944, or here on the tweeters.

But that means you have published your package deliverable in such a way it is reference by the Go proxy.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250