Toolchain verifies Go

Gobra

Add specifications as comments to Go code; Gobra translates it to the Viper verifier, which proves memory safety, race freedom and your contracts.

Stage 1 · Usable Auto-active Open source · MPL-2.0 v26.09 · 44 days ago
Trust: Checker partial, Semantics weak, Frontend partial, Binary gap weak, Escape hatches partial CheckerSemanticsFrontendBinary gapEscape hatches 0 of 5 strong, 2 weak

Use it if

  • You want to prove memory safety, absence of crashes and data races, and functional properties of Go code.
  • Your code uses goroutines, channels or sync.Mutex and you can describe what each goroutine owns.
  • You need to prove that secrets do not leak, using Gobra's hyperproperty mode.

Look elsewhere if

  • You cannot add annotations for heap permissions; Gobra needs them for every pointer access.
  • You rely on integer wrap-around; overflow is only checked with the --overflow flag, and without it Gobra treats integers as unbounded.
  • Your code depends on many standard-library packages; only a few have specifications.

How it works

From your code to an accepted proof. Each step either has to be trusted or is checked by something else.

  1. Input
    Go code
  2. Front end
    Gobra's own Go parser and type checker (ANTLR grammar) Trusted Annotations live in // @ comments, so the same files still build with the normal Go compiler.
  3. Translation
    Gobra encoding of Go into the Viper intermediate language Trusted
  4. Translation
    Viper back end (Silicon symbolic execution by default; Carbon via Boogie as an option) Trusted
  5. Checker
    Z3 Trusted
  6. Compiler
    gc (the Go compiler) Trusted

Verified or checked: outside the trusted base Validated per run or by tests Trusted without proof

  • Go: Gobra supports many Go features but not all; strings and some integer types such as rune have very limited support.

Trust

What a proof from this toolchain relies on: the trusted computing baseTrusted computing base (TCB). Everything that must be correct for a proof to mean what it says., one part at a time. How these are rated.

  1. Checker What has the final word on a proof?
    Partial

    Viper's symbolic execution engine and the Z3 SMT solver decide; no proof certificates.

    source

  2. Semantics Is the tool's model of the language the real language?
    Weak

    Go model built into Gobra; ignores integer overflow unless --overflow is set.

    By default Gobra does not check for integer overflow, and the bounds of Go's integer types are only added by the --overflow transformation. Without the flag, a proof can therefore hold for mathematical integers but not for a real Go run in which a value overflows and wraps around. With the flag, overflow is reported as an error. Otherwise the encoding is tested by Gobra's regression suite.

    source

  3. Frontend How does your source get into the model?
    Partial

    Gobra's own Go parser and type checker, not the Go compiler's front end.

    source

  4. Binary gap Does the proof cover what actually runs?
    Weak

    The binary comes from the Go compiler, which is not verified.

  5. Escape hatches Can a proof silently rest on unchecked assumptions?
    Partial

    assume, trusted functions and bodiless functions are accepted; found by searching.

    Functions marked trusted or written without a body are assumed to meet their specification. Library stubs are also assumed.

    source

What it can prove

Kinds of guarantees, not how easy they are to get.

Properties
FeatureSupportNotes
No undefined behavior Memory safety and absence of runtime errors: no out-of-bounds access, use-after-free, overflow traps, panics or undefined behavior on any input allowed by the precondition. PartialPartial.Proves memory safety (through permissions) and absence of runtime errors such as nil dereference and out-of-bounds access. Integer overflow is only checked with --overflow, which is off by default.
Source
Proves memory safety (through permissions) and absence of runtime errors such as nil dereference and out-of-bounds access. Integer overflow is only checked with --overflow, which is off by default. source
Functional correctness The code meets a written specification of its results, for example “returns the sorted list” or “implements this RFC”. SupportedSupported.Pre- and postconditions, predicates, ghost code and pure functions.
Source
Pre- and postconditions, predicates, ghost code and pure functions. source
Equivalence Two programs (an optimized and a reference version, or code before and after a change) are proved to behave the same, or one refines the other. PartialPartial.No dedicated equivalence mode. The hyperproperty mode relates two runs of the same program, but comparing two different versions needs a hand-written specification. No dedicated equivalence mode. The hyperproperty mode relates two runs of the same program, but comparing two different versions needs a hand-written specification.
Information flow Secrets do not influence public outputs, timing or memory access patterns (constant-time code, non-interference). SupportedSupported.A hyperproperty mode (--hyperMode, off by default) proves that secret (non-low) data does not affect public outputs, with a declassify statement for intended releases.
Source
A hyperproperty mode (--hyperMode, off by default) proves that secret (non-low) data does not affect public outputs, with a declassify statement for intended releases. source
Concurrency Correctness of code with threads or shared memory: absence of data races, deadlock freedom, linearizability of concurrent data structures. PartialPartial.Proves freedom from data races and properties of messages sent over channels and data guarded by locks. The tutorial does not cover deadlock freedom.
Source
Proves freedom from data races and properties of messages sent over channels and data guarded by locks. The tutorial does not cover deadlock freedom. source
Termination and liveness Every run finishes, or the system keeps making progress (liveness). SupportedSupported.Termination is proved with decreases clauses. It is required for pure and ghost functions and optional for other code.
Source
Termination is proved with decreases clauses. It is required for pure and ghost functions and optional for other code. source

