Comments (6)
@rdallman I've been thinking about this for a few weeks.
If there is a single main
file/function, so we can set the scope to that. The Go repo, for example, has a cmd
directory with several different commands, so there are actually several main
programs in that repo.
If we can find the repo root, it wouldn't be hard to parse through the source files, find all of the files in the main
package, and use those to set the scope. But we'd want to put this on a timeout -- don't search for more than, say, one second.
I haven't touched go/loader in a couple of years and forgot how it works (or doesn't). Do you have a sense of how well things work if we prime the loader with main
functions vs. the repo root directory?
I think Rename is the only refactoring where scope really matters, since we look for references across multiple files. The other refactorings only modify a single file.
from godoctor.
This needs to be updated for modules and get rid of the GOPATH lingo, reminding myself to at least update the README instructions. now we can probably crawl up to the root module which is probably the same thing as the git root (just need to get rid of GOPATH to deduce)
from godoctor.
Or go.mod
, whichever comes first?
from godoctor.
Even though git most certainly has won the VCS war, it feels wrong to me to have that be a requirement.
from godoctor.
Is it really too much to ask for people to run godoctor
from the root of their workspace, and if they can't, then explicity provide it? That's what gopls does, as far as I can tell.
from godoctor.
yea this is more of a convenience, none of this is defaulted or required. we do require setting scope to run a refactoring, I'm mostly referring to updating https://github.com/godoctor/godoctor.vim/#setting-scope-to-git-root in my comment, which is flexible and still allows setting scope per refactoring - I agree yea, want to change lingo to look for go.mod rather than .git once this all works.
from godoctor.
Related Issues (20)
- go get godoctor fails with Go v1.5 HOT 1
- godoctor rename issue HOT 4
- Move away from version numbers? HOT 3
- OpenRefactory JSON protocol documentation is missing HOT 3
- godoc refactoring adds unnecessary comment for types and ignores value declarations HOT 2
- Can't rename struct fields HOT 3
- Go Doctor interactive mode? HOT 2
- Function Extract failure HOT 7
- Extract Function failure - variable's previous value ignored HOT 2
- Named returns should be live at exit HOT 3
- Cut releases more frequently
- Is this tool actively mantained ? HOT 1
- Does it work with go modules? HOT 7
- Site down http://gorefactor.org/
- it seems like go module cannot work with "Extract to function" in vscode HOT 2
- godoctor causing dockerfile build failure HOT 4
- help!i can not complie master
- Manual not visible HOT 1
- Tests are broken HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godoctor.