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

ffjson failed to force regenerate, sometimes just re-run works #240

Open
derekch opened this issue Jun 30, 2018 · 3 comments
Open

ffjson failed to force regenerate, sometimes just re-run works #240

derekch opened this issue Jun 30, 2018 · 3 comments

Comments

@derekch
Copy link

derekch commented Jun 30, 2018

I have an api project uses ffjson to generate code handling json, use the ffjson -force-regenerate $GOFILE to always regenerate,

//go:generate ffjson -force-regenerate $GOFILE

Met two problems:

  1. sometimes the force regenerate would create an almost empty file with comments header and one line import () only, just re-run the same force-regenerate would fix and got a good generated file;
  2. the 2nd problem is below, since I removed a field Extra from a data structure and re-generate, wonder why the force-regenerate need to look at the previously generated ./admin_rest_ffjson.go ? Doesn't the force-regenerate mean to forget whatever existing code just force regenerate? The workaround is simple: just remove the ./admin_rest_ffjson.go before go generate
$ go generate -v -x ./api
api/admin_rest.go
ffjson -force-regenerate admin_rest.go
Error: Go Run Failed for: ffjson-inception297320246/ffjson-inception651681391.go
STDOUT:

STDERR:
# github.com/team/proj/api
./admin_rest_ffjson.go:1270:37: j.Extra undefined (type *DataType has no field or method Extra)
./admin_rest_ffjson.go:1705:5: j.Extra undefined (type *DataType has no field or method Extra)

:

api/admin_rest.go:1: running "ffjson": exit status 1

Is this project Abandoned?

am checking many other open issues on this board seeing many ones have months no response at all; wonder is this project abandoned ? nobody is fixing any bugs ?

@erikdubbelboer
Copy link
Contributor

I think the problems you are have all come from the way ffjson works. ffjson doesn't inspect the Go code to find out which structs exist instead if compiles and runs a program with all the source and then uses reflect to find out information about all the structs. This results in issues when the program can't build for example because the old source still uses a field you removed.

I always remove the old generated file before I generate a new one and this always works. I guess ffjson should do this automatically, but it doesn't.

@derekch
Copy link
Author

derekch commented Jul 3, 2018

I do remove old file trick as well; so the ffjson -force-regenerate never worked as intended?

Latest commit d49c2bc on Oct 2, 2017

would you agree this project is no longer maintained? there are a couple of pending PRs for @pquerna to take care; I will see if last commit remains there in 2017 after this October will be more than 1 year no maintenance I will have to research some fork or alternatives.

@derekch derekch changed the title ffjson failed to generate, sometimes just re-run works ffjson failed to force regenerate, sometimes just re-run works Jul 3, 2018
@erikdubbelboer
Copy link
Contributor

Looks like its no longer maintained no. Some of the pull requests and issues are easy to deal with and would have been if it was still maintained 😢

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