Language coverage

Which parts of Go it handles. Hover or focus a mark for details.

Common features

Common features
FeatureSupportNotes
Machine integers Fixed-width integer arithmetic, overflow and bit operations. PartialPartial.Without --overflow (the default) Gobra treats bounded integers as mathematical integers, so it neither checks overflow nor models wrap-around. The tutorial also says support for some integer types such as rune is very limited.
Source
Without --overflow (the default) Gobra treats bounded integers as mathematical integers, so it neither checks overflow nor models wrap-around. The tutorial also says support for some integer types such as rune is very limited. source
Floating point IEEE 754 floating-point arithmetic, including rounding and NaNs. PartialPartial.Basic float32/float64 arithmetic appears in the regression tests; how closely IEEE 754 is modeled is not documented.
Source
Basic float32/float64 arithmetic appears in the regression tests; how closely IEEE 754 is modeled is not documented. source
Heap and pointers Dynamically allocated memory, pointers or references, and aliasing. SupportedSupported.Pointers and heap access use permissions (acc predicates), including fractional and quantified permissions.
Source
Pointers and heap access use permissions (acc predicates), including fractional and quantified permissions. source
Arrays and buffers Indexed memory such as arrays, slices, vectors and byte buffers. SupportedSupported.Arrays and slices are supported.
Source
Arrays and slices are supported. source
Loops Unbounded loops, which need invariants or bounds to verify. SupportedSupported.Loop invariants; decreases clauses for termination.
Source
Loop invariants; decreases clauses for termination. source
Recursion Functions that call themselves, directly or through others. SupportedSupported.
Source
source
Higher-order code Function pointers, closures and callbacks. SupportedSupported.Closures are specified with specification types and proved to satisfy them.
Source
Closures are specified with specification types and proved to satisfy them. source
Threads and shared memory Concurrent threads with locks, atomics or message passing. SupportedSupported.Goroutines, channels and sync.Mutex, with permissions passed between goroutines.
Source
Goroutines, channels and sync.Mutex, with permissions passed between goroutines. source
I/O and system calls Files, network, system calls and foreign-function calls. PartialPartial.Some packages (for example net, fmt, time) have trusted specification stubs; other I/O needs hand-written specifications.
Source
Some packages (for example net, fmt, time) have trusted specification stubs; other I/O needs hand-written specifications. source
Standard library Specifications or models for the language's standard library. PartialPartial.Specification stubs exist for a few packages (bytes, encoding/binary, errors, fmt, net, strconv, strings, sync, time); they are assumed, not verified.
Source
Specification stubs exist for a few packages (bytes, encoding/binary, errors, fmt, net, strconv, strings, sync, time); they are assumed, not verified. source

Go-specific features

Go-specific features
FeatureSupportNotes
Goroutines and channels Lightweight threads communicating over channels. SupportedSupported.go statements and channels are verified with predicates that say which permissions travel with each message.
Source
go statements and channels are verified with predicates that say which permissions travel with each message. source
Interfaces Interface types and dynamic dispatch. SupportedSupported.Interfaces with specifications and implementation proofs. Gobra tracks whether interface values are comparable, because comparing incomparable values panics in Go.
Source
Interfaces with specifications and implementation proofs. Gobra tracks whether interface values are comparable, because comparing incomparable values panics in Go. source
Slices and maps Built-in slices and hash maps. SupportedSupported.Slices and maps are covered by the regression suite.
Source
Slices and maps are covered by the regression suite. source
defer, panic and recover Deferred calls and panic recovery. PartialPartial.defer is supported (regression tests); support for panic and recover is not documented.
Source
defer is supported (regression tests); support for panic and recover is not documented. source

Stage

Computed from the evidence below; see the criteria. 2criteria are missing for Stage 2.

Stage 0 Research Met
  • Met: Publicly available evidence
  • Met: At least one published verification uses it Formal verification of the SCION border router's Go implementation (VerifiedSCION). evidence
Stage 1 Usable Met
  • Met: Released or updated in the last 12 months Latest release: v26.09, 2026-10-13. evidence
  • Met: Installs and runs on current platforms Built from source with sbt and Java; needs Z3 (CI uses Z3 4.16.0). Releases are tagged about twice a year. evidence
  • Met: User documentation or tutorial evidence
  • Met: Used by a group other than its authors Engineers from Amazon Web Services, with ETH Zurich, used Gobra on a 100k+ line production Go codebase (Diodon). evidence
Stage 2 Production Next
  • Not met: Verified code in production at two or more independent organizations None recorded.
  • Met: Checker axis is not red
  • Not met: Semantics axis is not red
  • Met: Public channel for soundness bugs Public GitHub issues with a "soundness" label. evidence

In use

Verified code in production, and notable verification projects.

Facts and sources

Effort
Auto-active: You write specifications and hints; a solver does the proving.
Licence
Open source, MPL-2.0 (with listed exceptions)
Maintained by
ETH Zurich (Programming Methodology group)
Latest release
v26.09 (13 Oct 2026) source
Last checked
26 Nov 2026

Further sources

esc