build: modernize with "go fix -minmax": use min and max builtins
This commit is contained in:
+8
-14
@@ -125,13 +125,10 @@ func (o *RangeOption) Decode(size int64) (offset, limit int64) {
|
||||
}
|
||||
} else {
|
||||
if o.End >= 0 {
|
||||
offset = size - o.End
|
||||
if offset < 0 {
|
||||
// RFC 7233 section 2.1: if the suffix-length is
|
||||
// larger than the representation, use the entire
|
||||
// representation.
|
||||
offset = 0
|
||||
}
|
||||
// RFC 7233 section 2.1: if the suffix-length is
|
||||
// larger than the representation, use the entire
|
||||
// representation.
|
||||
offset = max(size-o.End, 0)
|
||||
} else {
|
||||
offset = 0
|
||||
}
|
||||
@@ -168,13 +165,10 @@ func FixRangeOption(options []OpenOption, size int64) {
|
||||
case *RangeOption:
|
||||
// If start is < 0 then fetch from the end
|
||||
if x.Start < 0 {
|
||||
start := size - x.End
|
||||
if start < 0 {
|
||||
// RFC 7233 section 2.1: if the suffix-length is
|
||||
// larger than the representation, use the entire
|
||||
// representation (#6310).
|
||||
start = 0
|
||||
}
|
||||
// RFC 7233 section 2.1: if the suffix-length is
|
||||
// larger than the representation, use the entire
|
||||
// representation (#6310).
|
||||
start := max(size-x.End, 0)
|
||||
x = &RangeOption{Start: start, End: -1}
|
||||
options[i] = x
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user