Skip to content

Commit

Permalink
update all deps move to go1.17 as default (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Jul 1, 2022
1 parent 60d5a7d commit e71be5c
Show file tree
Hide file tree
Showing 28 changed files with 380 additions and 984 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [1.16.x, 1.17.x]
go-version: [1.17.x, 1.18.x]
os: [ubuntu-latest]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
Expand All @@ -30,6 +30,6 @@ jobs:
env:
GO111MODULE: on
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.40.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
$(go env GOPATH)/bin/golangci-lint run --timeout=5m --config ./.golangci.yml
go test -v -race ./...
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ linters:
- goimports
- misspell
- govet
- golint
- revive
- ineffassign
- gosimple
- deadcode
- gofumpt
- structcheck

issues:
Expand All @@ -26,4 +27,4 @@ issues:
- should have comment or be unexported
- error strings should not be capitalized or end with punctuation or a newline
service:
golangci-lint-version: 1.20.0 # use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.45.2 # use the fixed version to not introduce new linters unexpectedly
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.14.7
FROM golang:1.18

ADD go.mod /go/src/github.com/minio/warp/go.mod
ADD go.sum /go/src/github.com/minio/warp/go.sum
Expand Down
2 changes: 1 addition & 1 deletion cli/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func mainAnalyze(ctx *cli.Context) error {
if len(args) > 1 {
console.Fatal("Only one benchmark file can be given")
}
var zstdDec, _ = zstd.NewReader(nil)
zstdDec, _ := zstd.NewReader(nil)
defer zstdDec.Close()
monitor := api.NewBenchmarkMonitor(ctx.String(serverFlagName))
defer monitor.Done()
Expand Down
6 changes: 4 additions & 2 deletions cli/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,10 @@ func runBench(ctx *cli.Context, b bench.Benchmark) error {
return nil
}

var activeBenchmarkMu sync.Mutex
var activeBenchmark *clientBenchmark
var (
activeBenchmarkMu sync.Mutex
activeBenchmark *clientBenchmark
)

type clientBenchmark struct {
sync.Mutex
Expand Down
4 changes: 2 additions & 2 deletions cli/benchserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ func runServerBenchmark(ctx *cli.Context) (bool, error) {
monitor := api.NewBenchmarkMonitor(ctx.String(serverFlagName))
defer monitor.Done()
monitor.SetLnLoggers(printInfo, printError)
var infoLn = monitor.InfoLn
var errorLn = monitor.Errorln
infoLn := monitor.InfoLn
errorLn := monitor.Errorln

var allOps bench.Operations

Expand Down
19 changes: 9 additions & 10 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"strconv"
"time"

mprofile "github.com/bygui86/multi-profile"
mprofile "github.com/bygui86/multi-profile/v2"
"github.com/cheggaaa/pb"
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
Expand Down Expand Up @@ -86,6 +86,7 @@ func Main(args []string) {
os.Exit(1)
}
}

func init() {
a := []cli.Command{
mixedCmd,
Expand Down Expand Up @@ -162,15 +163,13 @@ func registerApp(name string, appCmds []cli.Command) *cli.App {
app.Before = func(ctx *cli.Context) error {
var profiles []*mprofile.Profile
cfg := &mprofile.Config{
Path: ctx.String("pprofdir"),
UseTempPath: false,
NoExit: false,
DisableShutdownHook: false,
Quiet: false,
MemProfileRate: 4096,
MemProfileType: "heap",
CloserHook: nil,
Logger: nil,
Path: ctx.String("pprofdir"),
UseTempPath: false,
Quiet: false,
MemProfileRate: 4096,
MemProfileType: "heap",
CloserHook: nil,
Logger: nil,
}
if ctx.Bool("cpu") {
profiles = append(profiles, mprofile.CPUProfile(cfg).Start())
Expand Down
4 changes: 1 addition & 3 deletions cli/clientmode.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ import (
"github.com/minio/pkg/console"
)

var (
clientFlags = []cli.Flag{}
)
var clientFlags = []cli.Flag{}

// Put command.
var clientCmd = cli.Command{
Expand Down
2 changes: 1 addition & 1 deletion cli/cmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func mainCmp(ctx *cli.Context) error {
checkAnalyze(ctx)
checkCmp(ctx)
args := ctx.Args()
var zstdDec, _ = zstd.NewReader(nil)
zstdDec, _ := zstd.NewReader(nil)
defer zstdDec.Close()
log := console.Printf
if globalQuiet {
Expand Down
4 changes: 2 additions & 2 deletions cli/complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
func mainComplete() error {
// Recursively register all commands and subcommands
// along with global and local flags
var complCmds = make(complete.Commands)
complCmds := make(complete.Commands)
for _, cmd := range appCmds {
complCmds[cmd.Name] = cmdToCompleteCmd(cmd, "")
}
Expand All @@ -53,7 +53,7 @@ var completeCmds = map[string]complete.Predictor{
// flagsToCompleteFlags transforms a cli.Flag to complete.Flags
// understood by posener/complete library.
func flagsToCompleteFlags(flags []cli.Flag) complete.Flags {
var complFlags = make(complete.Flags)
complFlags := make(complete.Flags)
for _, f := range flags {
for _, s := range strings.Split(f.GetName(), ",") {
var flagName string
Expand Down
36 changes: 17 additions & 19 deletions cli/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,23 @@ import (
"github.com/minio/warp/pkg/bench"
)

var (
deleteFlags = []cli.Flag{
cli.IntFlag{
Name: "objects",
Value: 25000,
Usage: "Number of objects to upload.",
},
cli.StringFlag{
Name: "obj.size",
Value: "1KiB",
Usage: "Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
},
cli.IntFlag{
Name: "batch",
Value: 100,
Usage: "Number of DELETE operations per batch.",
},
}
)
var deleteFlags = []cli.Flag{
cli.IntFlag{
Name: "objects",
Value: 25000,
Usage: "Number of objects to upload.",
},
cli.StringFlag{
Name: "obj.size",
Value: "1KiB",
Usage: "Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
},
cli.IntFlag{
Name: "batch",
Value: 100,
Usage: "Number of DELETE operations per batch.",
},
}

var deleteCmd = cli.Command{
Name: "delete",
Expand Down
44 changes: 21 additions & 23 deletions cli/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,27 @@ import (
"github.com/minio/warp/pkg/bench"
)

var (
getFlags = []cli.Flag{
cli.IntFlag{
Name: "objects",
Value: 2500,
Usage: "Number of objects to upload.",
},
cli.StringFlag{
Name: "obj.size",
Value: "10MiB",
Usage: "Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
},
cli.BoolFlag{
Name: "range",
Usage: "Do ranged get operations. Will request with random offset and length.",
},
cli.IntFlag{
Name: "versions",
Value: 1,
Usage: "Number of versions to upload. If more than 1, versioned listing will be benchmarked",
},
}
)
var getFlags = []cli.Flag{
cli.IntFlag{
Name: "objects",
Value: 2500,
Usage: "Number of objects to upload.",
},
cli.StringFlag{
Name: "obj.size",
Value: "10MiB",
Usage: "Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
},
cli.BoolFlag{
Name: "range",
Usage: "Do ranged get operations. Will request with random offset and length.",
},
cli.IntFlag{
Name: "versions",
Value: 1,
Usage: "Number of versions to upload. If more than 1, versioned listing will be benchmarked",
},
}

var getCmd = cli.Command{
Name: "get",
Expand Down
44 changes: 21 additions & 23 deletions cli/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,27 @@ import (
"github.com/minio/warp/pkg/bench"
)

var (
listFlags = []cli.Flag{
cli.IntFlag{
Name: "objects",
Value: 10000,
Usage: "Number of objects to upload. Rounded to have equal concurrent objects.",
},
cli.IntFlag{
Name: "versions",
Value: 1,
Usage: "Number of versions to upload. If more than 1, versioned listing will be benchmarked",
},
cli.StringFlag{
Name: "obj.size",
Value: "1KB",
Usage: "Size of each generated object. Can be a number or 10KB/MB/GB. All sizes are base 2 binary.",
},
cli.BoolFlag{
Name: "metadata",
Usage: "Enable extended MinIO ListObjects with metadata, by default this benchmarking uses ListObjectsV2 API.",
},
}
)
var listFlags = []cli.Flag{
cli.IntFlag{
Name: "objects",
Value: 10000,
Usage: "Number of objects to upload. Rounded to have equal concurrent objects.",
},
cli.IntFlag{
Name: "versions",
Value: 1,
Usage: "Number of versions to upload. If more than 1, versioned listing will be benchmarked",
},
cli.StringFlag{
Name: "obj.size",
Value: "1KB",
Usage: "Size of each generated object. Can be a number or 10KB/MB/GB. All sizes are base 2 binary.",
},
cli.BoolFlag{
Name: "metadata",
Usage: "Enable extended MinIO ListObjects with metadata, by default this benchmarking uses ListObjectsV2 API.",
},
}

var listCmd = cli.Command{
Name: "list",
Expand Down
2 changes: 1 addition & 1 deletion cli/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func mainMerge(ctx *cli.Context) error {
if len(args) <= 1 {
console.Fatal("Two or more benchmark data files must be supplied")
}
var zstdDec, _ = zstd.NewReader(nil)
zstdDec, _ := zstd.NewReader(nil)
defer zstdDec.Close()
var allOps bench.Operations
threads := uint16(0)
Expand Down
66 changes: 32 additions & 34 deletions cli/mixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,40 +27,38 @@ import (
"github.com/minio/warp/pkg/bench"
)

var (
mixedFlags = []cli.Flag{
cli.IntFlag{
Name: "objects",
Value: 2500,
Usage: "Number of objects to upload.",
},
cli.StringFlag{
Name: "obj.size",
Value: "10MiB",
Usage: "Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
},
cli.Float64Flag{
Name: "get-distrib",
Usage: "The amount of GET operations.",
Value: 45,
},
cli.Float64Flag{
Name: "stat-distrib",
Usage: "The amount of STAT operations.",
Value: 30,
},
cli.Float64Flag{
Name: "put-distrib",
Usage: "The amount of PUT operations.",
Value: 15,
},
cli.Float64Flag{
Name: "delete-distrib",
Usage: "The amount of DELETE operations. Must be at least the same as PUT.",
Value: 10,
},
}
)
var mixedFlags = []cli.Flag{
cli.IntFlag{
Name: "objects",
Value: 2500,
Usage: "Number of objects to upload.",
},
cli.StringFlag{
Name: "obj.size",
Value: "10MiB",
Usage: "Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
},
cli.Float64Flag{
Name: "get-distrib",
Usage: "The amount of GET operations.",
Value: 45,
},
cli.Float64Flag{
Name: "stat-distrib",
Usage: "The amount of STAT operations.",
Value: 30,
},
cli.Float64Flag{
Name: "put-distrib",
Usage: "The amount of PUT operations.",
Value: 15,
},
cli.Float64Flag{
Name: "delete-distrib",
Usage: "The amount of DELETE operations. Must be at least the same as PUT.",
Value: 10,
},
}

var mixedCmd = cli.Command{
Name: "mixed",
Expand Down
Loading

0 comments on commit e71be5c

Please sign in to comment.