mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Patch a bug in obiseq.GetSlice
Former-commit-id: ab1a49c3d9bf19585e36842ecc15fa17afbcbf57
This commit is contained in:
@ -36,21 +36,20 @@ func GetSlice(capacity int) []byte {
|
||||
}
|
||||
|
||||
if p == nil || *p == nil || cap(*p) < capacity {
|
||||
s := make([]byte, 0, capacity)
|
||||
p = &s
|
||||
return make([]byte, 0, capacity)
|
||||
}
|
||||
|
||||
s := *p
|
||||
|
||||
if cap(s) < capacity {
|
||||
log.Panicln("Bizarre... j'aurai pourtant cru")
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func CopySlice(src []byte) []byte {
|
||||
sl := GetSlice(len(src))
|
||||
|
||||
if cap(sl) < len(src) {
|
||||
log.Panicln("Bizarre... j'aurai pourtant cru")
|
||||
}
|
||||
|
||||
sl = sl[0:len(src)]
|
||||
|
||||
copy(sl, src)
|
||||
|
Reference in New Issue
Block a user