Skip to content

Instantly share code, notes, and snippets.

@fumin
Created April 7, 2014 19:19
Show Gist options
  • Save fumin/10034274 to your computer and use it in GitHub Desktop.
Save fumin/10034274 to your computer and use it in GitHub Desktop.
self-reproducing program in Go
package main
import "fmt"
func main() {
m := `package main
import "fmt"
func main() {
`; n := `
}`; a := `"`; b := "`"; c := "fmt.Printf("; d := "%sm := %s%s%s; n := %s%s%s; a := %s%s%s; b := %s%s%s; c := %s%s%s; d := %s%s%s; e := %s%s%s; %s%s%s%s%s%s"; e := ", m, b, m, b, b, n, b, b, a, b, a, b, a, a, c, a, a, d, a, a, e, a, c, a, d, a, e, n)"; fmt.Printf("%sm := %s%s%s; n := %s%s%s; a := %s%s%s; b := %s%s%s; c := %s%s%s; d := %s%s%s; e := %s%s%s; %s%s%s%s%s%s", m, b, m, b, b, n, b, b, a, b, a, b, a, a, c, a, a, d, a, a, e, a, c, a, d, a, e, n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment