From 1da82ae0f070bbed7300a8e9462abeeb0cf3c344 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 1 Aug 2018 19:45:15 +0200 Subject: prog: introduce debugValidate Move debug validation into a separate function. Update #538 --- prog/encodingexec.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'prog/encodingexec.go') diff --git a/prog/encodingexec.go b/prog/encodingexec.go index e67373923..659f4be3f 100644 --- a/prog/encodingexec.go +++ b/prog/encodingexec.go @@ -55,11 +55,7 @@ const ( // Returns number of bytes written to the buffer. // If the provided buffer is too small for the program an error is returned. func (p *Prog) SerializeForExec(buffer []byte) (int, error) { - if debug { - if err := p.validate(); err != nil { - panic(fmt.Errorf("serializing invalid program: %v", err)) - } - } + p.debugValidate() w := &execContext{ target: p.Target, buf: buffer, -- cgit mrf-deployment