Skip to content

Instantly share code, notes, and snippets.

@Likk
Last active July 3, 2019 02:08
Show Gist options
  • Select an option

  • Save Likk/92c84643491849b5d210c931a1d84a80 to your computer and use it in GitHub Desktop.

Select an option

Save Likk/92c84643491849b5d210c931a1d84a80 to your computer and use it in GitHub Desktop.

Revisions

  1. Likk revised this gist Jul 2, 2019. No changes.
  2. Likk renamed this gist Jul 2, 2019. 1 changed file with 1 addition and 8 deletions.
    9 changes: 1 addition & 8 deletions go_perl_ruby_and_php → main.go
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    $ cat main.go
    package main

    import (
    @@ -22,10 +21,4 @@ func init() {

    func main() {
    fmt.Println("This is Go world!!")
    }
    $ go build -o main ./main.go;
    $ ./main && ( perl -x ./main )&& ( ruby -x ./main) && (php ./main 2>&1 > /dev/null)
    This is Go world!!
    Hello, perl World!!
    Hello, $Ruby World!!
    This is PHP world!!!
    }
  3. Likk created this gist Jul 2, 2019.
    31 changes: 31 additions & 0 deletions go_perl_ruby_and_php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    $ cat main.go
    package main

    import (
    "fmt"
    "io/ioutil"
    )

    const script = `<?php
    file_put_contents("php://stderr", "This is PHP world!!!".PHP_EOL);
    __halt_compiler();
    #!perl
    #!ruby
    $Ruby="perl";
    print "Hello, $Ruby World!!\n";
    __END__
    `

    func init() {
    ioutil.Discard.Write([]byte(script))
    }

    func main() {
    fmt.Println("This is Go world!!")
    }
    $ go build -o main ./main.go;
    $ ./main && ( perl -x ./main )&& ( ruby -x ./main) && (php ./main 2>&1 > /dev/null)
    This is Go world!!
    Hello, perl World!!
    Hello, $Ruby World!!
    This is PHP world!!!