Skip to main content

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

$ goctl env --help
Check or edit goctl environment

Usage:
goctl env [flags]
goctl env [command]

Available Commands:
check Detect goctl env and dependency tools
install Goctl env installation

Flags:
-f, --force Silent installation of non-existent dependencies
-h, --help help for env
-v, --verbose Enable log output
-w, --write strings Edit goctl environment


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.

$ goctl env
GOCTL_OS=darwin
GOCTL_ARCH=arm64
GOCTL_HOME=/Users/sh00414ml/.goctl
GOCTL_DEBUG=False
GOCTL_CACHE=/Users/sh00414ml/.goctl/cache
GOCTL_EXPERIMENTAL=off
GOCTL_VERSION=1.6.5
PROTOC_VERSION=3.19.4
PROTOC_GEN_GO_VERSION=v1.28.0
PROTO_GEN_GO_GRPC_VERSION=1.2.0
Field Default Value 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.

$ goctl env check --help
Detect goctl env and dependency tools

Usage:
goctl env check [flags]

Flags:
-h, --help help for check
-i, --install Install dependencies if not found


Global Flags:
-f, --force Silent installation of non-existent dependencies
-v, --verbose Enable log output
Parameter field Parameter Type Required? Default value 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 env check --verbose
[goctl-env]: preparing to check env

[goctl-env]: looking up "protoc"
[goctl-env]: "protoc" is installed

[goctl-env]: looking up "protoc-gen-go"
[goctl-env]: "protoc-gen-go" is installed

[goctl-env]: looking up "protoc-gen-go-grpc"
[goctl-env]: "protoc-gen-go-grpc" is installed

[goctl-env]: congratulations! your goctl environment is ready!

Example 2: detect goctl dependencies and install missing dependencies

$ goctl env check --verbose --install
[goctl-env]: preparing to check env

[goctl-env]: looking up "protoc"
[goctl-env]: "protoc" is not found in PATH
[goctl-env]: do you want to install "protoc" [y: YES, n: No]
y
[goctl-env]: preparing to install "protoc"
[goctl-env]: "protoc" is already installed in "/Users/keson/go/bin/protoc"

[goctl-env]: looking up "protoc-gen-go"
[goctl-env]: "protoc-gen-go" is not found in PATH
[goctl-env]: do you want to install "protoc-gen-go" [y: YES, n: No]
y
[goctl-env]: preparing to install "protoc-gen-go"
"protoc-gen-go" installed from cache
[goctl-env]: "protoc-gen-go" is already installed in "/Users/keson/go/bin/protoc-gen-go"

[goctl-env]: looking up "protoc-gen-go-grpc"
[goctl-env]: "protoc-gen-go-grpc" is not found in PATH
[goctl-env]: do you want to install "protoc-gen-go-grpc" [y: YES, n: No]
y
[goctl-env]: preparing to install "protoc-gen-go-grpc"
"protoc-gen-go-grpc" installed from cache
[goctl-env]: "protoc-gen-go-grpc" is already installed in "/Users/keson/go/bin/protoc-gen-go-grpc"

[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.

$ goctl env install --help
Goctl env installation

Usage:
goctl env install [flags]

Flags:
-h, --help help for install


Global Flags:
-f, --force Silent installation of non-existent dependencies
-v, --verbose Enable log output
Parameter field Parameter Type Required? Default value Parameter Description
forcebooleanNOfalseSilent Installing components. If false, each component will eject the installation confirmation option before installing it
verbosebooleanNOfalseExport execution log