GithubHelp home page GithubHelp logo

Comments (7)

yuanbiancom avatar yuanbiancom commented on June 29, 2024

+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.

lonng avatar lonng commented on June 29, 2024

You should execute failpoint-ctl enable in your workspace. Reference: https://github.com/pingcap/tidb/blob/190990b352b4939c75a60722573ab3f29baa9351/Makefile#L27

from failpoint.

yuanbiancom avatar yuanbiancom commented on June 29, 2024

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.

lonng avatar lonng commented on June 29, 2024

Your file /Users/ru/.Trash/authExample.go does not start with package **, which means that is not a valid Golang source file.

from failpoint.

yuanbiancom avatar yuanbiancom commented on June 29, 2024

Your file /Users/ru/.Trash/authExample.go does not start with package **, 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.

sdojjy avatar sdojjy commented on June 29, 2024

Can we add this information into the README file?

from failpoint.

lonng avatar lonng commented on June 29, 2024

@sdojjy Sure,file a PR is welcome

from failpoint.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.