Skip to content

Commit

Permalink
migration README
Browse files Browse the repository at this point in the history
  • Loading branch information
lainio committed Aug 17, 2023
1 parent b331abb commit 03fa868
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The err2 package will offer auto-migration scripts until version 1.0.0 is
published. That means that you can safely use the package even the API is not
yet 100% staple. We have used that approach for our production code that uses
yet 100% stable. We have used that approach for our production code that uses
`err2` and it works very well. Over 100 KLOC Go code has been auto-migrated
successfully from type variables (see below) to Go generics API.

Expand All @@ -13,12 +13,12 @@ functions or make something obsolete.

The version 0.9.40 is a major update because of the performance and API change.
We have managed to eliminate `defer` slowdown. Our benchmarks are 3x faster than
previous version and about equal to those function call stacks (100 level) that
don't use `defer`. We are exactly at the same level of performance with those
functions that use deferred function that accept an argument. Transporting an
argument to deferred function seems to be slower than functions that don't. And
because `try.To` is already as fast as `if err != nil` we reached our goal for
speed!
previous version and about equal to those function call stacks (100 deep-level)
that don't use `defer`. We are exactly at the same level of performance with
those functions that use deferred function that accept an argument. Transporting
an argument to deferred function seems to be slower than functions that don't.
And because `try.To` is already as fast as `if err != nil` we reached our goal
for speed!

Because all of the error handler function signatures are now:
```go
Expand All @@ -35,7 +35,8 @@ important but difficult. The `err2` package writes `fatal error: ...` to
You have two (2) options for migration for v0.9.40:
1. [(Semi)-Automatic Migration](#semi-automatic-migration)
1. [Manual migration using (vim/nvim) location lists or similar](manual-migration-with-a-location-list)
1. [Manual migration using (vim/nvim) location lists or
similar](#manual-migration-with-a-location-list)

#### (Semi)-Automatic Migration

Expand Down
4 changes: 2 additions & 2 deletions scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ check_prerequisites() {
fi

local go_version=$(go mod edit -json | jq -r '."Go"')
if [[ $go_version < 1.19 ]]; then
if [[ $go_version < 1.18 ]]; then
echo "ERROR: Go version number ($go_version) is too low" >&2
echo "Sample: go mod edit -go=1.19 # sets the minimal version" >&2
echo "Sample: go mod edit -go=1.18 # sets the minimal version" >&2
exit 1
fi

Expand Down

0 comments on commit 03fa868

Please sign in to comment.