add the ability to generate callgraphs

This commit is contained in:
eyedeekay
2025-02-26 20:38:29 -05:00
parent 7f78fdf784
commit a9289dd4d3
2 changed files with 19 additions and 1 deletions

View File

@ -65,8 +65,10 @@ release:
github-release release -u go-i2p -r go-i2p -n "${RELEASE_VERSION}" -t "${RELEASE_TAG}" -d "${RELEASE_DESCRIPTION}" -p
callvis:
go-callvis -format svg -focus upgrade -group pkg,type -limit github.com/go-i2p/go-i2p github.com/go-i2p/go-i2p
go-callvis -file index.html -format svg -group pkg,type github.com/go-i2p/go-i2p/
godoc:
find lib -type d -exec bash -c "ls {}/*.go && godocdown -o ./{}/doc.md ./{}" \;
gocallvis:
find lib -type d -exec bash -c "ls {}/*.go && go-callvis -focus github.com/go-i2p/go-i2p/{} -file ./{}/index.html -format svg -group pkg,type github.com/go-i2p/go-i2p/{}" \;

16
callgraph.sh Executable file
View File

@ -0,0 +1,16 @@
#! /usr/bin/env sh
dirs=$(find lib/ -type d)
for dir in $dirs; do
files=$(find "$dir" -maxdepth 1 -type f -name "*.go")
#echo "Files in $dir: $files"
file=$(echo $files | awk '{print $1}')
if [ -z "$file" ]; then
echo "no go files, skipping"
continue
fi
packageLine=$(grep -E "^package" $file)
package=$(echo $packageLine | awk '{print $2}')
echo "Generating callgraph for $package"
go-callvis -nostd -focus "$package" -group pkg,type -format svg -file $dir/$package.svg "github.com/go-i2p/go-i2p/$dir"
done