Hi Dan, I am trying to cross-compile a program that uses
biogo/hts/sam. Unchanged, I got lots of errors like:
--> windows/386 error: exit status 2
Stderr: #
github.com/biogo/hts/sam
../../biogo/hts/sam/auxtags.go:75: constant 4294967295 overflows int
../../biogo/hts/sam/auxtags.go:150: constant 4294967295 overflows int
If I make the change below, the cross-compilation appears to go
smoothly. Would you accept a pull request for this?
thanks,
-Brent
diff --git a/sam/auxtags.go b/sam/auxtags.go
index b8d1cef..53f76ae 100644
--- a/sam/auxtags.go
+++ b/sam/auxtags.go
@@ -72,7 +72,7 @@ func NewAux(t Tag, typ byte, value interface{}) (Aux, error) {
a = Aux{t[0], t[1], 'I', 0, 0, 0, 0, 0}
binary.LittleEndian.PutUint32(a[4:8], uint32(i))
default:
- return nil, fmt.Errorf("sam: unsigned
integer value out of range %d > %d", i, math.MaxUint32)
+ return nil, fmt.Errorf("sam: unsigned
integer value out of range %d > %d", i, uint32(math.MaxU
}
return a, nil
case int8:
@@ -147,7 +147,7 @@ func NewAux(t Tag, typ byte, value interface{})
(Aux, error) {
return nil, fmt.Errorf("sam: wrong dynamic
type %T for 'B' tag", value)
}
l := rv.Len()
- if l > math.MaxUint32 {
+ if uint32(l) > uint32(math.MaxUint32) {
return nil, fmt.Errorf("sam: array too long
for 'B' tag")
}
a := Aux{t[0], t[1], 'B', 0, 0, 0, 0, 0}