dmitri.shuralyov.com/scratch/...

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

Mergedjbrandhorst.com opened this change 8 months ago
Patch Set 1
Johan Brandhorst-Satzkorn committed 8 months ago commit afef9d3d78d62527db14cb281e31fdb8ca9d0aff
Collapse all
Commit Message
FileFile
@@ -0,0 +1,11 @@
1
Parent:     01c5e73 (add LICENSE file)
2
Author:     Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
3
AuthorDate: Mon Apr 22 21:35:42 2024 -0700
4
Commit:     Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
5
CommitDate: Mon Apr 22 21:36:08 2024 -0700
6

7
main: add package quine
dmitshur commented 8 months ago (Patch Set 1)

s/main/quine/ to match the path of the command being added.

Write Preview Markdown
dmitshur commented 8 months ago (Patch Set 1)

Done in PS 2.

Write Preview Markdown
8

9
Quines are fun
10

11
Change-Id: I3dffaf514ac2a04046fb54b6179cd1677053c5c7
quine/README.md
FileFile
dmitshur commented 8 months ago (Patch Set 1) ยท edited

I suggest either adding a quine that can be licensed via the existing BSD-3-Clause LICENSE at the top level of the repo (see the "License" link at https://dmitri.shuralyov.com/scratch), or if you'd really rather stick with this command having a different license, then move it into a file named LICENSE in this directory. That way it will be recognized by this code host.

At that point the README.md is fairly empty. You can move its content to a package comment in quine.go doc.go, so that it too would be recognized and displayed at the future package page. Edit: I realize now that adding it to quine.go would interfere with its functionality hehe.

Write Preview Markdown
dmitshur commented 8 months ago (Patch Set 1)

Patch set 2 seems to resolve this.

Write Preview Markdown
@@ -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
}