google / google/gopacket

Maybe it should not panic in method PrependBytes or AppendBytes

Open
#673 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

In those two function, if we do this
```
if num < 0 {
panic("num < 0")
}
```
And if invoker use num=-1 to invoke those function,
it can not get any error message. So i think maybe
```
if num < 0 {
return errors.New("length less than zero")
}
```
is more reasonable.

https://github.com/google/gopacket/blob/836b571ec913f74022809b997ad331ebbf1033d9/writer.go#L139-L178

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.