Skip to content

Commit aa59314

Browse files
authored
Merge pull request #24 from lainio/bench-tests
Super Fast
2 parents 95c6e7a + 208c157 commit aa59314

33 files changed

+2068
-820
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515

1616
- name: Set up Go
17-
uses: actions/setup-go@v3
17+
uses: actions/setup-go@v5
1818
with:
1919
go-version: 1.19
2020

.github/workflows/test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,39 @@ jobs:
55
name: lint
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v3
8+
- uses: actions/checkout@v4
99
- name: golangci-lint
10-
uses: golangci/golangci-lint-action@v2
10+
uses: golangci/golangci-lint-action@v5
1111
with:
1212
version: latest
1313
args: --timeout=5m
1414
test:
1515
strategy:
1616
matrix:
17-
go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x]
17+
go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x]
1818
os: [windows-latest, ubuntu-latest, macos-latest]
1919
runs-on: ${{ matrix.os }}
2020
steps:
2121
- name: setup go
22-
uses: actions/setup-go@v2
22+
uses: actions/setup-go@v5
2323
with:
2424
go-version: ${{ matrix.go-version }}
2525
- name: checkout
26-
uses: actions/checkout@v2
26+
uses: actions/checkout@v4
2727
- name: test
2828
run: make test
2929
test-cov:
3030
runs-on: ubuntu-latest
3131
steps:
3232
- name: setup
33-
uses: actions/setup-go@v2
33+
uses: actions/setup-go@v5
3434
with:
3535
go-version: 1.19.x
3636
- name: checkout
37-
uses: actions/checkout@v2
37+
uses: actions/checkout@v4
3838
- name: test
3939
run: make test_cov_out
4040
- name: upload
41-
uses: codecov/codecov-action@v2
41+
uses: codecov/codecov-action@v4
4242
with:
4343
files: ./coverage.txt

.golangci.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ linters-settings:
3333
# Default: 5
3434
min-complexity: 8
3535
gomnd:
36-
settings:
37-
mnd:
38-
# don't include the "operation" and "assign"
39-
checks: argument,case,condition,return
4036
govet:
41-
check-shadowing: true
4237
lll:
4338
line-length: 140
4439
maligned:

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
### Version history
44

5+
##### 1.0.0
6+
- **Finally! We are very happy, and thanks to all who have helped!**
7+
- Lots of documentation updates and cleanups for version 1.0.0
8+
- `Catch/Handle` take unlimited amount error handler functions
9+
- allows building e.g. error handling middlewares
10+
- this is major feature because it allows building helpers/add-ons
11+
- automatic outputs aren't overwritten by given args, only with `assert.Plain`
12+
- Minor API fixes to still simplify it:
13+
- remove exported vars, obsolete types and funcs from `assert` pkg
14+
- `Result2.Def2()` sets only `Val2`
15+
- technical refactorings: variadic function calls only in API level
16+
517
##### 0.9.52
618
- `err2.Stderr` helpers for `Catch/Handle` to direct auto-logging + snippets
719
- `assert` package `Shorter` `Longer` helpers for automatic messages

Makefile

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ PKGS := $(PKG_ERR2) $(PKG_ASSERT) $(PKG_TRY) $(PKG_DEBUG) $(PKG_HANDLER) $(PKG_S
1111

1212
SRCDIRS := $(shell go list -f '{{.Dir}}' $(PKGS))
1313

14+
MAX_LINE ?= 80
1415
GO ?= go
1516
TEST_ARGS ?= -benchmem
1617
# -"gcflags '-N -l'" both optimization & inlining disabled
@@ -61,9 +62,33 @@ inline_handler:
6162
tinline_handler:
6263
$(GO) test -c -gcflags=-m=2 $(PKG_HANDLER) 2>&1 | ag 'inlin'
6364

65+
inline_assert:
66+
$(GO) test -c -gcflags=-m=2 $(PKG_ASSERT) 2>&1 | ag 'inlin'
67+
6468
bench:
6569
$(GO) test $(TEST_ARGS) -bench=. $(PKGS)
6670

71+
bench_T:
72+
$(GO) test $(TEST_ARGS) -bench='BenchmarkT_.*' $(PKG_ERR2)
73+
74+
bench_S:
75+
$(GO) test $(TEST_ARGS) -bench='BenchmarkS.*' $(PKG_ASSERT)
76+
77+
bench_M:
78+
$(GO) test $(TEST_ARGS) -bench='BenchmarkM.*' $(PKG_ASSERT)
79+
80+
bench_C:
81+
$(GO) test $(TEST_ARGS) -bench='BenchmarkC.*' $(PKG_ASSERT)
82+
83+
bench_nil:
84+
$(GO) test $(TEST_ARGS) -bench='Benchmark.*Nil' $(PKG_ASSERT)
85+
86+
bench_empty:
87+
$(GO) test $(TEST_ARGS) -bench='Benchmark.*Empty' $(PKG_ASSERT)
88+
89+
bench_zero:
90+
$(GO) test $(TEST_ARGS) -bench='BenchmarkZero.*' $(PKG_ASSERT)
91+
6792
bench_goid:
6893
$(GO) test $(TEST_ARGS) -bench='BenchmarkGoid' $(PKG_ASSERT)
6994

@@ -77,7 +102,7 @@ bench_go:
77102
$(GO) test $(TEST_ARGS) -bench='BenchmarkTry_StringGenerics' $(PKG_ERR2)
78103

79104
bench_that:
80-
$(GO) test $(TEST_ARGS) -bench='BenchmarkThat.*' $(PKG_ASSERT)
105+
$(GO) test $(TEST_ARGS) -bench='Benchmark.*That.*' $(PKG_ASSERT)
81106

82107
bench_copy:
83108
$(GO) test $(TEST_ARGS) -bench='Benchmark_CopyBuffer' $(PKG_TRY)
@@ -106,6 +131,14 @@ bench_x:
106131
vet: | test
107132
$(GO) vet $(PKGS)
108133

134+
fmt:
135+
@echo "Pretty formatting with golines"
136+
@golines -t 5 -w -m $(MAX_LINE) --ignore-generated .
137+
138+
dry-fmt:
139+
@echo "--dry-run: Pretty formatting with golines"
140+
@golines -t 5 --dry-run -m $(MAX_LINE) --ignore-generated .
141+
109142
gofmt:
110143
@echo Checking code is gofmted
111144
@test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)"
@@ -124,8 +157,17 @@ test_cov: test_cov_out
124157
go tool cover -html=coverage.txt -o=coverage.html
125158
firefox ./coverage.html 1>&- 2>&- &
126159

127-
lint:
128-
@golangci-lint run
160+
test_cov_pc_assert:
161+
go tool cover -func=coverage.txt | ag assert
129162

130-
.PHONY: check
163+
test_cov_zero: test_cov_out
164+
go tool cover -func=coverage.txt | ag '\:\s*[A-Z]+.*\s+0\.0%'
131165

166+
test_cov_assert_zero: test_cov_out
167+
go tool cover -func=coverage.txt | ag 'assert\/.*\:\s*[A-Z]+.*\s+0\.0%'
168+
169+
test_cov_pc:
170+
go tool cover -func=coverage.txt
171+
172+
lint:
173+
@golangci-lint run

0 commit comments

Comments
 (0)