Error generating automated API doc using bee tool
Recently, I was setting up beego api framework for creating apis in go. I was using features of bee tool to speed up things. One such feature is generating automated api document using swagger. After following all the steps mentioned in documentation, I end up in a helpless situation with an error message below which leaves me to figure out what actually went wrong
$ bee run -downdoc=true -gendoc=true
2017/02/02 12:29:58 INFO ▶ 0001 Using 'backend' as 'appname'
2017/02/02 12:29:58 INFO ▶ 0002 Loading default configuration...
2017/02/02 12:29:58 INFO ▶ 0003 Initializing watcher...
2017/02/02 12:29:58 INFO ▶ 0004 Watching:
2017/02/02 12:29:58 INFO ▶ 0009 Generating the docs...
2017/02/02 12:29:58 ERROR ▶ 0010 Failed to generate the docs
Digging into bee source code, I found that a child command
bee generate doc failed with an error below:
| ___ \
| |_/ / ___ ___
| ___ \ / _ \ / _ \
| |_/ /| __/| __/
\____/ \___| \___| v1.6.2
2017/02/02 12:37:44 FATAL ▶ 0001 GOROOT environment variable is not set or empty
Unfortunately, this error is neither propagated nor mentioned in docs that your
GOROOT must be set as environment variable. To fix this:
- Ensure your GOROOT is set. Check using
- Export this path in your
Load you bash profile by opening a new terminal. This should help you fix the issue.