Comments (7)
+1. I wrote something like:
fmt.Println("Testing failpoint")
err := failpoint.Enable("TestFailpoint", "return(1)")
if err != nil {
panic(err)
}
failpoint.Inject("TestFailpoint", func(val failpoint.Value) {
fmt.Println("enter TestFailpoint")
fmt.Println("Print 002")
})
fmt.Println("Print 001")
The closure in Inject func never run. I also tried to enable failpoint via env GO_FAILPOINT, but didn't work either.
When i run failpoint.Enable, then i run Eval, it worked. But seems it failed on replace marker func.
from failpoint.
You should execute failpoint-ctl enable
in your workspace. Reference: https://github.com/pingcap/tidb/blob/190990b352b4939c75a60722573ab3f29baa9351/Makefile#L27
from failpoint.
You should execute
failpoint-ctl enable
in your workspace. Reference: https://github.com/pingcap/tidb/blob/190990b352b4939c75a60722573ab3f29baa9351/Makefile#L27
I do make
and get a failpoint-ctl:
GO111MODULE=on CGO_ENABLED=0 GO111MODULE=on go build -ldflags '-X "github.com/pingcap/failpoint/failpoint-ctl/version.releaseVersion=bf45ab2" -X "github.com/pingcap/failpoint/failpoint-ctl/version.buildTS=2019-05-06 12:56:14" -X "github.com/pingcap/failpoint/failpoint-ctl/version.gitHash=bf45ab20bfc48d624b61944a4820768c16d7db99" -X "github.com/pingcap/failpoint/failpoint-ctl/version.gitBranch=master" -X "github.com/pingcap/failpoint/failpoint-ctl/version.goVersion=go version go1.11.5 darwin/amd64"' -o bin/failpoint-ctl failpoint-ctl/main.go
go: finding github.com/nicksnyder/go-i18n v1.10.0
go: finding github.com/go-playground/overalls v0.0.0-20180201144345-22ec1a223b7c
go: finding github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf
go: finding github.com/pelletier/go-toml v1.3.0
go: finding github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8
go: finding github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf
go: finding github.com/yookoala/realpath v1.0.0
go: finding gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20180810215634-df19058c872c
go: finding gopkg.in/alecthomas/gometalinter.v2 v2.0.12
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/BurntSushi/toml v0.3.1
go: finding gopkg.in/yaml.v2 v2.2.2
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
failpoint-ctl build successfully :-) !
then when i try to use the ctl, i get this:
ru:~user$ failpoint-ctl enable
Rewrite error /Users/ru/.Trash/authExample.go:1:1: expected 'package', found 'var'
is there anything i do wrong this time? many thanks!
from failpoint.
Your file /Users/ru/.Trash/authExample.go
does not start with package **
, which means that is not a valid Golang source file.
from failpoint.
Your file
/Users/ru/.Trash/authExample.go
does not start withpackage **
, which means that is not a valid Golang source file.
sorry, my mistake, i didn't add the path. Thanks for you help!
from failpoint.
Can we add this information into the README file?
from failpoint.
@sdojjy Sure,file a PR is welcome
from failpoint.
Related Issues (18)
- go test failed HOT 8
- failpoint doesn't work if the marker function is defined in the main package HOT 7
- failpoint can not use a constant-string as marker function name HOT 4
- Add a "DO NOT EDIT" comment to failpoint-enabled source code HOT 2
- failpoint not activated HOT 2
- failpoint in anonymous function can not be enable
- type assert OK print error message
- Create Release Binary amd and Darwin HOT 2
- Why the type of failpoint.Value can't be string HOT 2
- Register an action func to be called when a failpoint is evaluated
- Why do we call `fmt.Println` in `failpoints.Eval` HOT 1
- How to inject faults to a program at running time with failpoint HOT 2
- Failpoint doesn't work when Inject function defined in a closure argument
- failpoint can be actived if it is injected with in a function clusure HOT 1
- failpoint.Disable should be idempotent HOT 1
- Failpoints are getting executed while running tests using `go test -v`
- Failpoints.Disable not remove failpath from fps.reg HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from failpoint.