go.mod: add go.mod and move pygments to third_party

After go1.16, go will use module mode by default,
even when the repository is checked out under GOPATH
or in a one-off directory. Add go.mod, go.sum to keep
this repo buildable without opting out of the module
mode.

> go mod init github.com/mmcgrana/gobyexample
> go mod tidy
> go mod vendor

In module mode, the 'vendor' directory is special
and its contents will be actively maintained by the
go command. pygments aren't the dependency the go will
know about, so it will delete the contents from vendor
directory. Move it to `third_party` directory now.

And, vendor the blackfriday package.

Note: the tutorial contents are not affected by the
change in go1.16 because all the examples in this
tutorial ask users to run the go command with the
explicit list of files to be compiled (e.g.
`go run hello-world.go` or `go build command-line-arguments.go`).
When the source list is provided, the go command does
not have to compute the build list and whether it's
running in GOPATH mode or module mode becomes irrelevant.
This commit is contained in:
Hana
2021-02-15 16:22:08 -05:00
parent f72f11e641
commit 9e216da9ef
793 changed files with 5828 additions and 75 deletions

View File

@@ -457,7 +457,7 @@ and returns a string without printing it anywhere.</p>
</div>
<script>
var codeLines = [];
codeLines.push('');codeLines.push('package main\u000A');codeLines.push('import (\u000A \"fmt\"\u000A \"os\"\u000A)\u000A');codeLines.push('type point struct {\u000A x, y int\u000A}\u000A');codeLines.push('func main() {\u000A');codeLines.push(' p :\x3D point{1, 2}\u000A fmt.Printf(\"%v\\n\", p)\u000A');codeLines.push(' fmt.Printf(\"%+v\\n\", p)\u000A');codeLines.push(' fmt.Printf(\"%#v\\n\", p)\u000A');codeLines.push(' fmt.Printf(\"%T\\n\", p)\u000A');codeLines.push(' fmt.Printf(\"%t\\n\", true)\u000A');codeLines.push(' fmt.Printf(\"%d\\n\", 123)\u000A');codeLines.push(' fmt.Printf(\"%b\\n\", 14)\u000A');codeLines.push(' fmt.Printf(\"%c\\n\", 33)\u000A');codeLines.push(' fmt.Printf(\"%x\\n\", 456)\u000A');codeLines.push(' fmt.Printf(\"%f\\n\", 78.9)\u000A');codeLines.push(' fmt.Printf(\"%e\\n\", 123400000.0)\u000A fmt.Printf(\"%E\\n\", 123400000.0)\u000A');codeLines.push(' fmt.Printf(\"%s\\n\", \"\\\"string\\\"\")\u000A');codeLines.push(' fmt.Printf(\"%q\\n\", \"\\\"string\\\"\")\u000A');codeLines.push(' fmt.Printf(\"%x\\n\", \"hex this\")\u000A');codeLines.push(' fmt.Printf(\"%p\\n\", \x26p)\u000A');codeLines.push(' fmt.Printf(\"|%6d|%6d|\\n\", 12, 345)\u000A');codeLines.push(' fmt.Printf(\"|%6.2f|%6.2f|\\n\", 1.2, 3.45)\u000A');codeLines.push(' fmt.Printf(\"|%-6.2f|%-6.2f|\\n\", 1.2, 3.45)\u000A');codeLines.push(' fmt.Printf(\"|%6s|%6s|\\n\", \"foo\", \"b\")\u000A');codeLines.push(' fmt.Printf(\"|%-6s|%-6s|\\n\", \"foo\", \"b\")\u000A');codeLines.push(' s :\x3D fmt.Sprintf(\"a %s\", \"string\")\u000A fmt.Println(s)\u000A');codeLines.push(' fmt.Fprintf(os.Stderr, \"an %s\\n\", \"error\")\u000A}\u000A');codeLines.push('');
codeLines.push('');codeLines.push('package main\u000A');codeLines.push('import (\u000A \"fmt\"\u000A \"os\"\u000A)\u000A');codeLines.push('type point struct {\u000A x, y int\u000A}\u000A');codeLines.push('func main() {\u000A');codeLines.push(' p :\u003D point{1, 2}\u000A fmt.Printf(\"%v\\n\", p)\u000A');codeLines.push(' fmt.Printf(\"%+v\\n\", p)\u000A');codeLines.push(' fmt.Printf(\"%#v\\n\", p)\u000A');codeLines.push(' fmt.Printf(\"%T\\n\", p)\u000A');codeLines.push(' fmt.Printf(\"%t\\n\", true)\u000A');codeLines.push(' fmt.Printf(\"%d\\n\", 123)\u000A');codeLines.push(' fmt.Printf(\"%b\\n\", 14)\u000A');codeLines.push(' fmt.Printf(\"%c\\n\", 33)\u000A');codeLines.push(' fmt.Printf(\"%x\\n\", 456)\u000A');codeLines.push(' fmt.Printf(\"%f\\n\", 78.9)\u000A');codeLines.push(' fmt.Printf(\"%e\\n\", 123400000.0)\u000A fmt.Printf(\"%E\\n\", 123400000.0)\u000A');codeLines.push(' fmt.Printf(\"%s\\n\", \"\\\"string\\\"\")\u000A');codeLines.push(' fmt.Printf(\"%q\\n\", \"\\\"string\\\"\")\u000A');codeLines.push(' fmt.Printf(\"%x\\n\", \"hex this\")\u000A');codeLines.push(' fmt.Printf(\"%p\\n\", \u0026p)\u000A');codeLines.push(' fmt.Printf(\"|%6d|%6d|\\n\", 12, 345)\u000A');codeLines.push(' fmt.Printf(\"|%6.2f|%6.2f|\\n\", 1.2, 3.45)\u000A');codeLines.push(' fmt.Printf(\"|%-6.2f|%-6.2f|\\n\", 1.2, 3.45)\u000A');codeLines.push(' fmt.Printf(\"|%6s|%6s|\\n\", \"foo\", \"b\")\u000A');codeLines.push(' fmt.Printf(\"|%-6s|%-6s|\\n\", \"foo\", \"b\")\u000A');codeLines.push(' s :\u003D fmt.Sprintf(\"a %s\", \"string\")\u000A fmt.Println(s)\u000A');codeLines.push(' fmt.Fprintf(os.Stderr, \"an %s\\n\", \"error\")\u000A}\u000A');codeLines.push('');
</script>
<script src="site.js" async></script>
</body>