dev.sh 649 B

123456789101112131415161718192021222324252627282930
  1. goModPath(){
  2. echo $GOPATH/pkg/mod/$(grep --color=never "\t$1" ../go.mod | awk -F ' ' '{print $1"@"$2}')
  3. }
  4. snippetDirs=(
  5. ../
  6. $(goModPath github.com/qor5/web)
  7. $(goModPath github.com/qor5/x)
  8. $(goModPath github.com/qor5/ui)
  9. $(goModPath github.com/qor5/admin)
  10. )
  11. rm -rf ./generated/*
  12. gi=1
  13. for d in "${snippetDirs[@]}"
  14. do
  15. snippetgo -pkg=generated -dir=$d > ./generated/g${gi}.go
  16. gi=$((gi+1))
  17. done
  18. go run ./build/main.go
  19. function docsRestart() {
  20. echo "=================>"
  21. killall docgodocs
  22. go build -o /tmp/docgodocs ./server/main.go && /tmp/docgodocs
  23. }
  24. export -f docsRestart
  25. find . -name "*.go" | entr -r bash -c "docsRestart"