detects

package
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InDebugging added in v1.6.3

func InDebugging() bool

InDebugging return the status if cmdr was built with debug mode / or the app running under a debugger attached.

To enable the debugger attached mode for cmdr, run `go build` with `-tags=delve` options. eg:

go run -tags=delve ./cli
go build -tags=delve -o my-app ./cli

For Goland, you can enable this under 'Run/Debug Configurations', by adding the following into 'Go tool arguments:'

-tags=delve

InDebugging() is a synonym to IsDebuggerAttached().

NOTE that `isdelve` algor is from https://stackoverflow.com/questions/47879070/how-can-i-see-if-the-goland-debugger-is-running-in-the-program

noinspection GoBoolExpressions

func InDevelopingTime added in v1.6.3

func InDevelopingTime() (status bool)

InDevelopingTime detects whether is in developing time.

If the main program has been built as an executable binary, we would assume which is not in developing time.

If log.GetDebugMode() is true, that's in developing time too.

func InDocker

func InDocker() bool

InDocker detects if the service is running under docker environment.

InDocker test these two conditions: 1. find if `/.dockerenv` exists or not. 2. `docker` in buildtags

func InDockerEnvSimple added in v1.6.3

func InDockerEnvSimple() (status bool)

InDockerEnvSimple detects whether is running within docker container environment.

InDockerEnvSimple finds if `/.dockerenv` exists or not.

func InIstio

func InIstio() bool

InIstio detects if the service is running under istio injected.

IMPORTANT

To make this detector work properly, you must mount a DownwordAPI volume to your container/pod. See also: https://kubernetes.io/en/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/

func InK8s

func InK8s() bool

InK8s detects if the service is running under k8s environment.

func InK8sYN

func InK8sYN() bool

InK8sYN is yet another DetectInK8s impl

func InTesting added in v1.6.3

func InTesting() bool

InTesting detects whether is running under go test mode

func InTestingT added in v1.6.5

func InTestingT(args []string) bool

InTestingT detects whether is running under 'go test' mode

func InTracing added in v1.6.3

func InTracing() bool

func IsDebuggerAttached added in v1.6.3

func IsDebuggerAttached() bool

IsDebuggerAttached return the status if cmdr was built with debug mode / or the app running under a debugger attached.

To enable the debugger attached mode for cmdr, run `go build` with `-tags=delve` options. eg:

go run -tags=delve ./cli
go build -tags=delve -o my-app ./cli

For Goland, you can enable this under 'Run/Debug Configurations', by adding the following into 'Go tool arguments:'

-tags=delve

IsDebuggerAttached() is a synonym to InDebugging().

NOTE that `isdelve` algor is from https://stackoverflow.com/questions/47879070/how-can-i-see-if-the-goland-debugger-is-running-in-the-program

noinspection GoBoolExpressions

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL