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

Add a pre process goimports for golang project before really run_string. #252

Open
soluty opened this issue Sep 18, 2023 · 3 comments
Open

Comments

@soluty
Copy link

soluty commented Sep 18, 2023

Is your feature request related to a problem? Please describe.
#249 #248

Describe the solution you'd like
after generate main.go, before go run main.go, can add an optional process to use "goimports main.go", it can remove not used import.

Additional context
i wrote a litter tool gopick as an implementation for what i mentioned in #248 . it can really pick a
piece of go code, from a go project except, it will have unused imports. this could be easy fix by goimports (maybe most gopher has installed) before run main.go.

And With this, go's support will be really import level now, except some global init functions and variables that is go code's bad smell.

@soluty soluty changed the title Add a pre process goimports for golang object before really run_string. Add a pre process goimports for golang project before really run_string. Sep 18, 2023
@michaelb
Copy link
Owner

michaelb commented Sep 28, 2023

Nice stuff! I promise to look at it and do my best to make use of it in sniprun. How do you use it ? I can't really figure it out from the code only ?

Could you add a licence to the project so I can directly copy those files in sniprun? MIT or something similarly permissive would be good, since I don't want to rely on cloning a external repo at runtime

@soluty
Copy link
Author

soluty commented Oct 7, 2023

i am happy you like this.

gopick project now only usefull for little go project, it has two main disadvantage.

  1. if project is large, because of it should cal gopls bin, it will take a long time to pick really usefull code, for my project it will be one or two minute.
  2. now gopick has not concern about which function has parameters.

now i am rewriting this work in lua, because i think it can reuse lsp server and make it more faster so that will be more usefull for large project. when i have done this , i will add a license let you can directly copy those files in sniprun.

@michaelb
Copy link
Owner

michaelb commented Oct 7, 2023

indeed, 1-2 minute is long. How long does the whole project takes to compile at this point ?

Plugin-in the (supposed existing) already-running LSP server is most likely the correct design choice

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