From d5c5a20d2b280e5109f044a7c9e1be0eae4a7d7a Mon Sep 17 00:00:00 2001 From: lub Date: Sat, 26 May 2018 12:48:15 +0200 Subject: [PATCH 1/2] change while to until loop this suits our use-case better and needs less code --- gendoc.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gendoc.sh b/gendoc.sh index 679308a..d343788 100755 --- a/gendoc.sh +++ b/gendoc.sh @@ -9,13 +9,10 @@ GOPATH=$(pwd):$(pwd)/vendor godoc -http=localhost:6060 & DOC_PID=$! # Wait for the server to init -while : +until curl -s "http://localhost:6060" > /dev/null do - curl -s "http://localhost:6060" > /dev/null - if [ $? -eq 0 ] # exit code is 0 if we connected - then - break - fi + # no-op + : done # Scrape the pkg directory for the API docs. Scrap lib for the CSS/JS. Ignore everything else. From 8f635f573dbb465a24d8acc83472a7b40f75fe3e Mon Sep 17 00:00:00 2001 From: lub Date: Sat, 26 May 2018 12:51:03 +0200 Subject: [PATCH 2/2] fix race condition for getting the godoc up The godoc server can be reachable, but without content (throwing 404s). This prevented wget from scraping. curl -f throws exit code != 0 for http status code != 200. --- gendoc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gendoc.sh b/gendoc.sh index d343788..2fff158 100755 --- a/gendoc.sh +++ b/gendoc.sh @@ -9,7 +9,7 @@ GOPATH=$(pwd):$(pwd)/vendor godoc -http=localhost:6060 & DOC_PID=$! # Wait for the server to init -until curl -s "http://localhost:6060" > /dev/null +until curl -fs "http://localhost:6060/pkg/github.com/matrix-org/go-neb/" > /dev/null do # no-op :