Skip to content
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

Is it possible to add a init func to check whether -gcflags=all=-l is in os.Args? #160

Open
Ericwww opened this issue Feb 1, 2024 · 1 comment

Comments

@Ericwww
Copy link

Ericwww commented Feb 1, 2024

Like this

func init() {
	if !slices.Contains(os.Args, "-gcflags=all=-l") {
		fmt.Println("WARNING: inline is enabled, some gomonkey patch will failed")
		os.Exit(1)
	}
}

I think this would remind developers to add -gcflags=all=-l.

But I'm not sure if this will affect go build, and judging from the current situation, my conclusion is that it won't.

@xhd2015
Copy link

xhd2015 commented Mar 19, 2024

Hi Eric, go-monkey is not aware of build flags. However, a new mock library supports what you are saying: https://github.com/xhd2015/xgo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants