goctl env

Overview

goctl env can quickly detect goctl dependency. If your environment is missing a goctl dependency, goctl env will give it a reminder and you can of course install missing dependencies via the goctl env install command.

goctl env directive

  1. $ goctl env --help
  2. Check or edit goctl environment
  3. Usage:
  4. goctl env [flags]
  5. goctl env [command]
  6. Available Commands:
  7. check Detect goctl env and dependency tools
  8. install Goctl env installation
  9. Flags:
  10. -f, --force Silent installation of non-existent dependencies
  11. -h, --help help for env
  12. -v, --verbose Enable log output
  13. -w, --write strings Edit goctl environment
  14. Use "goctl env [command] --help" for more information about a command.

goctl env check directive

The goctl env check instructions are ready to quickly detect goctl dependency. If your environment is missing goctl, goctl env check gives a reminder accordingly.

  1. $ goctl env check --help
  2. Detect goctl env and dependency tools
  3. Usage:
  4. goctl env check [flags]
  5. Flags:
  6. -h, --help help for check
  7. -i, --install Install dependencies if not found
  8. Global Flags:
  9. -f, --force Silent installation of non-existent dependencies
  10. -v, --verbose Enable log output
goctl env - 图1 Parameter fieldgoctl env - 图2 Parameter Typegoctl env - 图3 Required?goctl env - 图4 Default valuegoctl env - 图5 Parameter Description
ibooleanNOfalseInstall Dependencies
forcebooleanNOfalseSilent Installing components. If false, each component will eject the installation confirmation option before installing it
verbosebooleanNOfalseExport execution log

Example

Example 1: detect goctl dependencies

  • goctl 环境依赖已经安装
  • goctl 环境依赖未安装
  1. $ goctl env check --verbose
  2. [goctl-env]: preparing to check env
  3. [goctl-env]: looking up "protoc"
  4. [goctl-env]: "protoc" is installed
  5. [goctl-env]: looking up "protoc-gen-go"
  6. [goctl-env]: "protoc-gen-go" is installed
  7. [goctl-env]: looking up "protoc-gen-go-grpc"
  8. [goctl-env]: "protoc-gen-go-grpc" is installed
  9. [goctl-env]: congratulations! your goctl environment is ready!
  1. $ goctl env check --verbose
  2. [goctl-env]: preparing to check env
  3. [goctl-env]: looking up "protoc"
  4. [goctl-env]: "protoc" is not found in PATH
  5. [goctl-env]: looking up "protoc-gen-go"
  6. [goctl-env]: "protoc-gen-go" is not found in PATH
  7. [goctl-env]: looking up "protoc-gen-go-grpc"
  8. [goctl-env]: "protoc-gen-go-grpc" is not found in PATH
  9. [goctl-env]: check env finish, some dependencies is not found in PATH, you can execute
  10. command 'goctl env check --install' to install it, for details, please execute command
  11. 'goctl env check --help'

Example 2: detect goctl dependencies and install missing dependencies

  • 不静默安装
  • 静默安装
  1. $ goctl env check --verbose --install
  2. [goctl-env]: preparing to check env
  3. [goctl-env]: looking up "protoc"
  4. [goctl-env]: "protoc" is not found in PATH
  5. [goctl-env]: do you want to install "protoc" [y: YES, n: No]
  6. y
  7. [goctl-env]: preparing to install "protoc"
  8. [goctl-env]: "protoc" is already installed in "/Users/keson/go/bin/protoc"
  9. [goctl-env]: looking up "protoc-gen-go"
  10. [goctl-env]: "protoc-gen-go" is not found in PATH
  11. [goctl-env]: do you want to install "protoc-gen-go" [y: YES, n: No]
  12. y
  13. [goctl-env]: preparing to install "protoc-gen-go"
  14. "protoc-gen-go" installed from cache
  15. [goctl-env]: "protoc-gen-go" is already installed in "/Users/keson/go/bin/protoc-gen-go"
  16. [goctl-env]: looking up "protoc-gen-go-grpc"
  17. [goctl-env]: "protoc-gen-go-grpc" is not found in PATH
  18. [goctl-env]: do you want to install "protoc-gen-go-grpc" [y: YES, n: No]
  19. y
  20. [goctl-env]: preparing to install "protoc-gen-go-grpc"
  21. "protoc-gen-go-grpc" installed from cache
  22. [goctl-env]: "protoc-gen-go-grpc" is already installed in "/Users/keson/go/bin/protoc-gen-go-grpc"
  23. [goctl-env]: congratulations! your goctl environment is ready!
  1. $ goctl env check --verbose --install --force
  2. [goctl-env]: preparing to check env
  3. [goctl-env]: looking up "protoc"
  4. [goctl-env]: "protoc" is not found in PATH
  5. [goctl-env]: preparing to install "protoc"
  6. "protoc" installed from cache
  7. [goctl-env]: "protoc" is already installed in "/Users/keson/go/bin/protoc"
  8. [goctl-env]: looking up "protoc-gen-go"
  9. [goctl-env]: "protoc-gen-go" is not found in PATH
  10. [goctl-env]: preparing to install "protoc-gen-go"
  11. "protoc-gen-go" installed from cache
  12. [goctl-env]: "protoc-gen-go" is already installed in "/Users/keson/go/bin/protoc-gen-go"
  13. [goctl-env]: looking up "protoc-gen-go-grpc"
  14. [goctl-env]: "protoc-gen-go-grpc" is not found in PATH
  15. [goctl-env]: preparing to install "protoc-gen-go-grpc"
  16. "protoc-gen-go-grpc" installed from cache
  17. [goctl-env]: "protoc-gen-go-grpc" is already installed in "/Users/keson/go/bin/protoc-gen-go-grpc"
  18. [goctl-env]: congratulations! your goctl environment is ready!

goctl env install directive

The goctl env install command has the same function as goctl env checkk —install.

  1. $ goctl env install --help
  2. Goctl env installation
  3. Usage:
  4. goctl env install [flags]
  5. Flags:
  6. -h, --help help for install
  7. Global Flags:
  8. -f, --force Silent installation of non-existent dependencies
  9. -v, --verbose Enable log output
goctl env - 图6 Parameter fieldgoctl env - 图7 Parameter Typegoctl env - 图8 Required?goctl env - 图9 Default valuegoctl env - 图10 Parameter Description
forcebooleanNOfalseSilent Installing components. If false, each component will eject the installation confirmation option before installing it
verbosebooleanNOfalseExport execution log