Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ jobs:
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
- uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4.3.0
with:
go-version: "1.21"
go-version-file: ".go-version"
- name: golangci-lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.15.0
args: --config .golangci.yml --timeout=8m

test:
Expand All @@ -21,7 +22,7 @@ jobs:
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
- uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4.3.0
with:
go-version: "1.21"
go-version-file: ".go-version"
- name: test
run: make test

Expand All @@ -31,7 +32,7 @@ jobs:
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
- uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4.3.0
with:
go-version: "1.21"
go-version-file: ".go-version"
- name: build
run: make build
- name: image-build
Expand Down
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.26.10
29 changes: 22 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
version: "2"
linters:
enable:
- gofmt
- goimports
- gosec
- ineffassign
- misspell
- nolintlint
- revive
- staticcheck
- unconvert
- unused
- vet
- errcheck
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM golang:1.22 AS build-stage
ARG GO_VERSION
FROM golang:${GO_VERSION} AS build-stage

WORKDIR /gomod
COPY go.mod go.sum ./
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ GO_BUILDTAGS = -tags "osusergo netgo static_build"
IMAGE_REPO ?= localhost:5000
IMAGE_TAG ?= latest
IMAGE_NAME = $(IMAGE_REPO)/kperf:$(IMAGE_TAG)
GO_VERSION := $(strip $(shell cat .go-version))

BINARIES=$(addprefix bin/,$(COMMANDS))
CONTRIB_BINARIES=$(addprefix bin/contrib/,$(CONTRIB_COMMANDS))
Expand Down Expand Up @@ -38,7 +39,7 @@ install: ## install binaries

image-build: ## build image
@echo building ${IMAGE_NAME}
@docker build . -t ${IMAGE_NAME}
@docker build --build-arg GO_VERSION=${GO_VERSION} . -t ${IMAGE_NAME}

image-push: image-build ## push image
@echo pushing ${IMAGE_NAME}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kperf/commands/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ var runCommand = cli.Command{
return err
}

var f *os.File = os.Stdout
f := os.Stdout
outputFilePath := cliCtx.String("result")
if outputFilePath != "" {
outputFileDir := filepath.Dir(outputFilePath)
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/Azure/kperf

go 1.22.0

toolchain go1.22.2
go 1.26.0

require (
github.com/google/uuid v1.6.0
Expand Down
5 changes: 1 addition & 4 deletions request/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ func (r *WeightedRandomRequests) Run(ctx context.Context, total int) {
r.wg.Add(1)

sum := 0
for {
if total > 0 && sum >= total {
break
}
for total <= 0 || sum < total {
builder := r.randomPick()
select {
case r.reqBuilderCh <- builder:
Expand Down
Loading