A quine written in Go

quine.go

  • Below we use printf to print the value of me, which is the program, the quotes with 0x60.

  • %s is the uninterpreted bytes of the string.
  • %c is the character represented by the corresponding Unicode code point.
package main

import "fmt"

func main() {

  fmt.Printf("%s%c%s%c\n", me, 0x60, me, 0x60)

} // func main


var me = `
package main

import "fmt"

func main() {

  fmt.Printf("%s%c%s%c\n", me, 0x60, me, 0x60)

} // func main

var me = `

In-Use

go run quine.go

package main

import "fmt"

func main() {

  fmt.Printf("%s%c%s%c\n", me, 0x60, me, 0x60)

} // func main

var me = `
package main

import "fmt"

func main() {

  fmt.Printf("%s%c%s%c\n", me, 0x60, me, 0x60)

} // func main

var me = `
categories: golang |