{"id":20910107,"url":"https://github.com/viperproject/gorac","last_synced_at":"2026-04-20T21:31:29.427Z","repository":{"id":83592019,"uuid":"317908482","full_name":"viperproject/gorac","owner":"viperproject","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-09T14:35:51.000Z","size":504,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2026-02-02T17:12:15.234Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/viperproject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-02T15:38:47.000Z","updated_at":"2024-04-06T13:02:57.000Z","dependencies_parsed_at":"2023-07-07T22:01:02.511Z","dependency_job_id":null,"html_url":"https://github.com/viperproject/gorac","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/viperproject/gorac","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fgorac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fgorac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fgorac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fgorac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viperproject","download_url":"https://codeload.github.com/viperproject/gorac/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fgorac/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32067248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T21:26:33.338Z","status":"ssl_error","status_checked_at":"2026-04-20T21:26:22.081Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T14:13:55.841Z","updated_at":"2026-04-20T21:31:29.404Z","avatar_url":"https://github.com/viperproject.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoRAC \n\nGoRAC (**Go** **R**untime **A**ssertion **C**hecker) is a command line tool that generates runtime assertion checks for a Go program that is annotated with a specification. GoRAC supports the following specification constructs: assert statements, assumptions, loop invariants, pre- and postconditions, quantifiers, predicates, old expressions, access permissions, and purity annotations.\n\n## Installation \n\nGoRAC is written in Go. Therefore, Go needs to be installed. GoRAC uses a patched version of `go/ast`. Since the [patch](https://github.com/golang/go/issues/39753) is not yet merged into the standard Go library (scheduled for the Go 1.17 release), you need to install a custom version of Go as described below. \n\nThe following steps will guide you through the installation of the modified Go version and enable you to run GoRAC.\n\n#### Prerequisites\n\nIn order to compile the modified Go version, you already require an official Go release. Therefore, please [download](https://golang.org/dl/) a binary release of Go and follow the official [installation instructions](https://golang.org/doc/install).\n\nIf you have [git](https://git-scm.com/) installed, obtain the modified Go version for GoRAC by cloning the following [Github repository](https://github.com/ec-m/go). Please note that the cloned directory should not be called `go/` in order to avoid clashes with existing Go versions.\n\n```\n$ git clone git@github.com:ec-m/go.git goroot\n``` \n\nOtherwise you can [download](https://github.com/ec-m/go/archive/master.zip) the sources as a zip file and unpack it in your preferred installation directory that is named anything else but `go/`.\n\n#### Compiling Go\n\nNavigate to the source folder of the cloned or unzipped directory\n\n```\n$ cd goroot/src\n```\n\nand run \n\n```\n$ ./all.bash\n```\n\nor for Windows `all.bat`. \n\nIf the installation was successful, you should see the message `ALL TESTS PASSED [...]`. In case something goes wrong, please consult the official instructions for [installing Go from source](https://golang.org/doc/install/source).\n\n#### Adding to PATH\n\nAdd the custom Go installation to the PATH environment variable.\n\n```\n$ export PATH=$PATH:/path/to/goroot/bin\n``` \n\n#### Setting GOROOT\n\nSet the environment variable `GOROOT` to the folder the modified Go version was installed in.\n\n``` \n$ export GOROOT=/path/to/goroot\n```\n\nIn case you use [JetBrains Goland IDE](https://www.jetbrains.com/go/) you can follow [these instructions](https://www.jetbrains.com/help/go/configuring-goroot-and-gopath.html) to adjust `GOROOT`.\n\n#### Building GoRAC\n\nClone or download the [GoRAC](https://github.com/viperproject/gorac) source files.\n \n```\n$ git clone git@github.com:viperproject/gorac.git\n```\n\nOpen the folder containing the Go files of the command line tool and build GoRAC.\n\n```\n$ cd gorac/cmd/gorac\n$ go build .\n```\n\nThis should create an executable called `gorac` in the same directory. \nYou can now test the installation by executing the unit tests or use GoRAC as described below.\n\n#### Parser development\n\nThe following steps only need to be taken, if you want to change the implementation of the specification parser used by GoRAC.\n\n[Download](https://www.antlr.org/download.html) and [install](https://github.com/antlr/antlr4/blob/master/doc/getting-started.md) ANTLR v4.\nYou can find the files of the specification parser under\n\n``` \n$ cd gorac/pkg/specparser\n```\n\nwhere `SpecGrammar.g4` defines the grammar of GoRAC specifications. In order to generate lexer \nand parser source files for the grammar execute\n\n```\n$ antlr4 -Dlanguage=Go -o . -package specparser -visitor SpecGrammar.g4\n```\n\n## Usage\n\n#### Adding specification \n\nSpecification can be added to Go files as comments starting with `//@` for single line and `/*@ ... @*/` for multiline comments.\nThe following file shows an example Go program that includes specification for a function computing the sum over all natural numbers (including 0) up until some given `n`.\n\n```Go\npackage main \n\n//@ requires n \u003e= 0\n//@ ensures res == n * (n + 1) / 2\nfunc sum(n int) (res int) {\n\tres = 0 \n\ti := 0 // not a specification comment\n\n\t/*@\n\tinvariant i \u003c= n + 1\n\tinvariant res == i * (i - 1) / 2\n\t@*/\n\tfor i \u003c= n {\n\t\tres += i\n\t\ti++\n\t}\n\n\t//@ assert i == n + 1\n\treturn\n}\n```\n\nPlease consult the [documentation](./doc/specificationlanguage.pdf) for further information on the specification language of GoRAC.\n\n#### Running GoRAC\n\nAssuming the file containing the example program from above is called `sum.go`, you can execute GoRAC on this file\n\n```\n$ cd gorac/cmd/gorac\n$ ./gorac -file=sum.go ...\n```\n\nwhere `...` can be replaced with more command line flags. This creates the file `sum_rac.go` that contains the original Go program with runtime assertion checks for the provided specification. The generated program `sum_rac.go` can now be run with different inputs to check whether the assertions hold for these executions.\n\nTo see all available configuration options of GoRAC, execute\n\n```\n$ ./gorac -help\n```\n\n## Testing \n\n\n#### Unit tests \n\nSeveral unit tests are implemented in order to provide a solid testing coverage for all GoRAC and specification parser functions.\nAll unit tests can be run at once with \n\n```\n$ cd gorac\n$ go test ./...\n```\n\n## License\n\nAll rights are reserved for [ETH Zurich](https://ethz.ch/de.html) represented by Prof. Peter Müller, [Programming Methodology Group](https://www.pm.inf.ethz.ch/).\n\nThis project is licensed under the [Mozilla Public License Version 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviperproject%2Fgorac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviperproject%2Fgorac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviperproject%2Fgorac/lists"}