internal/mcp: construct README with weave
Use the weave program from golang.org/x/example to weave together the README text with buildable programs. This ensures the code in the README compiles. Change-Id: Ib5e10c8f808cc6d1ed4addbee784607e910ba30b Reviewed-on: https://go-review.googlesource.com/c/tools/+/673796 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
ce5b6cd926
commit
715e9f1935
1 changed files with 196 additions and 10 deletions
22
internal/readme/build.sh
Executable file
22
internal/readme/build.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Build README.md from the files in this directory.
|
||||
# Must be invoked from the internal/cmp directory.
|
||||
|
||||
cd internal/readme
|
||||
|
||||
outfile=../../README.md
|
||||
|
||||
# Compile all the code used in the README.
|
||||
go build -o /tmp/mcp-readme/ ./...
|
||||
# Combine the code with the text in README.src.md.
|
||||
# TODO: when at Go 1.24, use a tool directive for weave.
|
||||
go run golang.org/x/example/internal/cmd/weave@latest README.src.md > $outfile
|
||||
|
||||
if [[ $1 = '-preview' ]]; then
|
||||
# Preview the README on GitHub.
|
||||
# $HOME/markdown must be a github repo.
|
||||
# Visit https://github.com/$HOME/markdown to see the result.
|
||||
cp $outfile $HOME/markdown/
|
||||
(cd $HOME/markdown/ && git commit -m . README.md && git push)
|
||||
fi
|
||||
Loading…
Reference in a new issue