Skip to content

Super Fast #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 82 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
5d5f0cb
debugging help
lainio Mar 24, 2024
b8bc681
fix: if test panics, adaptive callstack print for runtime.Error
lainio Mar 24, 2024
c4d5fe7
typo
lainio May 20, 2024
76d2364
new asserts for slice, chan & map
lainio Jul 29, 2024
af3ea4b
wrapping comment, perf point of view
lainio Jul 31, 2024
4a8efcb
Less and Greater for numbers + example tests
lainio Jul 31, 2024
94cc27e
about panic stack traces
lainio Jul 31, 2024
01fe351
remove deprecated configs
lainio Aug 15, 2024
ee26b3d
readability and typos
lainio Aug 15, 2024
6ae165b
fmt with golines
lainio Aug 15, 2024
3fc2088
refactoring comments
lainio Aug 15, 2024
fa9e3e8
refactor: test pkg -> require pkg + new helpers
lainio Aug 16, 2024
05a0684
refactor result functions for testing
lainio Aug 17, 2024
4ad8245
more dynamic sample
lainio Aug 17, 2024
c038678
Merge branch 'bench-tests' of ssh://g.yxqyang.asia-lainio/lainio/err2 int…
lainio Aug 17, 2024
a858523
export and use handler.WrapError
lainio Aug 18, 2024
88e62f8
new functions + tests: T, T1, T2, T3
lainio Aug 18, 2024
baab7e9
bench rule for T functions
lainio Aug 18, 2024
9e3f44c
make linter happy
lainio Aug 18, 2024
ac8f630
comment: tell why DRY has to be there, no inlining
lainio Aug 18, 2024
30032f8
Merge branch 'bench-tests' of ssh://g.yxqyang.asia-lainio/lainio/err2 int…
lainio Aug 18, 2024
193db9a
try.Out.Handle() inlined + benchmark
lainio Aug 18, 2024
b803124
inline optimization for Logf
lainio Aug 18, 2024
767a53d
new benches, and inline bench for assert
lainio Aug 19, 2024
04fa9cc
Q&D test to optimize assert.Zero even it's generics, good strategy
lainio Aug 19, 2024
0191b86
T functions no perf penalty + pkg documentation of T funcs
lainio Aug 21, 2024
9072412
tests and benches for try.T function
lainio Aug 21, 2024
d3ea782
super performance! Split assert functions go get inlining
lainio Aug 21, 2024
420ceda
in progress: assert pkg manual inlining generic functions
lainio Aug 21, 2024
47d4495
gofmt
lainio Aug 22, 2024
ca6dc12
template asserts benches for S, M and C
lainio Aug 22, 2024
4fc7ffd
rest of the assert inline optimized + benches
lainio Aug 22, 2024
4a427d4
Equal & Len assert better messages
lainio Sep 1, 2024
c05d002
better formatting for skimmability
lainio Sep 1, 2024
ed9b897
more output for golines fmt rules
lainio Sep 1, 2024
b2c779b
Merge branch 'golines-fmt' into bench-tests
lainio Sep 1, 2024
5a1958b
'assertion violation' -> assertion failure, msgs + new examples
lainio Sep 2, 2024
fc9a0ce
assert test
lainio Sep 7, 2024
8d57640
mark tester() calls
lainio Sep 7, 2024
1a81899
first bench tests for currentX() that uses TLS which is slow
lainio Sep 7, 2024
0def096
bench rules for assert optimization
lainio Sep 7, 2024
e670166
TLS based optimizations work, next test the switching
lainio Sep 7, 2024
48750a0
rm X() functions & cleanup + MKey OK idiom bench for ref
lainio Sep 8, 2024
b8cabce
rm TODOs
lainio Sep 8, 2024
bffe12b
gofmt
lainio Sep 8, 2024
a9dc394
refactor doEmpty -> doNamed
lainio Sep 8, 2024
73eb244
SetAsserter works only outside unit tests, they MUST use pkg asserter
lainio Sep 8, 2024
d9d2b45
makefile rule for command-line coverage studies
lainio Sep 30, 2024
2edd142
update samples/README.md
lainio Oct 1, 2024
bbce22d
Merge branch 'bench-tests' of ssh://g.yxqyang.asia-lainio/lainio/err2 int…
lainio Oct 1, 2024
d47a5c8
tools for cmd line coverage work
lainio Oct 5, 2024
08168e4
zero cov rules refresh automatically
lainio Oct 6, 2024
5cc1710
docs & refactoring
lainio Oct 6, 2024
ef35568
add calls to assert pkg to cover almost all
lainio Oct 6, 2024
4a8c5b8
update assert pkg doc
lainio Oct 6, 2024
6fab26b
SetAsserter -> PushAsserter & export PopAsserter
lainio Oct 6, 2024
6cbef5b
fix code sample
lainio Oct 6, 2024
3d6dce2
guide to use PushAsserter 1st now that it works
lainio Oct 6, 2024
0e14aab
PushAsserter snippet
lainio Oct 8, 2024
ef13eed
better docs for assert
lainio Oct 8, 2024
5d98a51
readable db sample
lainio Oct 8, 2024
95c1b95
new type Asserter and doc refs to it
lainio Oct 8, 2024
fe63d9c
typo
lainio Oct 8, 2024
d322e5f
use Asserter type in pkg lvl docs
lainio Oct 8, 2024
66af422
release v1.1.0 comments
lainio Oct 9, 2024
cfb04a1
github action version update
lainio Oct 9, 2024
09966e0
new markup features
lainio Oct 9, 2024
28cc11d
learning details
lainio Oct 9, 2024
031e87b
fix details
lainio Oct 9, 2024
036cee0
typos in PushAsserter
lainio Oct 10, 2024
848d840
add
lainio Oct 10, 2024
fd7b890
cleanup
lainio Oct 10, 2024
b8b33e4
continue combine readme docs
lainio Oct 10, 2024
555ef4c
fix important annotation placement
lainio Oct 10, 2024
e5113f1
better layouts & language proofing
lainio Oct 11, 2024
11f6c9f
PushAsserter impl stack with Pop function that's stroge, clever!
lainio Oct 11, 2024
74cb677
test PushAsserter as a real stack: Push/Pop
lainio Oct 11, 2024
6c624d8
more <details>
lainio Oct 11, 2024
7a823fb
layout & typos
lainio Oct 11, 2024
4640f46
finalizing
lainio Oct 11, 2024
041525c
fix assert-keep mode
lainio Oct 11, 2024
208c157
logo branch
lainio Oct 11, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v5
with:
version: latest
args: --timeout=5m
test:
strategy:
matrix:
go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x]
go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x]
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: setup go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: test
run: make test
test-cov:
runs-on: ubuntu-latest
steps:
- name: setup
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.19.x
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: test
run: make test_cov_out
- name: upload
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
files: ./coverage.txt
5 changes: 0 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ linters-settings:
# Default: 5
min-complexity: 8
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: argument,case,condition,return
govet:
check-shadowing: true
lll:
line-length: 140
maligned:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

