Skip to content

Commit

Permalink
remove stale note about recover in runtime/mock/stdlib.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xhd2015 committed Jun 2, 2024
1 parent a729023 commit 55af407
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
4 changes: 2 additions & 2 deletions cmd/xgo/runtime_gen/core/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
)

const VERSION = "1.0.38"
const REVISION = "f3e4e310320226a1de91a82ea3555dd28c7f306a+1"
const NUMBER = 256
const REVISION = "a72902358db8db4c239550d226a8360a26ffb904+1"
const NUMBER = 257

// these fields will be filled by compiler
const XGO_VERSION = ""
Expand Down
4 changes: 2 additions & 2 deletions cmd/xgo/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import "fmt"

const VERSION = "1.0.38"
const REVISION = "f3e4e310320226a1de91a82ea3555dd28c7f306a+1"
const NUMBER = 256
const REVISION = "a72902358db8db4c239550d226a8360a26ffb904+1"
const NUMBER = 257

func getRevision() string {
revSuffix := ""
Expand Down
4 changes: 2 additions & 2 deletions runtime/core/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
)

const VERSION = "1.0.38"
const REVISION = "f3e4e310320226a1de91a82ea3555dd28c7f306a+1"
const NUMBER = 256
const REVISION = "a72902358db8db4c239550d226a8360a26ffb904+1"
const NUMBER = 257

// these fields will be filled by compiler
const XGO_VERSION = ""
Expand Down
9 changes: 0 additions & 9 deletions runtime/mock/stdlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ Rational: stdlib functions like `os.ReadFile`, `io.Read` are widely used by go c

So in this mode only a limited list of stdlib functions can be mocked. However, if there lacks some functions you may want to use, you can leave a comment in [Issue#6](https://github.com/xhd2015/xgo/issues/6) or fire an issue to let us know and add it.

# Functions In Stdlib Calling `recover()` Cannot Be Mocked
When a function calls `recover()`, it will capture panic when used in defer.

However, since compiler treats stdlib from ordinary module differently, current implementation to support stdlib function is based on source code injection, which may causes build time to slow down, and also causes functions containing `recover()` to be invalid if rewritten, see https://github.com/xhd2015/xgo/issues/164.

This will be fixed in the long run, but before that, such functions in stdlib cannot be mocked.

NOTE: functions outside stdlib, even with calling `recover()`, are not affected since they are rewritten with IR, not source code.

# Supported List When `--trap-stdlib=false`
## `os`
- `Getenv`
Expand Down

0 comments on commit 55af407

Please sign in to comment.