Comments (7)
Hm. I've had problems with goimports removing needed imports in the past, but I haven't had any trouble with the current version. So you're saying it behaves differently than on the command line? Do you perhaps have multiple copies of goimports with TextMate picking up an outdated copy?
Do you have TM_GOFMT set to the full path to goimports?
from golang.tmbundle.
I saw that my TM_GODOC was pointing to /usr/local/Cellar/go/1.4.1/libexec/bin/godoc, which no longer exists. Not sure if that's related, don't see how it could be, but I fixed it to point to 1.5.1, the version I have installed now.
I now have:
TM_GOCODE=/Users/myuser/bin/gocode
TM_GODOC=/usr/local/Cellar/go/1.5.1/libexec/bin/godoc
TM_GOFMT=/Users/myuser/bin/goimports
TM_GOPATH=/Users/myuser
Are those right? I kind of fumbled through setting stuff to get things to work.
I don't see the problem right now in the files I have open, but I'll post back here if I see it again in the next few days.
Thanks for responding!
from golang.tmbundle.
Come to think of it, it would be really helpful for the README to say which environment variables should be set to what.
from golang.tmbundle.
Yes, it sure would. Or at least what environment variables there are to set. The values will depend on how you installed Go, but perhaps there could be suggestions for the common installations?
I bet @syscrusher would accept a PR. 😉
from golang.tmbundle.
Still seeing it. For example:
$ go build
$
[Save with no changes in TextMate, which then removes an import]
$ go build
# my/import/path
./foo.go:123: undefined: bar in bar.Baz
$ goimports -e -l -w
foo.go
$ go build
$
Don't know if this could be related, but the import removed is for a package with a name different than its directory name (e.g. directory "go-foo" for package "foo"). If I add an alias for the package, the import is no longer removed and the behavior matches that on the command line.
from golang.tmbundle.
I'm seeing some strange behavior. If I Ctrl-Shift-H (goimports), the package with the name that doesn't match the directory name (e.g. go-foo) immediately disappears, then the editor freezes for a couple seconds (I suspect this is because it's a somewhat large file) and then the import pops in again. I can keep invoking goimports like that it over and over and that happens every time. If I Cmd-S save, it removes the import but doesn't bring it back, and saving again doesn't change anything. If I goimports after that, it behaves as described before.
from golang.tmbundle.
Looked into how goimports
works and figured it out. I removed all variables except PATH
, prefixed PATH
with $PATH:
, and then added the GOPATH
variable. So now I have:
PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/go/1.5.1/libexec/bin:/Users/Will/bin
GOPATH=/Users/Will
from golang.tmbundle.
Related Issues (17)
- Empty TM_GOPATH breaks compilation HOT 4
- Doesn't work for me at all HOT 3
- Run multiple or all missing HOT 2
- env: ruby18: No such file or directory HOT 2
- Does not show completion windows from go-code HOT 4
- Stopped working Complete command HOT 5
- Setting TM_GOFMT to goimports binary removes imports with go- prefix HOT 2
- Current bundle lacks mandatory keys in property list file HOT 1
- Grammar: Invalid includes #storage_type|#storage_modifier HOT 1
- Syntax highlighting is wrong HOT 5
- Add "rune" type to the syntax
- Preference-Variables not working... HOT 8
- Gocode server does not exit with text mate HOT 2
- Code Completion Key Bindings
- Failure running "run". HOT 4
- Documentation doesn't work for types or non-standard packages HOT 2
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 golang.tmbundle.