nsf / gocode Goto Github PK
View Code? Open in Web Editor NEWAn autocompletion daemon for the Go programming language
License: MIT License
An autocompletion daemon for the Go programming language
License: MIT License
When running make install, I am getting
make install
6g -o go.6 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
config.go:4: import /Users/Jacob/gocode/configfile.a: object is [darwin amd64 release.r56 7666] expected [darwin amd64 release.2011-03-07 7666]
make: *** [go.6] Error 1
I updated the go compiler to the latest version as well as the gocode source.
I am not so keen on make files. Can someone help me out?
(e.g. not '.a' but '.5' or '.6' or '.8')
Need to fix parser for that.
Gocode still have those.. sadly..
Find them all and fix them all...
I am not sure whether this is a gocode issue.I am using eclipse+goclipse.
I have a struct
type Struct1 struct {
Content string
Action string
}
1 s:=new(Struct1)
2 s.Content="花大把时间精力,金钱学习Oracle" <----Chinese
3 s.Action="SUPPORT"
For above code snippet(same package with Struct1),in line 3,"s."---->ctrl+space,nothing got popuped,but if switch line3 with line2,everything works fine.I have checked,in a page(or a go file),not only a function,once Chinese comes up,gocode doesn't work after this line.
lib-path merely overrides path to library.
adding path to packages would be great.
something like
$gocode set lib-path "/my/package/A/path;my/package/B/path" etc.
and just adding this paths to the search.
GOARCH=amd64
GOOS=linux
gocode version: aad94f
go version:
$ 6v -V
6g version 5777+
$ make install
gomake -C goremote
make[1]: Entering directory /home/temoto/src/gocode/goremote' /home/temoto/bin/6g -o _go_.6 goremote.go /home/temoto/bin/6l -o goremote _go_.6 make[1]: Leaving directory
/home/temoto/src/gocode/goremote'
./goremote/goremote server.go > rpc.go
gomake -C goconfig
make[1]: Entering directory /home/temoto/src/gocode/goconfig' /home/temoto/bin/6g -o _go_.6 configfile.go configfile.go:307: cannot use perm (type uint32) as type int in function argument make[1]: *** [_go_.6] Error 1 make[1]: Leaving directory
/home/temoto/src/gocode/goconfig'
make: *** [configfile.a] Error 2
If a type contains an anonymous field, methods of that field are being proposed, but not the field itself.
Example:
var hosts struct {
sync.Mutex
data map[string][]string
time int64
path string
}
Methods of sync.Mutex are being proposed, but not the Mutex field itself. It is legal to access that field directly, e.g.: hosts.Mutex.Lock()
OK, this actually is not a bug, but it would be great if you could mention it in the README file somehow - there are systems out there, where make
is not the GNU one (e. g. FreeBSD). On these systems, gmake install
would be the correct invocation.
import . "go/ast"
This doesn't work. Need to fix that.
Hi,
in your last commit you changed the following:
_, err = os.ForkExec(path, args, os.Environ(), "", []_os.File{nil, nil, nil})
to:
_, err = os.StartProcess(path, args, os.Environ(), "", []_os.File{nil, nil, nil})
Now i get a error at line 270:
gocode.go:270: undefined: os.StartProcess
I still works with the old pice of code.
Moddus
Hello,
You've got support in gocode for setting a lib-path in a config file, and support
for automatically picking up GOROOT and piecing together the path to the
pkg/${GOOS}_${GOARCH} directory.
I was wondering if you've considered adding in support for GOPATH, the new
variable used by goinstall to allow the separation of the go src tree from local
packages?
For example, gocode might check for lib-path, then fall back to checking for
GOPATH, and finally fall back to checking for GOROOT.
Jim
A good example for that is reflect.*Value types. Autocompletion proposal on these doesn't include corresponding Value interface.
This bug is related to the type embedding. It caused by the fact that I intentionally ignore all unexported fields in imported modules (should fix that).
I've made an updated version of emacs config. It is tested and working. Please include it.
https://github.com/kodx/emacs.d/blob/master/plugins/go-autocomplete/go-autocomplete.el
hi all!
i get error when i try to make install gocode:
gocode$ make install
8g -o go.8 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
gocode.go:288: undefined: os.ProcAttr
gocode.go:289: not enough arguments in call to os.StartProcess
autocompletefile.go:239: lastCursorAfter.List undefined (type ast.CaseClause has no field or method List)
autocompletefile.go:240: lastCursorAfter.List undefined (type *ast.CaseClause has no field or method List)
make: ** [go.8] Error 1
go$ hg identify
b84e614e2516 weekly/weekly.2011-03-28
2.6.35-25-generic #44-Ubuntu
help plz!
$GOOS = linux
$GOARCH = 386
The error:
~/src/gocode$ make install
gomake -C goremote
make[1]: Entering directory /home/ali/src/gocode/goremote' 8g -o _go_.8 goremote.go goremote.go:19: undefined: reflect.Typeof make[1]: *** [_go_.8] Error 1 make[1]: Leaving directory
/home/ali/src/gocode/goremote'
make: *** [goremote/goremote] Error 2
And compiler version:
~/src/gocode$ 8g -V
8g version weekly.2011-04-13 8238
I'm getting this error:
nfa@b3:~/development/go$ gocode status
dial unix /tmp/acrserver.nfa: dial unix /tmp/acrserver.nfa: connection refused
Hi friend:
I been following all of steps for configure gocode with editor vim , and it not works.
only shows i.e. if I write "pack" then presents "package",
but if write "fmt." (not shows nothing)
any idea?
Hi,
First of all I'd like to say I'm completely new to go, so apologies if this report is stupid. I just find your package so nice that I really want to use it!
Anyways, I get "PANIC" as the only suggestion when completing from vim. Using gocode -s gives the following trace:
[joel@mouton test]$ gocode -s
panic: expected "@", got String ("""")
1(runtime.panic): /build/src/release-build/src/pkg/runtime/proc.c:1235
2(main.(_gcParser).error): /home/joel/workspace/gocode/package.go:256
3(main.(_gcParser).errorf): /home/joel/workspace/gocode/package.go:260
4(main.(_gcParser).expect): /home/joel/workspace/gocode/package.go:267
5(main.(_gcParser).parseExportedName): /home/joel/workspace/gocode/package.go:331
6(main.(_gcParser).parseConstDecl): /home/joel/workspace/gocode/package.go:648
7(main.(_gcParser).parseDecl): /home/joel/workspace/gocode/package.go:803
8(main.(_gcParser).parseExport): /home/joel/workspace/gocode/package.go:832
9(main.(_PackageFileCache).processPackageData): /home/joel/workspace/gocode/package.go:131
10(main.(*PackageFileCache).updateCache): /home/joel/workspace/gocode/package.go:89
11(main._func_008): /home/joel/workspace/gocode/autocompletecontext.go:283
12(runtime.goexit): /build/src/release-build/src/pkg/runtime/proc.c:246
panic: One of the package cache updaters panicked
1(runtime.panic): /build/src/release-build/src/pkg/runtime/proc.c:1235
2(main.updatePackages): /home/joel/workspace/gocode/autocompletecontext.go:291
3(main.(_AutoCompleteContext).updateCaches): /home/joel/workspace/gocode/autocompletecontext.go:159
4(main.(_AutoCompleteContext).Apropos): /home/joel/workspace/gocode/autocompletecontext.go:209
5(main.Server_AutoComplete): /home/joel/workspace/gocode/server.go:82
6(main.(_RPCRemote).RPCServer_AutoComplete): /home/joel/workspace/gocode/rpc.go:27
7(reflect.internalValue.call): /build/src/release-build/src/pkg/reflect/value.go:583
8(reflect.Value.Call): /build/src/release-build/src/pkg/reflect/value.go:433
9(rpc.(_service).call): /build/src/release-build/src/pkg/rpc/server.go:341
10(runtime.goexit): /build/src/release-build/src/pkg/runtime/proc.c:246
I'm using go r60 as packaged by Arch Linux, and the git version of your package. Any idea what might be wrong?
"go/parser".ParseExpr is broken due to a bug.
Feel free to ignore this suggestion, but many people use things like pathogen to manage their vim bundles and it helps to be able to point a git submodule to a folder that has just the vim code. It would be nice if your vim folder was a submodule of a branch of gocode so that people can submodule gocode into their vim bundles without having to change anything.
I did an example of what I mean in my fork:
https://github.com/doug/gocode
Which as an example I submodule into something like this:
https://github.com/doug/vimfiles
If there is a better way to do this I'm all ears.
I get the following error when running make install.
8g -o go.8 goremote.go
8l -o goremote go.8
make[1]: Leaving directory /home/dave/gocode/goremote' ./goremote/goremote server.go | gofmt > rpc.go gomake -C goconfig make[1]: Entering directory
/home/dave/gocode/goconfig'
8g -o go.8 configfile.go
rm -f _obj/configfile.a
gopack grc _obj/configfile.a go.8
make[1]: Leaving directory `/home/dave/gocode/goconfig'
cp goconfig/_obj/configfile.a .
8g -o go.8 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
gocode.go:288: undefined: os.ProcAttr
gocode.go:289: not enough arguments in call to os.StartProcess
autocompletefile.go:239: lastCursorAfter.List undefined (type ast.CaseClause has no field or method List)
autocompletefile.go:240: lastCursorAfter.List undefined (type *ast.CaseClause has no field or method List)
make: ** [go.8] Error 1
I'm using GNU make 3.81. Fresh install of go.
Let me know if you need any more information.
I've made a big mistake using panic/recover in a wrong way. And now after I've added goroutines stuff in the gocode it may actually die because of panic. Need to fix that somehow.
Would you consider tagging your repository with names that match the go tags?
I know that the go source is in hg and gocode is in git, but if you could have some indication which release you've built against, that would be really helpful.
Hi,
I'm interested in providing autocomplete support for the SciTE editor. Passing the current cursor position and file, and parsing the output for a drop-down is not likely to be difficult. But I have hit an immediate snag: I always get a panic in the server by invoking 'gocode autocomplete full-path-to.go cursor-pos' directly.
This appears in ripper.go, line 40, presumably out of range on the slice there.
(Using the latest Go release )
steve d.
I would find it useful for the vim configuration to be installable by pathogen. I believe the vim/ directory just needs to be split out to a top level directory.
Regards,
Ryan
It is broken, and it cannot be fixed with gofix. I don't have time to do that. What's more sadly, it's broken because of the change in packages format, my parser simply cannot parse Go's libraries anymore. Suddenly in interfaces there are entries like:
"reflect".common() *"reflect".commonType
And it doesn't make sense to me. Frankly, I don't want to know, since I don't use Go anymore.
Feel free to fix it by yourself or better fork gocode and maintain it.
Hi,
when I run make, I get this:
make
gomake -C goremote
6l -o goremote go.6
panic: asmand: bad address (GS)
panic: asmand: bad address (GS)
schedinit: asmand: bad address 8(GS)
schedinit: asmand: bad address 8(GS)
schedinit: asmand: bad address 8(GS)
goexit: asmand: bad address (GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
mstart: asmand: bad address (GS)
mstart: asmand: bad address 8(GS)
mstart: asmand: bad address 8(GS)
mstart: asmand: bad address 8(GS)
too many errors
make[1]: *** [goremote] Error 1
make: *** [goremote/goremote] Error 2
I'm running Mac OS X 10.6.4, with the latest go from the repository.
If you have something like this:
type MyMap map[string]int
...
var test MyMap
for key, value := range test {
}
will not work..
Fix that by introducing better type inference scheme for special cases (for range statement).
I am using gocode via GoSublime, but I've tested this out by running gocode manually as well.
Consider the following program:
package main
import (
"os"
)
// U+03C0: π
func main() {
os.
}
If I ask gocode for autocomplete suggestions at position 65 (right after 'os.') it returns
[2, [{"class": "package", "name": "os", "type": ""}]]
If I ask gocode for autocomplete suggestions at position 66 (the next line, right before the '}') it returns everything from the os package. If the 'π' is replaced by any ASCII character the autocomplete returns all of this at position 65 as expected.
While doing autocomplete within certain files, sometimes it would fail by just supplying PANIC
as the only completion. Here is an example with fmt
:
package main
import (
"fmt"
)
func main() {
fmt.PANIC
println("Hello, world!")
}
Here is the error as reported by gocode -s
:
panic: runtime error: invalid memory address or nil pointer dereference
1(runtime.panic): /Users/sday/go/src/pkg/runtime/proc.c:1010
2(runtime.panicstring): /Users/sday/go/src/pkg/runtime/runtime.c:86
3(runtime.sigpanic): /Users/sday/go/src/pkg/runtime/darwin/thread.c:460
4(main.filePackageName): /Users/sday/go/gocode/autocompletecontext.go:398
5(main.findOtherPackageFiles): /Users/sday/go/gocode/autocompletecontext.go:387
6(main.getOtherPackageFiles): /Users/sday/go/gocode/autocompletecontext.go:332
7(main._AutoCompleteContext·updateCaches): /Users/sday/go/gocode/autocompletecontext.go:153
8(main._AutoCompleteContext·Apropos): /Users/sday/go/gocode/autocompletecontext.go:208
9(main.Server_AutoComplete): /Users/sday/go/gocode/server.go:85
10(main._RPCRemote·RPCServer_AutoComplete): /Users/sday/go/gocode/rpc.go:25
11(reflect._FuncValue·Call): /Users/sday/go/src/pkg/reflect/value.go:817
12(rpc.*service·call): /Users/sday/go/src/pkg/rpc/server.go:335
13(runtime.goexit): /Users/sday/go/src/pkg/runtime/proc.c:142
The problem arises when one has a directory named with the extension .go
in the current directory:
$ ls -l
total 8
drwxr-xr-x 2 sday staff 68 Dec 5 12:36 somedir.go
-rw-r--r-- 1 sday staff 73 Dec 5 12:36 test.go
In this case, parser.ParseFile
returns nil
, with an error and the daemon panics when trying to dereference the nil
value. A simple fix like this solved the problem:
diff --git a/autocompletecontext.go b/autocompletecontext.go
index 7e3b8dd..aeb9a0b 100644
--- a/autocompletecontext.go
+++ b/autocompletecontext.go
@@ -395,7 +395,13 @@ func findOtherPackageFiles(filename, packageName string) []string {
}
func filePackageName(filename string) string {
- file, _ := parser.ParseFile(filename, nil, parser.PackageClauseOnly)
+ file, err := parser.ParseFile(filename, nil, parser.PackageClauseOnly)
+
+ if err != nil {
+ fmt.Printf("Error parsing %s: %v\n", filename, err)
+ return ""
+ }
+
return file.Name.Name
}
However, you may want to not even pass directories to this function.
I use “8g version weekly.2011-03-15 7807” to make the gocode.
But I got:
8g -o go.8 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
autocompletefile.go:230: undefined: ast.TypeCaseClause
autocompletefile.go:232: undefined: ast.TypeCaseClause
autocompletefile.go:246: typechecking loop
make: *** [go.8] error 1
http://golang.org/doc/go_spec.html#Method_expressions
Example:
package main
import (
"fmt"
)
type Int int
func (i Int) String() string {
return fmt.Sprint(int(i))
}
func main() {
f := Int.String
// here gocode thinks that 'f' is: 'func() string'
// but in reality it is: 'func(i Int) string'
}
Even though method expressions are rarely used, I need to fix that too.
it would be cool if gocode could ignore the
#!/usr/bin/gorun
line, so that it works with gorun scripts.
As there exists an alternative to gorun maybe it would be good just to ignore #!/bin/ when it's in the first line.
In following code, and cursor at //
package main
type Foo struct {
Boo func();
Baz string;
}
func foo() *Foo {
return &Foo {}
}
func main() {
foo(). // type CTRL-X CTRL-O in vim
}
it make candidate PANIC PANIC PANIC
OS: Ubutnu 10.10 amd64
COMPILER: 6g version release.r57.2 8306
I got this error
6g -o go.6 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
os_posix.go:14: undefined: os.Signal
os_posix.go:19: undefined: os.SIGINT
os_posix.go:19: undefined: os.SIGTERM
make: *** [go.6] Error 1
Hi, gocode panic on windows on any unit that tries to import path/filepath :
fail.go:
package main
import "path/filepath"
gocode -in fail.go autocomplete 1
I am trying to compile the code, but once I download gocode, I get an error:
$ cd gocode
$ make
Makefile:1: /src/Make.inc: No such file or directory
Makefile:24: /src/Make.cmd: No such file or directory
make: *** No rule to make target `/src/Make.cmd'. Stop.
How can I compile the code?
ref: http://code.google.com/p/golangide/issues/detail?id=28
It seems require to modify
gocode/os_posix.go
I use a notion of a 'module' everywhere in the gocode. It should be renamed to a 'package'. Probably a good way to test future refactoring capabilities.
6g version weekly.2011-04-04 8081
GOOS=darwin
GOARCH=amd64
6g -o go.6 configfile.go
configfile.go:256: too many arguments in call to os.Open
configfile.go:307: undefined: os.O_CREAT
configfile.go:307: too many arguments in call to os.Open
make[1]: *** [go.6] Error 1
make: *** [configfile.a] Error 2
config.go:107: invalid operation: nm == name (mismatched types reflect.StructTag and string)
config.go:179: cannot use name (type reflect.StructTag) as type string in function argument
Go's been updated so that tags on fields are not simple strings, but encoded key-value pairs.
type Foo struct {
bar int "This is not a description"
baz int "desc": "This is a correct tag"
}
The first tag cannot be retrieved from the reflection API.
Could it be possible to detect the type with :=?
a := myfunc() should be form the type of return of the function.
Regards
Things like:
var file *file
don't work.
For an example of real code with that see: $GOROOT/src/pkg/net/hosts.go
I get the following error message when trying to compile gocode on Mac Os X, 10.6 snow leopard, mac book pro.
6g -o go.6 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
gocode.go:288: undefined: os.ProcAttr
gocode.go:289: not enough arguments in call to os.StartProcess
autocompletefile.go:239: lastCursorAfter.List undefined (type ast.CaseClause has no field or method List)
autocompletefile.go:240: lastCursorAfter.List undefined (type *ast.CaseClause has no field or method List)
make: ** [go.6] Error 1
I have checked the paths etc.
Isn't implemented. Need to fix that for sanity. Low priority.
~/gocode$ make install
gomake -C goremote
make[1]: Entering directory /home/xxx/gocode/goremote' 6g -o _go_.6 goremote.go goremote.go:221: undefined: token.NewFileSet goremote.go:222: cannot use nil as uint goremote.go:222: cannot convert nil to type uint goremote.go:222: cannot use nil as type uint in function argument goremote.go:222: too many arguments to function call make[1]: *** [_go_.6] Error 1 make[1]: Leaving directory
/home/xxx/gocode/goremote'
make: *** [goremote/goremote] Error 2
First of all,thank you for fantastic work.
Eclipse+gocode is used here.Two suggestions:
1,After picking a suggested entry,parentheses should be added automatically.
2,Handle case issue.I mean,when type 'p',both suggestions that begins with 'P' and 'p' should be shown,of course,sorting them.And if no suggestions begins with 'p',show entries begins with 'P'...
Trying to install gocode using goinstall, one gets the following error message:
$ goinstall github.com/nsf/gocode
goinstall: : path "~/configfile" not inside a GOPATH
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.