{"repo":"jordanlewis/gcassert","free":true,"listed":false,"github":"https://github.com/jordanlewis/gcassert","clone":"git clone https://github.com/jordanlewis/gcassert.git","description":"Assert your Go code is inlined and bounds-check eliminated","language":"Go","stars":316,"topics":["go","golang"],"license":"MIT","category":"dev-tools","readme_excerpt":"gcassert gcassert is a program for making assertions about compiler decisions in Go programs, via inline comment directives like //gcassert:inline . Currently supported directives: - //gcassert:inline to assert function callsites are inlined - //gcassert:bce to assert bounds checks are eliminated - //gcassert:noescape to assert variables don't escape to the heap Example Given a file foo.go : The inline //gcassert directive will cause gcassert to fail if the line sum += addOne(ints[i]) is either not inlined or contains bounds checks. A //gcassert:inline directive on a function will cause gcassert to fail if any of the callers of that function do not get inlined. //gcassert comments expect a comma-separated list of directives after //gcassert: . They can be included above the line in question or after, as an inline comment. Installation To get the gcassert binary: To get the gcassert library: Usage As a binary Run gcassert on packages containing gcassert directives, like this: The program will output all lines that had a gcassert directive that wasn't respected by the compiler. For example, running on the testdata directory in this library will produce the following output: Inspecting each of the listed lines will show a //gcassert directive that wasn't upheld when running the compiler on the package. As a library gcassert is runnable as a library as well, for integration into your linter suite. It has a single package function, gcassert.GCAssert . To use it, pass in an io.Writ","default_branch":null,"files":null,"tree":[],"storefront":"/r/jordanlewis","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/jordanlewis/gcassert/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}