Search code examples
sublimetext3sublimelintergosublimegolint

GoSublime/GoLint caching Import Packages?


Does SublimeText 3 / GoSublime have some type of caching of Go import packages? If so, how do I clear it on demand?

I ask because while writing a custom package that is under Github source control, it works until I refactor a func or struct. Then, back at my main app (of where I import this package) it lights up like a Christmas tree when I start using the new methods.

GoSublime (or GoLint?) does not pick up the refactored func changes, and everything shows as an error. But yet, I can go to a prompt and run go build and go test just fine - the Go tool works fine.

The only thing I have been able to nail down is after about 24 hours it seems to work?

OSX 10.9
SublimeText 3
GoSublime
sublimelint **<- DO I NEED THIS?  SAYS IT IS FOR HIGHLIGHTING**
SublimeLinter
SublimeLinter-contrib-GoLint
SublimeLinter-contril-GoType
(and a few other packages)

I'm a SublimeText novice; but, I believe I have everything linked up and the required packages installed. Sublime's console shows no errors in the Linters (says it find gotype and golint).

SublimeLinter: gotype activated: /Users/user1/go/bin/gotype SublimeLinter: golint activated: /Users/user1/go/bin/golint

Things work beautifully within the package itself. It's not only my remote app. In my package, I have an "/examples" directory of tests that doesn't even pick up the changes in the root package. But again, the actual Go tool does and builds and runs all tests using the new refactored code.

It is GoSublime/GoLint that is caching the import's schema/package details. How do I clear that?

Thanks!


Solution

  • Coming back to answer myself this after 5 months of no answers...

    @dave-cheney himself replied to a Google Groups message I posted on this subject:

    https://groups.google.com/forum/#!topic/golang-nuts/N3xB6PGs3wo

    Resolution:

    • That code, even one-off tooling for other projects, must live in your $GOPATH/src. I have changed all projects to be in the $GOPATH/src/privatedomain/etc, and updated build scripts to just deploy the executable to those other repos (and commit them). Learn to work with the tools, not fight it. :)

    • You need to run go install [package] on those locally developed packages for their changes to show up immediately in your current Sublime project. There is still a long day-long delay that happens though if you don't run go install that the changes are picked up in other tools/packages within Sublime. "go install" works to get around this every time so no big deal (*see next bullet point).

    • In Sublime, I often run go install [package] and then close/re-open the current file I am working on to pick up the changes.

    Note that you don't have to be online for the go install [package] - if the package is local that is (e.g. in development). So, this was the answer to my environment since I do a lot of development offline (commuting).