### Version history

##### 1.0.0
- **Finally! We are very happy, and thanks to all who have helped!**
- Lots of documentation updates and cleanups for version 1.0.0
- `Catch/Handle` take unlimited amount error handler functions
- allows building e.g. error handling middlewares
- this is major feature because it allows building helpers/add-ons
- automatic outputs aren't overwritten by given args, only with `assert.Plain`
- Minor API fixes to still simplify it:
- remove exported vars, obsolete types and funcs from `assert` pkg
- `Result2.Def2()` sets only `Val2`
- technical refactorings: variadic function calls only in API level

##### 0.9.52
- `err2.Stderr` helpers for `Catch/Handle` to direct auto-logging + snippets
- `assert` package `Shorter` `Longer` helpers for automatic messages
Expand Down
50 changes: 46 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PKGS := $(PKG_ERR2) $(PKG_ASSERT) $(PKG_TRY) $(PKG_DEBUG) $(PKG_HANDLER) $(PKG_S

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

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

inline_assert:
$(GO) test -c -gcflags=-m=2 $(PKG_ASSERT) 2>&1 | ag 'inlin'

bench:
$(GO) test $(TEST_ARGS) -bench=. $(PKGS)

bench_T:
$(GO) test $(TEST_ARGS) -bench='BenchmarkT_.*' $(PKG_ERR2)

bench_S:
$(GO) test $(TEST_ARGS) -bench='BenchmarkS.*' $(PKG_ASSERT)

bench_M:
$(GO) test $(TEST_ARGS) -bench='BenchmarkM.*' $(PKG_ASSERT)

bench_C:
$(GO) test $(TEST_ARGS) -bench='BenchmarkC.*' $(PKG_ASSERT)

bench_nil:
$(GO) test $(TEST_ARGS) -bench='Benchmark.*Nil' $(PKG_ASSERT)

bench_empty:
$(GO) test $(TEST_ARGS) -bench='Benchmark.*Empty' $(PKG_ASSERT)

bench_zero:
$(GO) test $(TEST_ARGS) -bench='BenchmarkZero.*' $(PKG_ASSERT)

bench_goid:
$(GO) test $(TEST_ARGS) -bench='BenchmarkGoid' $(PKG_ASSERT)

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

bench_that:
$(GO) test $(TEST_ARGS) -bench='BenchmarkThat.*' $(PKG_ASSERT)
$(GO) test $(TEST_ARGS) -bench='Benchmark.*That.*' $(PKG_ASSERT)

bench_copy:
$(GO) test $(TEST_ARGS) -bench='Benchmark_CopyBuffer' $(PKG_TRY)
Expand Down Expand Up @@ -106,6 +131,14 @@ bench_x:
vet: | test
$(GO) vet $(PKGS)

fmt:
@echo "Pretty formatting with golines"
@golines -t 5 -w -m $(MAX_LINE) --ignore-generated .

dry-fmt:
@echo "--dry-run: Pretty formatting with golines"
@golines -t 5 --dry-run -m $(MAX_LINE) --ignore-generated .

gofmt:
@echo Checking code is gofmted
@test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)"
Expand All @@ -124,8 +157,17 @@ test_cov: test_cov_out
go tool cover -html=coverage.txt -o=coverage.html
firefox ./coverage.html 1>&- 2>&- &

lint:
@golangci-lint run
test_cov_pc_assert:
go tool cover -func=coverage.txt | ag assert

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

test_cov_assert_zero: test_cov_out
go tool cover -func=coverage.txt | ag 'assert\/.*\:\s*[A-Z]+.*\s+0\.0%'

test_cov_pc:
go tool cover -func=coverage.txt

lint:
@golangci-lint run
Loading
Loading