tighten
This commit is contained in:
parent
996fa26561
commit
0c1a7354e5
35
README.md
35
README.md
@ -1,35 +1,27 @@
|
|||||||
## Go by Example
|
## Go by Example
|
||||||
|
|
||||||
Content and toolchain source for the
|
Content and toolchain for [Go by Example](https://gobyexample.com).
|
||||||
[Go by Example](https://gobyexample.com) site.
|
|
||||||
|
|
||||||
|
|
||||||
### Overview
|
### Overview
|
||||||
|
|
||||||
This repo contains:
|
The Go by Example site is built by extracting code &
|
||||||
|
comments from source files in `examples` and rendering
|
||||||
|
that data via the site `templates`. The programs
|
||||||
|
implementing this build process are in `tools`.
|
||||||
|
|
||||||
* `src`: Go and Bash source code for the site
|
The build process produces a directory of static files
|
||||||
* `meta`: metadata used to generate the site
|
suitable for serving by any modern HTTP server. The
|
||||||
* `tool`: toolchain used to generate the site
|
Go by Example site is served by a
|
||||||
* `template`: HTML templates and CSS for the site
|
[lightweight Go server](https://github.com/mmcgrana/gobyexample-server).
|
||||||
|
|
||||||
The site is built by extracting the code & comments from
|
|
||||||
the `.go` and `.sh` source files in `src` and rendering
|
|
||||||
that data according to `meta` and `templates` via programs
|
|
||||||
in `tool`.
|
|
||||||
|
|
||||||
The generated contented is served by the a
|
|
||||||
[lightweight server](https://github.com/mmcgrana/gobyexample-server).
|
|
||||||
|
|
||||||
|
|
||||||
### Usage
|
### Building
|
||||||
|
|
||||||
To validate the source, generate the site, and open the
|
To build the site to ./site:
|
||||||
home page in your browser:
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ tool/build
|
$ tool/build
|
||||||
$ open site/index.html
|
|
||||||
```
|
```
|
||||||
|
|
||||||
To build continuously in a loop:
|
To build continuously in a loop:
|
||||||
@ -38,7 +30,7 @@ To build continuously in a loop:
|
|||||||
$ tool/build-loop
|
$ tool/build-loop
|
||||||
```
|
```
|
||||||
|
|
||||||
Generation requires the [`pygmentize`](http://pygments.org/)
|
Builds require the [`pygmentize`](http://pygments.org/)
|
||||||
binary for syntax highlighting.
|
binary for syntax highlighting.
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +46,8 @@ $ SITEDIR = ../gobyexample-server/public tool/build
|
|||||||
|
|
||||||
### License
|
### License
|
||||||
|
|
||||||
This work is licensed under a [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/).
|
This work is licensed under a
|
||||||
|
[Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/).
|
||||||
|
|
||||||
|
|
||||||
### Thanks
|
### Thanks
|
||||||
|
@ -25,11 +25,10 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
This is a hands-on introduction to Go. <em>Go by
|
<em>Go by Example</em> is a hands-on introduction
|
||||||
Example</em> teaches Go with example programs,
|
to Go using annotated example programs. Check out
|
||||||
since programmers learn to program by reading and
|
the <a href="/hello-world">first example</a> or
|
||||||
writing programs. Each example gives you a new
|
see the full list below.
|
||||||
tool for writing your own Go code:
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
tool/gofmt
|
|
||||||
tool/measure
|
|
||||||
tool/generate
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
exec go run tool/generate.go
|
|
@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
ls tool/*.go examples/*/*.go | xargs gofmt -tabs=false -tabwidth=4 -w=true
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
exec go run tool/measure.go
|
|
7
tools/build
Executable file
7
tools/build
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
tools/gofmt
|
||||||
|
tools/measure
|
||||||
|
tools/generate
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
tool/build
|
tools/build
|
||||||
if [ "$?" == "0" ]; then
|
if [ "$?" == "0" ]; then
|
||||||
echo "success"
|
echo "success"
|
||||||
else
|
else
|
3
tools/generate
Executable file
3
tools/generate
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
exec go run tools/generate.go
|
6
tools/gofmt
Executable file
6
tools/gofmt
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
ls tools/*.go examples/*/*.go | xargs gofmt -tabs=false -tabwidth=4 -w=true
|
3
tools/measure
Executable file
3
tools/measure
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
exec go run tools/measure.go
|
Loading…
x
Reference in New Issue
Block a user