Skip to content

Commit d322132

Browse files
authored
Merge pull request #88 from viperproject/support-for-go-programs
Verification of Packages
2 parents e54fd7c + e40aa06 commit d322132

23 files changed

+1975
-663
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ jobs:
3434
runs-on: ubuntu-latest
3535
container: gobraverifier/gobra-base:v5_z3_4.8.7
3636
env:
37-
SILVER_REF: "v.21.07-release"
38-
SILICON_REF: "v.21.07-release"
39-
CARBON_REF: "v.21.07-release"
4037
VIPERSERVER_REF: "v.21.07-release"
4138
steps:
4239
- name: Checkout Gobra-IDE
@@ -50,6 +47,14 @@ jobs:
5047
with:
5148
repository: viperproject/gobra
5249
path: gobra
50+
- name: Get dependency versions
51+
shell: bash
52+
run: |
53+
source viper-toolchain-versions.sh
54+
echo "SILVER_REF=$SILVER_REF" >> $GITHUB_ENV
55+
echo "CARBON_REF=$CARBON_REF" >> $GITHUB_ENV
56+
echo "SILICON_REF=$SILICON_REF" >> $GITHUB_ENV
57+
working-directory: gobra
5358
- name: Checkout Silver
5459
uses: actions/checkout@v2
5560
with:

client/LICENSE

Lines changed: 393 additions & 0 deletions
Large diffs are not rendered by default.

client/README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,27 @@ Any Gobra program can be converted to a Go program and back by running the comma
3131
This extension caches verification results by default.
3232
The cache can be flushed by running the command `Gobra: Flush ViperServer cache` from the command palette.
3333

34+
### Verification of Packages
35+
A package can be split across multiple `.go` or `.gobra` files.
36+
To verify them together, run the command `Gobra: Verify currently opened package` while having one of these files open.
37+
Alternatively, there is the `Gobra: Verify currently opened file or package` command that either verifies a single file or a package depending on your Gobra settings.
38+
39+
Also relevant when working with larger projects is the option to specify directories in which Gobra tries to resolve imports and a module name.
40+
Include directories can be specified in the settings as `gobraSettings.includeDirs`.
41+
Gobra has partial support for modules meaning that the current module name can be specified in the settings as `gobraSettings.moduleName`.
42+
Importing a package in the current module amounts to an import path consisting of the module name and the relative path to the desired package.
43+
When resolving such an import, Gobra simply drops the module name prefix.
44+
However, there is currently no dedicated support for resolving packages in external modules.
45+
This means that Gobra tries to resolve such packages by searching for a sub-directory with the external module name in the specified list of include directories.
46+
47+
Note that VSCode allows workspace-specific settings by creating the file `.vscode/settings.json` relative to the root of a workspace.
48+
These workspace-specific settings take precendence over the usual user settings.
49+
3450
### Show Intermediate Representations
3551
Right clicking on some selected code in a Gobra program reveals two actions, "Show internal representation preview" and "Show Viper code preview".
3652
Both actions result in a preview, on the right-hand side, of the internal representation used by Gobra and the resulting code in the Viper intermediate language, respectively.
3753
The translated parts of the selected code are marked in green.
3854

39-
## Limitations
40-
Gobra IDE currently only supports verification of single files.
41-
Other files located in the same folder are ignored.
42-
Furthermore, it is at the moment not possible to configure Gobra IDE to consider other directories than specified in the `GOPATH` environment variable when importing packages.
43-
4455
## Requirements
4556
- [Java JDK, 64 bit, version 1.8 or later](https://www.java.com/en/download/)
4657

0 commit comments

Comments
 (0)