internal/readme: use go:generate rather than Make
Simplify the readme generation to just use go:generate, no longer depending on Make or bash. Subsequent CLs will generate more documentation in a similar manner. For #442
This commit is contained in:
parent
3a66cf3997
commit
872b437b2a
3 changed files with 12 additions and 47 deletions
|
|
@ -1,19 +0,0 @@
|
|||
# This makefile builds ../README.md from the files in this directory.
|
||||
|
||||
OUTFILE=../../README.md
|
||||
|
||||
$(OUTFILE): build README.src.md
|
||||
go run golang.org/x/example/internal/cmd/weave@latest README.src.md > $(OUTFILE)
|
||||
|
||||
# Compile all the code used in the README.
|
||||
build: $(wildcard */*.go)
|
||||
go build -o /tmp/mcp-readme/ ./...
|
||||
|
||||
# Preview the README on GitHub.
|
||||
# $HOME/markdown must be a github repo.
|
||||
# Visit https://github.com/$HOME/markdown to see the result.
|
||||
preview: $(OUTFILE)
|
||||
cp $(OUTFILE) $$HOME/markdown/
|
||||
(cd $$HOME/markdown/ && git commit -m . README.md && git push)
|
||||
|
||||
.PHONY: build preview
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Build README.md from the files in this directory.
|
||||
# Must be invoked from the mcp 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
|
||||
9
internal/readme/doc.go
Normal file
9
internal/readme/doc.go
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright 2025 The Go MCP SDK Authors. All rights reserved.
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:generate go run golang.org/x/example/internal/cmd/weave@latest -o ../../README.md ./README.src.md
|
||||
|
||||
// The readme package is used to generate README.md at the top-level of this
|
||||
// repo. Regenerate the README with go generate.
|
||||
package readme
|
||||
Loading…
Reference in a new issue