diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index cc04184..473c58d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - go-version: [1.21.x, 1.22.x] + go-version: [1.23.x] os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} @@ -37,7 +37,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.22.x + go-version: 1.23.x - name: Checkout code uses: actions/checkout@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b20a7b..8e60fc6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: name: Set up Go uses: actions/setup-go@v1 with: - go-version: 1.22.x + go-version: 1.23.x - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 diff --git a/.github/workflows/vulncheck.yml b/.github/workflows/vulncheck.yml index ea7d308..b7525a9 100644 --- a/.github/workflows/vulncheck.yml +++ b/.github/workflows/vulncheck.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: [ 1.22.x ] + go-version: [ 1.23.x ] steps: - name: Check out code into the Go module directory uses: actions/checkout@v3 diff --git a/cli/client.go b/cli/client.go index b90bdb9..fbb7bdc 100644 --- a/cli/client.go +++ b/cli/client.go @@ -105,16 +105,16 @@ func newClient(ctx *cli.Context) func() (cl *minio.Client, done func()) { } } find := func() int { - min := math.MaxInt32 + minSize := math.MaxInt32 for _, n := range running { - if n < min { - min = n + if n < minSize { + minSize = n } } earliest := time.Now().Add(time.Second) earliestIdx := 0 for i, n := range running { - if n == min { + if n == minSize { if lastFinished[i].Before(earliest) { earliest = lastFinished[i] earliestIdx = i diff --git a/go.mod b/go.mod index 06a5a4b..612b532 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/minio/warp -go 1.21 +go 1.23 require ( github.com/bygui86/multi-profile/v2 v2.1.0 diff --git a/pkg/bench/ops.go b/pkg/bench/ops.go index 6f4551b..e036122 100644 --- a/pkg/bench/ops.go +++ b/pkg/bench/ops.go @@ -560,22 +560,22 @@ func (o Operations) MultipleSizes() bool { } // MinMaxSize returns the minimum and maximum operation sizes. -func (o Operations) MinMaxSize() (min, max int64) { +func (o Operations) MinMaxSize() (minSize, maxSize int64) { if len(o) == 0 { return 0, 0 } - min = o[0].Size - max = o[0].Size + minSize = o[0].Size + maxSize = o[0].Size for _, op := range o { - if op.Size < min { - min = op.Size + if op.Size < minSize { + minSize = op.Size } - if op.Size > max { - max = op.Size + if op.Size > maxSize { + maxSize = op.Size } } - return min, max + return minSize, maxSize } // AvgSize returns the average operation size. @@ -672,18 +672,18 @@ var log10ToLog2Size = map[int]int64{ } func (o Operations) SingleSizeSegment() SizeSegment { - min, max := o.MinMaxSize() + minSize, maxSize := o.MinMaxSize() var minL10, maxL10 int - for min > log10ToLog2Size[minL10+1] { + for minSize > log10ToLog2Size[minL10+1] { minL10++ } - for max >= log10ToLog2Size[maxL10] { + for maxSize >= log10ToLog2Size[maxL10] { maxL10++ } return SizeSegment{ - Smallest: min, + Smallest: minSize, SmallestLog10: minL10, - Biggest: max, + Biggest: maxSize, BiggestLog10: maxL10, Ops: o, } diff --git a/pkg/generator/csv.go b/pkg/generator/csv.go index c613445..ca4e397 100644 --- a/pkg/generator/csv.go +++ b/pkg/generator/csv.go @@ -68,9 +68,9 @@ func (o CsvOpts) Comma(c byte) CsvOpts { } // FieldLen sets the length of each field. -func (o CsvOpts) FieldLen(min, max int) CsvOpts { - o.minLen = min - o.maxLen = max +func (o CsvOpts) FieldLen(minSize, maxSize int) CsvOpts { + o.minLen = minSize + o.maxLen = maxSize return o } diff --git a/pkg/generator/generator.go b/pkg/generator/generator.go index 898d532..ead7ae0 100644 --- a/pkg/generator/generator.go +++ b/pkg/generator/generator.go @@ -176,24 +176,24 @@ func randASCIIBytes(dst []byte, rng *rand.Rand) { // GetExpRandSize will return an exponential random size from 1 to and including max. // Minimum size: 127 bytes, max scale is 256 times smaller than max size. // Average size will be max_size * 0.179151. -func GetExpRandSize(rng *rand.Rand, min, max int64) int64 { - if max-min < 10 { - if max-min <= 0 { +func GetExpRandSize(rng *rand.Rand, minSize, maxSize int64) int64 { + if maxSize-minSize < 10 { + if maxSize-minSize <= 0 { return 0 } - return 1 + min + rng.Int63n(max-min) + return 1 + minSize + rng.Int63n(maxSize-minSize) } - logSizeMax := math.Log2(float64(max - 1)) - logSizeMin := math.Max(7, logSizeMax-8) - if min > 0 { - logSizeMin = math.Log2(float64(min - 1)) + logSizeMaxSize := math.Log2(float64(maxSize - 1)) + logSizeMinSize := math.Max(7, logSizeMaxSize-8) + if minSize > 0 { + logSizeMinSize = math.Log2(float64(minSize - 1)) } - lsDelta := logSizeMax - logSizeMin + lsDelta := logSizeMaxSize - logSizeMinSize random := rng.Float64() logSize := random * lsDelta if logSize > 1 { - return 1 + int64(math.Pow(2, logSize+logSizeMin)) + return 1 + int64(math.Pow(2, logSize+logSizeMinSize)) } // For lowest part, do equal distribution - return 1 + min + int64(random*math.Pow(2, logSizeMin+1)) + return 1 + minSize + int64(random*math.Pow(2, logSizeMinSize+1)) } diff --git a/pkg/generator/options.go b/pkg/generator/options.go index 9edab33..2673c9c 100644 --- a/pkg/generator/options.go +++ b/pkg/generator/options.go @@ -81,23 +81,23 @@ func WithSizeHistograms(encoded string) Option { } // WithMinMaxSize sets the min and max size of the generated data. -func WithMinMaxSize(min, max int64) Option { +func WithMinMaxSize(minSize, maxSize int64) Option { return func(o *Options) error { - if min <= 0 { + if minSize <= 0 { return errors.New("WithMinMaxSize: minSize must be >= 0") } - if max < 0 { + if maxSize < 0 { return errors.New("WithMinMaxSize: maxSize must be > 0") } - if min > max { + if minSize > maxSize { return errors.New("WithMinMaxSize: minSize must be < maxSize") } - if o.randSize && max < 256 { + if o.randSize && maxSize < 256 { return errors.New("WithMinMaxSize: random sized objects should be at least 256 bytes") } - o.totalSize = max - o.minSize = min + o.totalSize = maxSize + o.minSize = minSize return nil } }