Gobra is a prototype verifier for Go programs, based on the Viper verification infrastructure.
We call annotated Go programs Gobra programs and use the file extension .gobra
for them. A tutorial can be found in docs/tutorial.md
. More examples can be found in src/test/resources
.
- Java 64-Bit (tested with version 11 and 15)
- SBT (tested with version 1.4.4)
- Git
- Install Z3 and Boogie.
Steps (iii) and (iv) are specific to Boogie and only necessary when using Carbon as verification backend. Gobra uses the Silicon verification backend by default.
- Get a Z3 executable. A precompiled executable can be downloaded here. We tested version 4.8.7 64-Bit.
- Set the environment variable
Z3_EXE
to the path of your Z3 executable. - Get a Boogie executable. Instructions for compilation are given here. Mono is required on Linux and macOS to run Boogie. Alternatively, extract a compiled version from the Viper release tools (Windows, Linux, macOS).
- Set the environment variable
BOOGIE_EXE
to the path of your Boogie executable.
- Clone
gobra
(this repository) in your computer. - Change directory to the
gobra
directory created in the previous step. - Run
git submodule update --init --recursive
to fetchviperserver
and its transitive dependencies (carbon
,silicon
andsilver
). - Run
sbt compile
to compile Gobra.
The command sbt assembly
can also be used to produce a fat jar file, which is located by default in target/scala
.
Gobra can be run either from sbt or from a compiled jar:
- running from sbt:
- change directory to the
gobra
directory obtained from cloning this repository. - run
sbt
. - inside the sbt shell, run
run - i path/to/file
(e.g.,run -i src/test/resources/regressions/examples/swap.gobra
)
- change directory to the
- running from a compiled jar:
- run
java -jar -Xss128m path/to/gobra.jar -i path/to/file
.
- run
More information about the available options in Gobra can be found by running run --help
in an sbt shell or java -jar path/to/gobra.jar --help
if you assembled Gobra.
In the gobra
directory, run the command sbt test
.
Most Gobra sources are licensed under the Mozilla Public License Version 2.0.
The LICENSE lists the exceptions to this rule.
Note that source files (whenever possible) should list their license in a short header.
Continuous integration checks these file headers.
The same checks can be performed locally by running npx github:viperproject/check-license-header#v1 check --config .github/license-check/config.json --strict
in this repository's root directory.
Do you still have questions? Open an issue or contact us on Zulip.