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

The goctl env allows you to quickly view some of the current variables in the goctl environment, and provide this information to the maintainer when users report bugs.

  1. $ goctl env
  2. GOCTL_OS=darwin
  3. GOCTL_ARCH=arm64
  4. GOCTL_HOME=/Users/sh00414ml/.goctl
  5. GOCTL_DEBUG=False
  6. GOCTL_CACHE=/Users/sh00414ml/.goctl/cache
  7. GOCTL_EXPERIMENTAL=off
  8. GOCTL_VERSION=1.6.5
  9. PROTOC_VERSION=3.19.4
  10. PROTOC_GEN_GO_VERSION=v1.28.0
  11. PROTO_GEN_GO_GRPC_VERSION=1.2.0
goctl env - 图1 Fieldgoctl env - 图2 Default Valuegoctl env - 图3 Description
GOCTL_OSEmpty stringOperating System
GOCTL_ARCHEmpty stringSystem Architecture
GOCTL_HOMEEmpty stringgoctl configuration directory
GOCTL_DEBUGEmpty stringWhether to enable debug mode, maintainer to use, enumeration values Ture, False
GOCTL_CACHEEmpty stringcache directory
GOCTL_EXPERIMENTALoffWhether to enable the experimental function, enumeration values [on,off]
GOCTL_VERSIONEmpty stringgoctl version
PROTOC_VERSIONEmpty stringprotoc version
PROTOC_GEN_GO_VERSIONEmpty stringprotoc_gen_go plugin version
PROTO_GEN_GO_GRPC_VERSIONEmpty stringprotoc_gen_go_grpc plugin version

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 - 图4 Parameter fieldgoctl env - 图5 Parameter Typegoctl env - 图6 Required?goctl env - 图7 Default valuegoctl env - 图8 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 - 图9 Parameter fieldgoctl env - 图10 Parameter Typegoctl env - 图11 Required?goctl env - 图12 Default valuegoctl env - 图13 Parameter Description
forcebooleanNOfalseSilent Installing components. If false, each component will eject the installation confirmation option before installing it
verbosebooleanNOfalseExport execution log