From 3e26685a4463903eea9f51b43a97c09d19d9f039 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Thu, 3 Apr 2025 16:44:44 +0800 Subject: [PATCH] fix _readme tests --- doc/_readme/go.mod | 4 ++-- doc/_readme/scripts/run.sh | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/_readme/go.mod b/doc/_readme/go.mod index 91b37ae0..059f0f4f 100644 --- a/doc/_readme/go.mod +++ b/doc/_readme/go.mod @@ -1,5 +1,5 @@ -module readme +module github.com/goplus/llgo/doc/_readme -go 1.24.1 +go 1.20 require github.com/goplus/lib v0.1.0 diff --git a/doc/_readme/scripts/run.sh b/doc/_readme/scripts/run.sh index ddb30481..3c8b834f 100644 --- a/doc/_readme/scripts/run.sh +++ b/doc/_readme/scripts/run.sh @@ -1,6 +1,6 @@ #!/bin/bash -cd ./doc/_readme/ || exit 1 -llgo build -v ./... +DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) +cd "$DIR" || exit 1 python3 -m venv .venv # shellcheck source=/dev/null @@ -11,9 +11,10 @@ PYTHONPATH="" PYTHONPATH=$(python -c "import sys; print(':'.join(sys.path))") export PYTHONPATH -for dir in ./*/; do - if grep -q "func main()" "$dir"/*.go 2>/dev/null; then - echo "Running examples in $dir" - llgo run "$dir" +for sub in ./*/; do + if grep -q "func main()" "$DIR/$sub"/*.go 2>/dev/null; then + echo "Running examples in $sub" + cd "$DIR/$sub" || exit 1 + llgo run . fi done