GrantZheng / kit

GoKit CLI
MIT License
268 stars 54 forks source link

fix: fix comment disappear when missing import #34

Closed danie1Lin closed 2 years ago

danie1Lin commented 2 years ago

Need to add parse comment options, or all comments will disappear when the file is missing imports.

bootun commented 2 years ago

that's cool! at least this is my thought. but I'm not sure if it's necessary. I will inform the owner that you can get a reply faster :-)

danie1Lin commented 2 years ago

I think it is necessary because not only the comments I add will disappear (not in _gen.go subfix file, I comment in pkg/http/handler.go ), the comments generated from kit CLI also disappear. If you add another function again, only the comments of the new function will be generated.

bootun commented 2 years ago

you are right, just wait for the owner's approval.

danie1Lin commented 2 years ago

Thank you. :) Let me provide the reproducing step:

  1. add new function in the service interface
  2. delete an import library from pkg/http/handler.go (we encounter it when use the http mux first and turn to gorilla mux, so CLI think I need a github.com/gorilla/handlers library)
  3. run kit g s service --gorilla --dmw It will all disappear.