Created
December 11, 2012 22:24
-
-
Save samnm/4262886 to your computer and use it in GitHub Desktop.
A super simple quine written in Go. This takes advantage of the '%q' format verb to print strings as they are represented in source. Run `go run quine.go | diff quine.go -` to diff the output and source.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
s0 := "package main\n\nimport \"fmt\"\n\nfunc main() {\n\ts0 := %q\n\tfmt.Printf(s0, s0)\n}\n" | |
fmt.Printf(s0, s0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment