title: Is it possible to run Go code as a script?
body: <p>As Go is becoming the language of the "system".  I wonder if it's possible to run Go code as a script, without compiling it, is there any possibility to do that?</p>
  
  <p>The motivation (as there were questions as for motivation), taken from <a href="http://alvinalexander.com/scala/how-to-write-scala-shell-scripts-scripting-language-examples" rel="noreferrer">How to use Scala as a scripting language</a></p>
  
  <blockquote>
    <p>Problem You want to use Scala as a scripting language on Unix systems,
    replacing other scripts you’ve written in a Unix shell (Bourne Shell,
    Bash), Perl, PHP, Ruby, etc.</p>
  </blockquote>
  
  <p>UPDATE:
  I wonder how much I can "abuse" <code>go run</code> to be able to have much Go code running as <code>scripts</code> though compiled (which I like that its compiled) but it looks like <code>go run</code> can give me the opportunity to replace <code>scripting</code>, that is have source files on servers and run them as source while getting compiled by the <code>go run</code> but I still manage sources and not executables.</p>
  
  <p>UPDATE:
  in addition saw <a href="https://gist.github.com/mattn/1932487" rel="noreferrer">gorun</a></p>
  
  <blockquote>
    <p>gorun - Script-like runner for Go source files.</p>
  </blockquote>
  
  <p>Though there is a motivation and tools which tried to workaround not being able to run as script, I will not go for it, +I've been told it's not production ready and was advised not to use it in production because it's not production ready, it's out of it's purpose and would need dump the scripting convenience in favour of Go.  (I don't have anything against compiling, static typing, I'm a big fan of it, but wanted something similar to scripting convenience).</p>