Skip to content

Commit 406fb1e

Browse files
committed
Update with Go custom build options
1 parent 9b0c24a commit 406fb1e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

docs/codeql/codeql-cli/creating-codeql-databases.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,14 @@ build steps, you may need to explicitly define each step in the command line.
165165

166166
.. pull-quote:: Creating databases for Go
167167

168-
For Go, you should always use the CodeQL autobuilder. Install the Go
169-
toolchain (version 1.11 or later) and, if there are dependencies, the
170-
appropriate dependency manager (such as `dep
168+
For Go, install the Go toolchain (version 1.11 or later) and, if there
169+
are dependencies, the appropriate dependency manager (such as `dep
171170
<https://golang.github.io/dep/>`__).
172171

173-
Do not specify any build commands, as you will override the autobuilder
174-
invocation, which will create an empty database.
172+
The Go autobuilder attempts to automatically detect Go code in a repository,
173+
and only runs build scripts in an attempt to fetch dependencies. To force
174+
CodeQL to use your build script, set the environment variable
175+
`CODEQL_EXTRACTOR_GO_BUILD_TRACING=on` or pass a command.
175176

176177
Specifying build commands
177178
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -200,6 +201,10 @@ commands that you can specify for compiled languages.
200201

201202
codeql database create csharp-database --language=csharp --command='dotnet build /p:UseSharedCompilation=false /t:rebuild'
202203

204+
- Go project built using a custom build script::
205+
206+
CODEQL_EXTRACTOR_GO_BUILD_TRACING=on codeql database create go-database --language=go --command='./scripts/build.sh'
207+
203208
- Java project built using Gradle::
204209

205210
codeql database create java-database --language=java --command='gradle clean test'

0 commit comments

Comments
 (0)