diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-08-01 19:45:15 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-08-02 16:57:31 +0200 |
| commit | 1da82ae0f070bbed7300a8e9462abeeb0cf3c344 (patch) | |
| tree | e42ef3d6c468255729aadb06e27fb0c024054525 /prog/encodingexec.go | |
| parent | c8643744fe4be55e516f7ba494777016abc1055e (diff) | |
prog: introduce debugValidate
Move debug validation into a separate function.
Update #538
Diffstat (limited to 'prog/encodingexec.go')
| -rw-r--r-- | prog/encodingexec.go | 6 |
1 files changed, 1 insertions, 5 deletions
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, |
