Last active
September 25, 2018 10:35
-
-
Save myitcv/10b13ce65e6655bdadc68e3c1ba719d7 to your computer and use it in GitHub Desktop.
gocode and godef issue repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ export GOPATH=/tmp/tmp.INWBhiKAgt | |
$ cd /tmp/tmp.eoCQw0fOCT | |
$ mkdir hello | |
$ cd hello | |
$ export GOBIN=/tmp/tmp.opPK4KUGiw/hello/.bin | |
$ export PATH=/tmp/tmp.opPK4KUGiw/hello/.bin:/root/bin:/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
$ go mod init example.com/hello | |
go: creating new go.mod: module example.com/hello | |
$ echo "package main" >pkg.go | |
$ go get github.com/ianthehat/[email protected] | |
go: finding github.com/ianthehat/godef v0.0.0-20180914195550-76b7574367a8 | |
go: downloading github.com/ianthehat/godef v0.0.0-20180914195550-76b7574367a8 | |
go: finding golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e | |
go: downloading golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e | |
go: finding 9fans.net/go v0.0.0-20180727211846-5d4fa602e1e8 | |
go: downloading 9fans.net/go v0.0.0-20180727211846-5d4fa602e1e8 | |
$ go get github.com/stamblerre/[email protected] | |
go: finding github.com/stamblerre/gocode v0.0.0-20180923230339-b960ec24cf79 | |
go: downloading github.com/stamblerre/gocode v0.0.0-20180923230339-b960ec24cf79 | |
$ go list -m all | |
example.com/hello | |
9fans.net/go v0.0.0-20180727211846-5d4fa602e1e8 | |
github.com/ianthehat/godef v0.0.0-20180914195550-76b7574367a8 | |
github.com/stamblerre/gocode v0.0.0-20180923230339-b960ec24cf79 | |
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e | |
$ echo 'cGFja2FnZSBtYWluCgppbXBvcnQgKAoJImZtdCIKCSJzdHJpbmdzIgopCgpmdW5jIG1haW4oKSB7 | |
CglzIDo9IFtdc3RyaW5neyJ0ZXN0IiwgImFnYWluIn0KCWZtdC5QcmludGxuKHN0cmluZ3MuSm9p | |
bihzLCAiICIpKQp9Cg==' | base64 --decode >main.go | |
$ offset=113 | |
$ cat main.go | |
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
s := []string{"test", "again"} | |
fmt.Println(strings.Join(s, " ")) | |
} | |
$ tail -c +113 main.go | |
oin(s, " ")) | |
} | |
$ cat main.go | godef -f main.go -o 113 | |
/go/src/strings/strings.go:420:1 | |
$ gocode -in /tmp/tmp.opPK4KUGiw/hello/main.go autocomplete /tmp/tmp.opPK4KUGiw/hello/main.go 113 | |
Found 1 candidates: | |
func Join(a []string, sep string) string | |
$ echo 'Ly8gYSBwYWNrYWdlIGNvbQpwYWNrYWdlIG1haW4KCmltcG9ydCAoCgkiZm10IgoJInN0cmluZ3Mi | |
CikKCmZ1bmMgbWFpbigpIHsKCXMgOj0gW11zdHJpbmd7InRlc3QiLCAiYWdhaW4ifQoJZm10LlBy | |
aW50bG4oc3RyaW5ncy5Kb2luKHMsICIgIikpCn0K' | base64 --decode >main.go | |
$ offset=130 | |
$ cat main.go | |
// a package com | |
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
s := []string{"test", "again"} | |
fmt.Println(strings.Join(s, " ")) | |
} | |
$ tail -c +130 main.go | |
oin(s, " ")) | |
} | |
$ cat main.go | godef -f main.go -o 130 | |
2018/09/24 08:58:03 internal error: error "cursor 130 is beyond end of file /tmp/tmp.opPK4KUGiw/hello/main.go (126)" (*errors.errorString) without position | |
godef: no node found at search pos | |
$ gocode -in /tmp/tmp.opPK4KUGiw/hello/main.go autocomplete /tmp/tmp.opPK4KUGiw/hello/main.go 130 | |
Found 1 candidates: | |
func Join(a []string, sep string) string | |
$ echo 'Ly8gK2J1aWxkIGlnbm9yZQoKcGFja2FnZSBtYWluCgppbXBvcnQgKAoJImZtdCIKCSJzdHJpbmdz | |
IgopCgpmdW5jIG1haW4oKSB7CglzIDo9IFtdc3RyaW5neyJ0ZXN0IiwgImFnYWluIn0KCWZtdC5Q | |
cmludGxuKHN0cmluZ3MuSm9pbihzLCAiICIpKQp9Cg==' | base64 --decode >main.go | |
$ offset=131 | |
$ cat main.go | |
// +build ignore | |
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
s := []string{"test", "again"} | |
fmt.Println(strings.Join(s, " ")) | |
} | |
$ tail -c +131 main.go | |
oin(s, " ")) | |
} | |
$ cat main.go | godef -f main.go -o 131 | |
godef: There must be at least one package that contains the file | |
$ gocode -in /tmp/tmp.opPK4KUGiw/hello/main.go autocomplete /tmp/tmp.opPK4KUGiw/hello/main.go 131 | |
Nothing to complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export GOPATH=$(mktemp -d) | |
cd $(mktemp -d) | |
mkdir hello | |
cd hello | |
export GOBIN=$PWD/.bin | |
export PATH=$GOBIN:$PATH | |
go mod init example.com/hello | |
echo "package main" > pkg.go | |
go get github.com/ianthehat/[email protected] | |
go get github.com/stamblerre/[email protected] | |
go list -m all | |
echo 'cGFja2FnZSBtYWluCgppbXBvcnQgKAoJImZtdCIKCSJzdHJpbmdzIgopCgpmdW5jIG1haW4oKSB7 | |
CglzIDo9IFtdc3RyaW5neyJ0ZXN0IiwgImFnYWluIn0KCWZtdC5QcmludGxuKHN0cmluZ3MuSm9p | |
bihzLCAiICIpKQp9Cg==' | base64 --decode > main.go | |
offset=113 | |
cat main.go | |
tail -c +$offset main.go | |
cat main.go | godef -f main.go -o $offset | |
gocode -in $PWD/main.go autocomplete $PWD/main.go $offset | |
echo 'Ly8gYSBwYWNrYWdlIGNvbQpwYWNrYWdlIG1haW4KCmltcG9ydCAoCgkiZm10IgoJInN0cmluZ3Mi | |
CikKCmZ1bmMgbWFpbigpIHsKCXMgOj0gW11zdHJpbmd7InRlc3QiLCAiYWdhaW4ifQoJZm10LlBy | |
aW50bG4oc3RyaW5ncy5Kb2luKHMsICIgIikpCn0K' | base64 --decode > main.go | |
offset=130 | |
cat main.go | |
tail -c +$offset main.go | |
cat main.go | godef -f main.go -o $offset | |
gocode -in $PWD/main.go autocomplete $PWD/main.go $offset | |
echo 'Ly8gK2J1aWxkIGlnbm9yZQoKcGFja2FnZSBtYWluCgppbXBvcnQgKAoJImZtdCIKCSJzdHJpbmdz | |
IgopCgpmdW5jIG1haW4oKSB7CglzIDo9IFtdc3RyaW5neyJ0ZXN0IiwgImFnYWluIn0KCWZtdC5Q | |
cmludGxuKHN0cmluZ3MuSm9pbihzLCAiICIpKQp9Cg==' | base64 --decode > main.go | |
offset=131 | |
cat main.go | |
tail -c +$offset main.go | |
cat main.go | godef -f main.go -o $offset | |
gocode -in $PWD/main.go autocomplete $PWD/main.go $offset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export GOPATH=$(mktemp -d) | |
cd $(mktemp -d) | |
mkdir -p src/example.com/hello | |
cd src/example.com/hello | |
export GOBIN=$PWD/.bin | |
export PATH=$GOBIN:$PATH | |
echo "package main" > pkg.go | |
go get github.com/rogpeppe/godef | |
go get github.com/mdempsky/gocode | |
echo 'cGFja2FnZSBtYWluCgppbXBvcnQgKAoJImZtdCIKCSJzdHJpbmdzIgopCgpmdW5jIG1haW4oKSB7 | |
CglzIDo9IFtdc3RyaW5neyJ0ZXN0IiwgImFnYWluIn0KCWZtdC5QcmludGxuKHN0cmluZ3MuSm9p | |
bihzLCAiICIpKQp9Cg==' | base64 --decode > main.go | |
offset=113 | |
cat main.go | |
tail -c +$offset main.go | |
cat main.go | godef -f main.go -o $offset | |
gocode -in $PWD/main.go autocomplete $PWD/main.go $offset | |
echo 'Ly8gYSBwYWNrYWdlIGNvbQpwYWNrYWdlIG1haW4KCmltcG9ydCAoCgkiZm10IgoJInN0cmluZ3Mi | |
CikKCmZ1bmMgbWFpbigpIHsKCXMgOj0gW11zdHJpbmd7InRlc3QiLCAiYWdhaW4ifQoJZm10LlBy | |
aW50bG4oc3RyaW5ncy5Kb2luKHMsICIgIikpCn0K' | base64 --decode > main.go | |
offset=130 | |
cat main.go | |
tail -c +$offset main.go | |
cat main.go | godef -f main.go -o $offset | |
gocode -in $PWD/main.go autocomplete $PWD/main.go $offset | |
echo 'Ly8gK2J1aWxkIGlnbm9yZQoKcGFja2FnZSBtYWluCgppbXBvcnQgKAoJImZtdCIKCSJzdHJpbmdz | |
IgopCgpmdW5jIG1haW4oKSB7CglzIDo9IFtdc3RyaW5neyJ0ZXN0IiwgImFnYWluIn0KCWZtdC5Q | |
cmludGxuKHN0cmluZ3MuSm9pbihzLCAiICIpKQp9Cg==' | base64 --decode > main.go | |
offset=131 | |
cat main.go | |
tail -c +$offset main.go | |
cat main.go | godef -f main.go -o $offset | |
gocode -in $PWD/main.go autocomplete $PWD/main.go $offset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment