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

cmd/fillstruct: broken without modules #31

Closed
mschneider82 opened this issue May 9, 2019 · 11 comments
Closed

cmd/fillstruct: broken without modules #31

mschneider82 opened this issue May 9, 2019 · 11 comments

Comments

@mschneider82
Copy link

mschneider82 commented May 9, 2019

I dont have go modules in my project (in $GOPATH/src) and trying to fill a struct in a _test.go file, the struct is defined in the same package but not in the _test.go file.

I always get the message:

fillstruct: no struct literal found at selection

When i rollback to commit 654d0ba struct filling in the _test file is working.

client.go :
type X struct {
       Somevalue bool
}


client_test.go:
func TestClient_DoSomeTest(t *testing.T) {
   x := X{} // problem filling struct
}

@klische
Copy link

klische commented Aug 5, 2019

I have the same issue. Even if the struct is defined in the same package, but in a different file, I get the fillstruct: no struct literal found at selection message.

I guess a workaround for now is to copy over struct definitions into the same file and then copy them back over to another file in the same package after using this tool.

@davidrjenni can you please look into this?

@mschneider82
Copy link
Author

@klische for me a better workaround is to rollback to the old binary:

cd $GOPATH/src/github.com/davidrjenni/reftools/cmd/fillstruct
git checkout 654d0ba
go build -i

@mschneider82
Copy link
Author

@klische you could test my PR / fork.
My PR should be compatible with modules and non-modules...

@davidrjenni
Copy link
Owner

@mschneider82, @klische sorry for the late response and thank you for the workaround instructions and the PR. I will review the issue and the PR during the weekend. I hope you can still use the tool with the workaround until the issue is resolved.

@mschneider82
Copy link
Author

thanks @davidrjenni i am sure that there is a better solution than my hack, but it works for now.. I cannot live with a half-broken fillstruct tool!

@mschneider82
Copy link
Author

@davidrjenni have you had some time to look at this?

@klische
Copy link

klische commented Aug 26, 2019

@klische you could test my PR / fork.
My PR should be compatible with modules and non-modules...

I will test your PR tomorrow. Thank you for this :)

davidrjenni added a commit that referenced this issue Aug 26, 2019
@davidrjenni
Copy link
Owner

@mschneider82 could you please test PR #33? It seems to fix the problem for me.

davidrjenni added a commit that referenced this issue Aug 27, 2019
davidrjenni added a commit that referenced this issue Aug 27, 2019
@davidrjenni
Copy link
Owner

@klische can you also confirm that the problem is fixed in the current master?

@klische
Copy link

klische commented Aug 30, 2019

@davidrjenni I apologize for the late response. I can confirm it is working! This is fantastic. Thank you so much.

@davidrjenni
Copy link
Owner

@klische thanks for the feedback!

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

Successfully merging a pull request may close this issue.

3 participants