Go command-line options

The following table describes the command-line options that are specifically for translating Go code.

Go option Description
-gotags <go_build_tags>

Specifies a comma-separated list of custom build tags for a Go project. This is equivalent to the -tags option for the go command. For more information, see Including custom Go build tags.

Equivalent property name:
com.fortify.sca.gotags

-gopath <dir>

Specifies the value of the GOPATH environment variable to use for translating a Go project. If this option is not specified, then OpenText SAST uses the existing value of the GOPATH system environment variable.

You must specify the gopath directory as an absolute path. The following examples show valid values for <dir>:

/home/projects/go_workspace/my_proj
C:\projects\go_workspace\my_proj

The following example is an invalid value for <dir>:

go_workspace/my_proj

If this option and the GOPATH system environment variable is not set, then the gopath defaults to a subdirectory named go in the user's home directory ($HOME/go on Linux and %USERPROFILE%\go on Windows), unless that directory contains a Go distribution.

When using modules, the GOPATH environment variable is not required to resolve package imports. However, GOPATH still determines the output directory to use when downloading missing module dependencies.

Note: OpenText SAST does not fully support older Go projects that rely solely on the GOPATH environment variable to resolve package imports.

Equivalent property name:
com.fortify.sca.GOPATH

-goroot <dir>

Specifies the location of the Go installation. If this option is not specified, the GOROOT system environment variable is used.

If this option is not specified and the GOROOT system environment variable is not set, then OpenText SAST uses the Go compiler included in the OpenText SAST installation.

Equivalent property name:
com.fortify.sca.GOROOT

-goproxy <url>

Specifies one or more comma-separated proxy URLs. You can also specify direct or off (to disable network usage).

If this option is not specified and the GOPROXY system environment variable is not set, then OpenText SAST uses https://proxy.golang.org,direct.

Equivalent property name:
com.fortify.sca.GOPROXY 

See also

Go properties