Golang Assert

From Adam Colton
Revision as of 13:46, 26 April 2018 by Adamcolton (talk | contribs)
Jump to navigation Jump to search

Inspired by this, include assert statements in Go. Something (as part of the build chain) will attempt to prove (as in mathematically prove) that the asserts are true. I really have no idea how to approach this.

To be clear, these assertions are stripped out by the compiler, they are not run-time assertions.

Syntax

Comment

 x := y+10
 // Assert: x > y

Const

 x := y+10
 const assert(x > y)

package

 import "assert"
 x := y+10
 assert.True(x > y)