dmitri.shuralyov.com/scratch/...

quine: add package quine dmitri.shuralyov.com/scratch#2

Mergedjbrandhorst.com opened this change 8 months ago
Collapse all
Commit Message
FileFile
@@ -0,0 +1,12 @@
1
Parent:     91a3f52 (add AUTHORS.md file)
2
Author:     Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
3
AuthorDate: Mon Apr 22 21:35:42 2024 -0700
4
Commit:     Dmitri Shuralyov <dmitri@shuralyov.com>
5
CommitDate: Fri Apr 26 00:38:44 2024 -0400
6

7
quine: add package quine
8

9
Quines are fun
10

11
Change-Id: I3dffaf514ac2a04046fb54b6179cd1677053c5c7
12
Reviewed-On: https://dmitri.shuralyov.com/scratch/...$changes/2
quine/LICENSE
FileFile
@@ -0,0 +1,23 @@
1
The quine was sourced from https://github.com/alangpierce/golang-quine under the MIT license:
2

3
The MIT License (MIT)
4

5
Copyright (c) 2016 Alan Pierce
6

7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
13

14
The above copyright notice and this permission notice shall be included in all
15
copies or substantial portions of the Software.
16

17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
SOFTWARE.
quine/quine.go
FileFile
@@ -0,0 +1,16 @@
1
package main
2

3
import "fmt"
4

5
func main() {
6
	code := `package main
7

8
import "fmt"
9

10
func main() {
11
	code :=
12
	fmt.Print(code[:51] + "\u0060" + code + "\u0060" + code[51:])
13
}
14
`
15
	fmt.Print(code[:51] + "\u0060" + code + "\u0060" + code[51:])
16
}