Skip to content

Commit 4b88279

Browse files
committed
Improve usage message formatting
1 parent 27fb42d commit 4b88279

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

go/extractor/cli/go-autobuilder/go-autobuilder.go

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,37 @@ import (
2121

2222
func usage() {
2323
fmt.Fprintf(os.Stderr,
24-
`When '--identify-environment' is passed then %s produces a file which specifies what Go
25-
version is needed. The location of this file is controlled by the environment variable
26-
CODEQL_EXTRACTOR_ENVIRONMENT_JSON, or defaults to "environment.json" if that is not set.
27-
28-
When no command line arguments are passed, %[1]s is a wrapper script that installs dependencies and
29-
calls the extractor.
30-
31-
When LGTM_SRC is not set, the script installs dependencies as described below, and then invokes the
32-
extractor in the working directory.
33-
34-
If LGTM_SRC is set, it checks for the presence of the files 'go.mod', 'Gopkg.toml', and
35-
'glide.yaml' to determine how to install dependencies: if a 'Gopkg.toml' file is present, it uses
36-
'dep ensure', if there is a 'glide.yaml' it uses 'glide install', and otherwise 'go get'.
37-
Additionally, unless a 'go.mod' file is detected, it sets up a temporary GOPATH and moves all
38-
source files into a folder corresponding to the package's import path before installing
39-
dependencies.
40-
41-
This behavior can be further customized using environment variables: setting LGTM_INDEX_NEED_GOPATH
42-
to 'false' disables the GOPATH set-up, CODEQL_EXTRACTOR_GO_BUILD_COMMAND (or alternatively
43-
LGTM_INDEX_BUILD_COMMAND), can be set to a newline-separated list of commands to run in order to
44-
install dependencies, and LGTM_INDEX_IMPORT_PATH can be used to override the package import path,
45-
which is otherwise inferred from the SEMMLE_REPO_URL or GITHUB_REPOSITORY environment variables.
46-
47-
In resource-constrained environments, the environment variable CODEQL_EXTRACTOR_GO_MAX_GOROUTINES
48-
(or its legacy alias SEMMLE_MAX_GOROUTINES) can be used to limit the number of parallel goroutines
49-
started by the extractor, which reduces CPU and memory requirements. The default value for this
50-
variable is 32.
24+
`%s is a wrapper script that installs dependencies and calls the extractor
25+
26+
Options:
27+
--identify-environment
28+
Produce an environment file specifying which Go version should be installed in the environment
29+
so that autobuilding will be successful. The location of this file is controlled by the
30+
environment variable CODEQL_EXTRACTOR_ENVIRONMENT_JSON, or defaults to 'environment.json' if
31+
that is not set.
32+
33+
Build behavior:
34+
35+
When LGTM_SRC is not set, the script installs dependencies as described below, and then invokes the
36+
extractor in the working directory.
37+
38+
If LGTM_SRC is set, it checks for the presence of the files 'go.mod', 'Gopkg.toml', and
39+
'glide.yaml' to determine how to install dependencies: if a 'Gopkg.toml' file is present, it uses
40+
'dep ensure', if there is a 'glide.yaml' it uses 'glide install', and otherwise 'go get'.
41+
Additionally, unless a 'go.mod' file is detected, it sets up a temporary GOPATH and moves all
42+
source files into a folder corresponding to the package's import path before installing
43+
dependencies.
44+
45+
This behavior can be further customized using environment variables: setting LGTM_INDEX_NEED_GOPATH
46+
to 'false' disables the GOPATH set-up, CODEQL_EXTRACTOR_GO_BUILD_COMMAND (or alternatively
47+
LGTM_INDEX_BUILD_COMMAND), can be set to a newline-separated list of commands to run in order to
48+
install dependencies, and LGTM_INDEX_IMPORT_PATH can be used to override the package import path,
49+
which is otherwise inferred from the SEMMLE_REPO_URL or GITHUB_REPOSITORY environment variables.
50+
51+
In resource-constrained environments, the environment variable CODEQL_EXTRACTOR_GO_MAX_GOROUTINES
52+
(or its legacy alias SEMMLE_MAX_GOROUTINES) can be used to limit the number of parallel goroutines
53+
started by the extractor, which reduces CPU and memory requirements. The default value for this
54+
variable is 32.
5155
`,
5256
os.Args[0])
5357
fmt.Fprintf(os.Stderr, "Usage:\n\n %s\n", os.Args[0])

0 commit comments

Comments
 (0)