cmd.sh 455 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. wd=$(dirname $0)
  3. project=test
  4. testDir=$wd/$project
  5. mkdir -p $testDir
  6. cd $testDir
  7. # go mod init
  8. go mod init $project
  9. # generate cache code
  10. goctl model mongo -t User -c --dir cache
  11. if [ $? -ne 0 ]; then
  12. exit 1
  13. fi
  14. # generate non-cache code
  15. goctl model mongo -t User --dir nocache
  16. if [ $? -ne 0 ]; then
  17. exit 1
  18. fi
  19. # go mod tidy
  20. GOPROXY=https://goproxy.cn && go mod tidy
  21. # code inspection
  22. go test -race ./...
  23. if [ $? -ne 0 ]; then
  24. echo
  25. fi