Giter Site home page Giter Site logo

stamblerre / gocode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mdempsky/gocode

394.0 20.0 28.0 1.62 MB

An autocompletion daemon for the Go programming language

License: MIT License

Go 65.93% Emacs Lisp 19.86% Vim Script 5.56% Shell 1.89% Python 6.77%

gocode's Issues

Autocomplete/intellisense <=50% success rate with gocode-gomod

From @gabstv on November 29, 2018 12:25

With the same source code, the intellisense fails to bring relevant results at least 50% of the time.

This happens with the default gocode that VSCode uses.

go version go1.11 darwin/amd64

Run 1 - no suggestions

2018/11/29 10:14:13 Got autocompletion request for '/Users/gabs/proggit/groove/pkg/groove/gcs/spriteanimation.go'
2018/11/29 10:14:13 Cursor at: 4122
2018/11/29 10:14:13 -------------------------------------------------------
package gcs

import (
	"image"

	"github.com/gabstv/ecs"
	"github.com/gabstv/groove/pkg/groove"
	"github.com/gabstv/groove/pkg/groove/common"
	"github.com/hajimehoshi/ebiten"
)

// AnimClipMode determines how time is treated outside of the keyframed range of an animation clip.
type AnimClipMode byte

const (
	// AnimOnce - When time reaches the end of the animation clip, the clip will automatically
	// stop playing and time will be reset to beginning of the clip.
	AnimOnce AnimClipMode = 0
	// AnimStop - When time reaches the end of the animation clip, the clip will automatically
	// stop playing and time will be locked to the last played frame.
	AnimStop AnimClipMode = 1
	// AnimLoop - When time reaches the end of the animation clip, time will continue at the beginning.
	AnimLoop AnimClipMode = 2
	// AnimPingPong - When time reaches the end of the animation clip, time will ping pong back between beginning
	// and end.
	AnimPingPong AnimClipMode = 3
	// AnimClampForever - Plays back the animation. When it reaches the end, it will keep playing the last frame
	// and never stop playing.
	//
	// When playing backwards it will reach the first frame and will keep playing that. This is useful for additive
	// animations, which should never be stopped when they reach the maximum.
	AnimClampForever AnimClipMode = 4
)

const (
	SpriteAnimationPriority int = -6
)

var (
	spriteanimationWC = &common.WorldComponents{}
)

func init() {
	groove.DefaultComp(func(e *groove.Engine, w *ecs.World) {
		//SpriteComponent(w)
	})
	groove.DefaultSys(func(e *groove.Engine, w *ecs.World) {
		//SpriteSystem(w)
	})
}

type SpriteAnimation struct {
	Enabled     bool
	Play        bool
	ActiveClip  int
	ActiveFrame int
	Clips       []SpriteAnimationClip
	T           float64
	// Default fps for clips with no fps specified
	Fps float64

	// caches
	lastClipsLen int
	clipMap      map[string]int
}

type SpriteAnimationClip struct {
	// The name of an animation is not allowed to be changed during runtime
	// but since this is part of a component (and components shouldn't have logic),
	// it is a public member.
	Name   string
	Frames []image.Rectangle
	Fps    float64
	ClipMode AnimClipMode
}

// SpriteAnimationComponent will get the registered sprite anim component of the world.
// If a component is not present, it will create a new component
// using world.NewComponent
func SpriteAnimationComponent(w *ecs.World) *ecs.Component {
	c := spriteanimationWC.Get(w)
	if c == nil {
		var err error
		c, err = w.NewComponent(ecs.NewComponentInput{
			Name: "groove.gcs.SpriteAnimation",
			ValidateDataFn: func(data interface{}) bool {
				_, ok := data.(*SpriteAnimation)
				return ok
			},
			DestructorFn: func(_ *ecs.World, entity ecs.Entity, data interface{}) {
				sd := data.(*SpriteAnimation)
				sd.Clips = nil
			},
		})
		if err != nil {
			panic(err)
		}
		spriteanimationWC.Set(w, c)
	}
	return c
}

// SpriteAnimationSystem creates the sprite system
func SpriteAnimationSystem(w *ecs.World) *ecs.System {
	sys := w.NewSystem(SpriteAnimationPriority, SpriteAnimationSystemExec, spriteanimationWC.Get(w))
	if w.Get(DefaultImageOptions) == nil {
		opt := &ebiten.DrawImageOptions{}
		w.Set(DefaultImageOptions, opt)
	}
	sys.AddTag(groove.WorldTagUpdate)
	return sys
}

// SpriteAnimationSystemExec is the main function of the SpriteSystem
func SpriteAnimationSystemExec(dt float64, v *ecs.View, s *ecs.System) {
	world := v.World()
	matches := v.Matches()
	spriteanimcomp := spriteanimationWC.Get(world)
	globalfps := ebiten.CurrentFPS()
	//engine := world.Get(groove.EngineKey).(*groove.Engine)
	for _, m := range matches {
		spranim := m.Components[spriteanimcomp].(*SpriteAnimation)
		if !spranim.Enabled || !spranim.Play {
			continue
		}
		clip := spranim.Clips[spranim.ActiveClip]
		localfps := nonzeroval(clip.Fps, spranim.Fps, globalfps)
		localdt := (dt * localfps) / globalfps
		spranim.T += localdt
		if spranim.T >= 1 {
			// next frame
			nextframe := spranim.ActiveFrame + 1
			spranim.T -= 1
			if nextframe >= len(clip.Frames) {
				// animation ended
				switch clip.ClipMode {
					case AnimO#
				}
			}
		}
	}
}
2018/11/29 10:14:13 -------------------------------------------------------
2018/11/29 10:14:13 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/sprite.go:21:6:missing function body
2018/11/29 10:14:13 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/spriteanimation.go:43:6:missing function body
2018/11/29 10:14:13 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/transform.go:18:6:missing function body
2018/11/29 10:14:13 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/spriteanimation.go:137:11:undeclared name: AnimO
2018/11/29 10:14:13 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/math.go:26:2:"fmt" imported but not used
2018/11/29 10:14:13 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/math.go:27:2:"math" imported but not used
2018/11/29 10:14:13 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/sprite.go:7:2:"github.com/gabstv/groove/pkg/groove" imported but not used
2018/11/29 10:14:13 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/spriteanimation.go:7:2:"github.com/gabstv/groove/pkg/groove" imported but not used
2018/11/29 10:14:13 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/transform.go:5:2:"github.com/gabstv/groove/pkg/groove" imported but not used
2018/11/29 10:14:13 Elapsed duration: 524.880257ms
2018/11/29 10:14:13 Offset: 0
2018/11/29 10:14:13 Number of candidates found: 0
2018/11/29 10:14:13 Candidates are:
2018/11/29 10:14:13 =======================================================

Run 2 - success

2018/11/29 10:15:46 Got autocompletion request for '/Users/gabs/proggit/groove/pkg/groove/gcs/spriteanimation.go'
2018/11/29 10:15:46 Cursor at: 4122
2018/11/29 10:15:46 -------------------------------------------------------
package gcs

import (
	"image"

	"github.com/gabstv/ecs"
	"github.com/gabstv/groove/pkg/groove"
	"github.com/gabstv/groove/pkg/groove/common"
	"github.com/hajimehoshi/ebiten"
)

// AnimClipMode determines how time is treated outside of the keyframed range of an animation clip.
type AnimClipMode byte

const (
	// AnimOnce - When time reaches the end of the animation clip, the clip will automatically
	// stop playing and time will be reset to beginning of the clip.
	AnimOnce AnimClipMode = 0
	// AnimStop - When time reaches the end of the animation clip, the clip will automatically
	// stop playing and time will be locked to the last played frame.
	AnimStop AnimClipMode = 1
	// AnimLoop - When time reaches the end of the animation clip, time will continue at the beginning.
	AnimLoop AnimClipMode = 2
	// AnimPingPong - When time reaches the end of the animation clip, time will ping pong back between beginning
	// and end.
	AnimPingPong AnimClipMode = 3
	// AnimClampForever - Plays back the animation. When it reaches the end, it will keep playing the last frame
	// and never stop playing.
	//
	// When playing backwards it will reach the first frame and will keep playing that. This is useful for additive
	// animations, which should never be stopped when they reach the maximum.
	AnimClampForever AnimClipMode = 4
)

const (
	SpriteAnimationPriority int = -6
)

var (
	spriteanimationWC = &common.WorldComponents{}
)

func init() {
	groove.DefaultComp(func(e *groove.Engine, w *ecs.World) {
		//SpriteComponent(w)
	})
	groove.DefaultSys(func(e *groove.Engine, w *ecs.World) {
		//SpriteSystem(w)
	})
}

type SpriteAnimation struct {
	Enabled     bool
	Play        bool
	ActiveClip  int
	ActiveFrame int
	Clips       []SpriteAnimationClip
	T           float64
	// Default fps for clips with no fps specified
	Fps float64

	// caches
	lastClipsLen int
	clipMap      map[string]int
}

type SpriteAnimationClip struct {
	// The name of an animation is not allowed to be changed during runtime
	// but since this is part of a component (and components shouldn't have logic),
	// it is a public member.
	Name   string
	Frames []image.Rectangle
	Fps    float64
	ClipMode AnimClipMode
}

// SpriteAnimationComponent will get the registered sprite anim component of the world.
// If a component is not present, it will create a new component
// using world.NewComponent
func SpriteAnimationComponent(w *ecs.World) *ecs.Component {
	c := spriteanimationWC.Get(w)
	if c == nil {
		var err error
		c, err = w.NewComponent(ecs.NewComponentInput{
			Name: "groove.gcs.SpriteAnimation",
			ValidateDataFn: func(data interface{}) bool {
				_, ok := data.(*SpriteAnimation)
				return ok
			},
			DestructorFn: func(_ *ecs.World, entity ecs.Entity, data interface{}) {
				sd := data.(*SpriteAnimation)
				sd.Clips = nil
			},
		})
		if err != nil {
			panic(err)
		}
		spriteanimationWC.Set(w, c)
	}
	return c
}

// SpriteAnimationSystem creates the sprite system
func SpriteAnimationSystem(w *ecs.World) *ecs.System {
	sys := w.NewSystem(SpriteAnimationPriority, SpriteAnimationSystemExec, spriteanimationWC.Get(w))
	if w.Get(DefaultImageOptions) == nil {
		opt := &ebiten.DrawImageOptions{}
		w.Set(DefaultImageOptions, opt)
	}
	sys.AddTag(groove.WorldTagUpdate)
	return sys
}

// SpriteAnimationSystemExec is the main function of the SpriteSystem
func SpriteAnimationSystemExec(dt float64, v *ecs.View, s *ecs.System) {
	world := v.World()
	matches := v.Matches()
	spriteanimcomp := spriteanimationWC.Get(world)
	globalfps := ebiten.CurrentFPS()
	//engine := world.Get(groove.EngineKey).(*groove.Engine)
	for _, m := range matches {
		spranim := m.Components[spriteanimcomp].(*SpriteAnimation)
		if !spranim.Enabled || !spranim.Play {
			continue
		}
		clip := spranim.Clips[spranim.ActiveClip]
		localfps := nonzeroval(clip.Fps, spranim.Fps, globalfps)
		localdt := (dt * localfps) / globalfps
		spranim.T += localdt
		if spranim.T >= 1 {
			// next frame
			nextframe := spranim.ActiveFrame + 1
			spranim.T -= 1
			if nextframe >= len(clip.Frames) {
				// animation ended
				switch clip.ClipMode {
					case AnimO#
				}
			}
		}
	}
}
2018/11/29 10:15:46 -------------------------------------------------------
2018/11/29 10:15:46 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/sprite.go:21:6:missing function body
2018/11/29 10:15:46 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/spriteanimation.go:43:6:missing function body
2018/11/29 10:15:46 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/transform.go:18:6:missing function body
2018/11/29 10:15:46 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/spriteanimation.go:137:11:undeclared name: AnimO
2018/11/29 10:15:46 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/math.go:26:2:"fmt" imported but not used
2018/11/29 10:15:46 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/math.go:27:2:"math" imported but not used
2018/11/29 10:15:46 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/sprite.go:7:2:"github.com/gabstv/groove/pkg/groove" imported but not used
2018/11/29 10:15:46 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/spriteanimation.go:7:2:"github.com/gabstv/groove/pkg/groove" imported but not used
2018/11/29 10:15:46 error in package github.com/gabstv/groove/pkg/groove/gcs: /Users/gabs/proggit/groove/pkg/groove/gcs/transform.go:5:2:"github.com/gabstv/groove/pkg/groove" imported but not used
2018/11/29 10:15:46 Elapsed duration: 523.977592ms
2018/11/29 10:15:46 Offset: 0
2018/11/29 10:15:46 Number of candidates found: 1
2018/11/29 10:15:46 Candidates are:
2018/11/29 10:15:46   const AnimOnce AnimClipMode
2018/11/29 10:15:46 =======================================================

Copied from original issue: microsoft/vscode-go#2161

implement caching

Thank you for all the work on gocode to make auto completion fast :)

After chatting with @ramya-rao-a, I noticed that the caching stuff that you did, which really helps auto completion speeds, is only merged in mdempsky's fork and not this one (and therefore auto completion in go modules is still pretty slow). So

  1. I was wondering if it's possible to "just merge the cache stuff here"?
  2. If not, where should we keep an eye on for updates on gocode in go modules?

All variables in a file are shown as invalid type

I'm using Go 1.11.1,on Darwin amd64 , with the gocode that I just checked out today. Here is the bit of the code that I want completion on:

func runApplyClustersCommand(cmd *cobra.Command, args []string) error {
	clustersConfiguration, err := loadClustersConfiguration()
	if err != nil {
		return err
	}

	for _, managementCluster := range clustersConfiguration.ManagementClusters {
		managementCluste
	}
}

Here, managementCluster is shown as a valid completion candidate. However, I see this in the debug log:

2018/11/05 11:38:34 Elapsed duration: 9.746426ms
2018/11/05 11:38:34 Offset: 0
2018/11/05 11:38:34 Number of candidates found: 1
2018/11/05 11:38:34 Candidates are:
2018/11/05 11:38:34   var managementCluster invalid type
2018/11/05 11:38:34 =======================================================

Since this is shown as invalid type, when I want to get completion on that variable's fields, it fails.

Any ideas on why this would be happening?

Vim setup paths

I just noticed and suspect that the Vim installation paths are incorrect.
Shouldn't:
Plug 'mdempsky/gocode', { 'rtp': 'vim', 'do': '~/.vim/plugged/gocode/vim/symlink.sh' }
Be?:
Plug 'stamblerre/gocode', { 'rtp': 'vim', 'do': '~/.vim/plugged/gocode/vim/symlink.sh' }

test

Please answer these questions before submitting your issue. Thanks!
Also, remember that to restart gocode, you have to run gocode close.

What version of Go are you using (go version)?

What operating system and processor architecture are you using (go env)?

What is the debug output of gocode?

Run gocode close and then run gocode -s -debug to restart gocode in debug mode.
Try to complete once again from your editor, and paste the output printed by gocode here.

What (client-side) flags are you passing into gocode?

Please note here if you are using -source, -builtin, -ignore-case, -unimported-packages, or -fallback-to-source.

What editor are using?

gocode: not working with stdin

Summary

Hello, I've tried to use your fork of gocode today and it does not return any completions when I pass the code via stdin.

If I use the -in file path flag instead it works.

The project is outside the GOPATH and is using modules.

What version of Go are you using (go version)?

go version go1.12.4 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/rokf/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rokf/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build124586583=/tmp/go-build -gno-record-gcc-switches"

No completions even local struct

go 1.11 linux/amd64

There is no completions at all, neither external package nor local structure.

go.mod:

module apptest

main.go

package main

type myStruct struct{}

func (ms myStruct) yop() {}

func main() {
	ms := myStruct{}
	ms.#
}

Ouptut of gocode-gomod debug -s

2018/11/23 08:56:44 Cursor at: 103
2018/11/23 08:56:44 -------------------------------------------------------
package main

type myStruct struct{}

func (ms myStruct) yop() {}

func main() {
	ms := myStruct{}
	ms.#
}
2018/11/23 08:56:44 -------------------------------------------------------
2018/11/23 08:56:44 Elapsed duration: 18.953696ms
2018/11/23 08:56:44 Offset: 0
2018/11/23 08:56:44 Number of candidates found: 0
2018/11/23 08:56:44 Candidates are:
2018/11/23 08:56:44 =======================================================

Version commit of the repo : 7ab6cc

For information this is working with the commit (11 october) : 559144

I need Autobuild !!

Please answer these questions before submitting your issue. Thanks!
Also, remember that to restart gocode, you have to run gocode close.

What version of Go are you using (go version)?

1.13

What operating system and processor architecture are you using (go env)?

Arch ARM

What is the debug output of gocode?

Nope.

Run gocode close and then run gocode -s -debug to restart gocode in debug mode.
Try to complete once again from your editor, and paste the output printed by gocode here.

What (client-side) flags are you passing into gocode?

Please note here if you are using -source, -builtin, -ignore-case, -unimported-packages, or -fallback-to-source.

What editor are using?

Anyway, nsf/gocode has this future, but this version is not available . So that I can't get Completion suggestions in time when I just modify and save a file.

Autocomplete fails if next line has a comment

What version of Go are you using (go version)?

1.11

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home//.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/
/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home//src/github.com//***/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build102471124=/tmp/go-build -gno-record-gcc-switches"

What is the debug output of gocode?

None

What (client-side) flags are you passing into gocode?

potentially -f=json and autocomplete via Go-Plus plugin in Atom?

What editor are using?

Atom

The Problem

Autocompletion works flawlessly except for the case in which the next line starts with // comment or /* comment */. Thus, autocompletion does not work if the code looks like this:

func() {
  somepackage.[no suggestions shown]
  // comment
}

However, this works:

func() {
  somepackage.[no suggestions shown]
}
// comment

No completions

go1.11.1 darwin/amd64

I can't get any completions working.

go.mod:

module github.com/broady/junk/gocodetest

require rsc.io/quote v1.5.2

main.go:

package main

import (
	"fmt"

	"rsc.io/quote"
)

func main() {
	fmt.Println("hello")
	quote.Hello()
}

Log output:

$ gocode -s -debug
2018/10/29 21:45:10 Got autocompletion request for '/Users/cbro/src/github.com/broady/junk/gocodetest/main.go'
2018/10/29 21:45:10 Cursor at: 96
2018/10/29 21:45:10 -------------------------------------------------------
package main

import (
	"fmt"

	"rsc.io/quote"
)

func main() {
	fmt.Println("hello")
	quote.Hel#
}
2018/10/29 21:45:10 -------------------------------------------------------
2018/10/29 21:45:10 Elapsed duration: 207.048µs
2018/10/29 21:45:10 Offset: 0
2018/10/29 21:45:10 Number of candidates found: 0
2018/10/29 21:45:10 Candidates are:
2018/10/29 21:45:10 =======================================================

Installed with go get -u github.com/stamblerre/gocode
(built at 1264028)

Autocomplete does not work within incomplete if statements

Steps to reproduce

  • Create a directory outside GOPATH and initialize it as a module with go mod init github.com/cskr/foo.
  • Use VIM with vim-go installed and create main.go with following content.
package main

func main() {
	var v MyStruct
}

type MyStruct struct {
	Field int
}
  • Hit C-x C-o after typing if v. immediately after the variable declaration as shown below,
func main() {
	var v MyStruct
	if v.
}
  • Pattern not found was displayed as error. However, if I add braces at the end of if as shown below or and then try C-x C-o or define MyStruct before main, it works.
func main() {
	var v MyStruct
	if v. {}
}

What version of Go are you using (go version)?

go version go1.11.4 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="linux"

What is the debug output of gocode?

2019/01/04 21:38:00 Got autocompletion request for '/home/cskr/foo/main.go'
2019/01/04 21:38:00 Cursor at: 50
2019/01/04 21:38:00 -------------------------------------------------------
package main

func main() {
	var v MyStruct
	if v.#
}

type MyStruct struct {
	Field int
}
2019/01/04 21:38:00 -------------------------------------------------------
2019/01/04 21:38:00 error in package github.com/cskr/foo: /home/cskr/foo/main.go:4:8:undeclared name: MyStruct
2019/01/04 21:38:00 error in package github.com/cskr/foo: /home/cskr/foo/main.go:8:6:undeclared name: MyStruct
2019/01/04 21:38:00 Elapsed duration: 69.581082ms
2019/01/04 21:38:00 Offset: 0
2019/01/04 21:38:00 Number of candidates found: 0
2019/01/04 21:38:00 Candidates are:
2019/01/04 21:38:00 =======================================================

What (client-side) flags are you passing into gocode?

I pass -unimported-packages.

What editor are using?

VIM 8.0

Sublime plugin performance

What version of Go are you using (go version)?

go version go1.11.1 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="~/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="~/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/09/3xfd0snx16n18mrlgds_mcjw0000gn/T/go-build223814130=/tmp/go-build -gno-record-gcc-switches -fno-common"

What is the debug output of gocode?

2018/11/13 20:50:22 Got autocompletion request for '/Users/jeroenrinzema/Documents/projects/commander-boilerplate/query/main.go'
2018/11/13 20:50:22 Cursor at: 574
2018/11/13 20:50:22 -------------------------------------------------------
package main

import (
	"net/http"

	"github.com/jeroenrinzema/commander-boilerplate/query/common"
	"github.com/jeroenrinzema/commander-boilerplate/query/controllers"
	"github.com/jeroenrinzema/commander-boilerplate/query/rest"
	_ "github.com/jinzhu/gorm/dialects/postgres"
)

func main() {
	common.OpenDatabase()
	router := common.OpenWebHub()

	router.HandleFunc("/find/{id}", rest.Use(controllers.FindByID, Authentication)).Methods("GET")
	router.HandleFunc("/find/", rest.Use(controllers.FindAll, Authentication)).Methods("GET")

	http.ListenAndServe(":7070", router)
	h#
}

// Authentication validates if the given request is authenticated.
// If the request is not authenticated is a 401 returned.
func Authentication(next http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		// <- authenticate request and provide the users dataset key
		next.ServeHTTP(w, r)
	}
}
2018/11/13 20:50:22 -------------------------------------------------------
2018/11/13 20:50:22 Elapsed duration: 521.685605ms
2018/11/13 20:50:22 Offset: 0
2018/11/13 20:50:22 Number of candidates found: 1
2018/11/13 20:50:22 Candidates are:
2018/11/13 20:50:22   package http 
2018/11/13 20:50:22 =======================================================

I noticed that the performance of the sublime plugin is quite often "slow" and does not display the typed text until gocode has fetched the results. In the example do i try to write a word as fast as plausible (for ex. http) the first letter will show at once but the rest will follow once gocode is done.

ezgif-5-13be794f747b

Found 1 candidates PANIC PANIC PANIC

Trying to get VSCode autocomplete working with go modules, only candidate returned is PANIC.

VSCode installs this module as gocode-gomod

If I execute:
gocode-gomod -builtin -debug -source -in ./hello.go autocomplete 12

I get the result

Found 1 candidates:
  PANIC PANIC PANIC
2018/10/14 12:13:42 Elapsed duration: 1.641874ms

Content of the hello.go file is

package main

import (
	"fmt"

	"rsc.io/quote"
)

func main() {
	fmt.Println(quote.Hello())
	quote.Hello()
	fmt.


}

To isolate if this is an issue with the way that VSCode has installed / compiled this module I have downloaded / compiled / installed using a clean GOPATH, the same result with the same source file is seen.

I have included environment information which is below, if there is any other information that can help let me know or if you would like me to try anything.

Kind Regards,
Steve

go version output
go version go1.11.1 linux/amd64
go env output

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/steve/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/steve/Development/tmpgo"
GOPROXY=""
GORACE=""
GOROOT="/home/steve/.local/opt/go"
GOTMPDIR=""
GOTOOLDIR="/home/steve/.local/opt/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/steve/Development/go-module/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build828722581=/tmp/go-build -gno-record-gcc-switches"

OS
Fedora 28 with a 4.18.12-200.fc28.x86_64 kernel

nil pointer panic when autocompleting

Please answer these questions before submitting your issue. Thanks!
Also, remember that to restart gocode, you have to run gocode close.

What version of Go are you using (go version)?

go version go1.12 darwin/amd64

What operating system and processor architecture are you using (go env)?

go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/me/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vy/7b8vfhcx2v7036h99kzs188h0000gn/T/go-build561165587=/tmp/go-build -gno-record-gcc-switches -fno-common"

What is the debug output of gocode?

/go/bin/gocode-gomod -s -debug -sock unix -addr 127.0.0.1:37373

I modified the source in the output. The error occurs in helloWorld at req. in this particular case.

2019/03/08 23:17:11 Got autocompletion request for '/usr/src/web/website/serve/main.go'
2019/03/08 23:17:11 Cursor at: 856
2019/03/08 23:17:11 -------------------------------------------------------
package main

import (
        "fmt"
        "log"
        "net/http"
)

func helloWorld(resp http.ResponseWriter, req *http.Request) {
        fmt.Fprintf(resp, "Hello world")

        req.
}

func main() {
        http.Handle("/", http.FileServer(http.Dir(os.Args[1])))

        http.HandleFunc("/hi", func(resp http.ResponseWriter, req *http.Request) {
                fmt.Fprintf(resp, "Hello world")
        })

        err = http.ListenAndServe(":80", nil)
        if err != nil {
                log.Println(err)
        }
}
2019/03/08 23:17:11 -------------------------------------------------------
panic: runtime error: invalid memory address or nil pointer dereference

goroutine 22 [running]:
runtime/debug.Stack(0xb, 0xc0001b7438, 0x1)
        /usr/local/Cellar/go/1.11.1/libexec/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
        /usr/local/Cellar/go/1.11.1/libexec/src/runtime/debug/stack.go:16 +0x22
main.(*Server).AutoComplete.func1(0xc0000c1260)
        /go/src/github.com/stamblerre/gocode/server.go:78 +0x94
panic(0x144ad60, 0x1837cc0)
        /usr/local/Cellar/go/1.11.1/libexec/src/runtime/panic.go:513 +0x1b9
github.com/stamblerre/gocode/internal/suggest.(*Config).analyzePackage(0xc0001b7a98, 0xc0000a8140, 0x3c, 0xc0001c0000, 0x5df, 0x5df, 0x358, 0x0, 0x0, 0x700, ...)
        /go/src/github.com/stamblerre/gocode/internal/suggest/suggest.go:128 +0x251
github.com/stamblerre/gocode/internal/suggest.(*Config).Suggest(0xc0001b7a98, 0xc0000a8140, 0x3c, 0xc0001c0000, 0x5df, 0x5df, 0x358, 0x10ab3bf, 0x1847480, 0x1469660, ...)
        /go/src/github.com/stamblerre/gocode/internal/suggest/suggest.go:55 +0xb5
main.(*Server).AutoComplete(0x1865460, 0xc0000adbc0, 0xc0000c1260, 0x0, 0x0)
        /go/src/github.com/stamblerre/gocode/server.go:104 +0x138
reflect.Value.call(0xc0000ba720, 0xc0000b8588, 0x13, 0x14c52ad, 0x4, 0xc000062f18, 0x3, 0x3, 0xc0000ada00, 0x1422780, ...)
        /usr/local/Cellar/go/1.11.1/libexec/src/reflect/value.go:447 +0x449
reflect.Value.Call(0xc0000ba720, 0xc0000b8588, 0x13, 0xc000051718, 0x3, 0x3, 0x1494d00, 0x14a5401, 0xc0000ad940)
        /usr/local/Cellar/go/1.11.1/libexec/src/reflect/value.go:308 +0xa4
net/rpc.(*service).call(0xc0000ad8c0, 0xc00014c000, 0xc0000aa628, 0xc0000aa650, 0xc00018c100, 0xc0000c0ca0, 0x140e980, 0xc0000adbc0, 0x16, 0x140e940, ...)
        /usr/local/Cellar/go/1.11.1/libexec/src/net/rpc/server.go:384 +0x14e
created by net/rpc.(*Server).ServeCodec
        /usr/local/Cellar/go/1.11.1/libexec/src/net/rpc/server.go:481 +0x47e

What (client-side) flags are you passing into gocode?

No clue.

What editor are using?

VS Code version: Code 1.31.1 (1b8e8302e405050205e69b59abb3559592bb9e60, 2019-02-12T02:16:38.656Z)
OS version: Darwin x64 18.2.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (8 x 2600)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 16.00GB (0.31GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (30)
Extension Author (truncated) Version
aurelia Aur 1.0.3
Aurelia beh 1.2.2
better-toml bun 0.3.2
vscode-opennewinstance chr 0.0.4
path-intellisense chr 1.4.2
vscode-eslint dba 1.8.2
xml Dot 2.4.0
gitlens eam 9.5.1
permute-lines ear 0.0.10
EditorConfig Edi 0.13.0
tslint eg2 1.0.43
vscode-npm-script eg2 0.3.5
vsc-material-theme Equ 2.7.0
gitlab-workflow fat 2.0.1
easy-icons jam 0.3.1
vscode-sshfs Kel 1.13.0
mssql ms- 1.4.0
cpptools ms- 0.21.0
csharp ms- 1.17.1
Go ms- 0.9.2
mono-debug ms- 0.15.8
PowerShell ms- 1.11.0
debugger-for-chrome msj 4.11.3
vscode-docker Pet 0.5.2
material-icon-theme PKi 3.6.3
vscode-icons rob 8.2.0
rewrap stk 1.9.1
code-spell-checker str 1.6.10
vsc-prompt fir 0.0.1
vscode-arduino vsc 0.2.25

(2 theme extensions excluded)

go get build error

Hi, looks like the latest master doesn't install through go get.

$ go get -u github.com/stamblerre/gocode
# github.com/stamblerre/gocode/internal/suggest
../../go/pkg/mod/github.com/stamblerre/[email protected]/internal/suggest/suggest.go:130:3: cannot use func literal (type func(*token.FileSet, string, []byte) (*ast.File, error)) as type func(*token.FileSet, string) (*ast.File, error) in field value

What version of Go are you using (go version)?

go1.11.1 darwin/amd64

What operating system and processor architecture are you using (go env)?

macOS 10.14 Mojave

gocode hangs emacs during lookup

What version of Go are you using (go version)?

go version go1.11 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE=redacted
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH=redacted
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/46/637dm0hn3qx7wbw5q87djc_0hrrcxp/T/go-build805034364=/tmp/go-build -gno-record-gcc-switches -fno-common"

What is the debug output of gocode?

N/A

What (client-side) flags are you passing into gocode?

None

What editor are using?

Emacs for OSX GUI 26.1

issue

gocode results are provided after the first character typed no matter what ac-auto-start value is. This causes a small hang while it while its figuring out the autocomplete options. Ideally gocode should provide results when ac-auto-start length is reached or when an attempt to expand the current symbol happens.

This small makes using gocode difficult since almost every new symbol briefly hangs emacs.

go install error

client.go:17:2: use of internal package golang.org/x/gocode/vendor/github.com/stamblerre/gocode/internal/suggest not allowed

build failed

build failed

src/github.com/stamblerre/gocode/internal/suggest/suggest.go:138:3: cannot use func literal (type func(*token.FileSet, string) (*ast.File, error)) as type func(*token.FileSet, string, []byte) (*ast.File, error) in field value

packages.Config.ParseFile

no results for unimported packages when using Go modules

In the below case we dont get any completions.

import (
        "rsc.io/quote"
        "fmt"
)

func main() {
        fmt.Println("hello")
        quote.
}

Update the quote. above to quote.Hello(), save the file. The next time auto-completions work

import (
        "rsc.io/quote"
        "fmt"
)

func main() {
        fmt.Println("hello")
        quote.Hello();
        quote.
}

This repo doesn't have a go mod file so it will not work in vscode

Go: master
Extension: 0.11.7
vscode: 1.39.2

Installing 17 tools at /Users/gert/go/bin
  gocode
  gopkgs
  go-outline
  go-symbols
  guru
  gorename
  gotests
  gomodifytags
  impl
  fillstruct
  goplay
  godoctor
  dlv
  gocode-gomod
  godef
  goimports
  golint

Installing github.com/mdempsky/gocode SUCCEEDED
Installing github.com/uudashr/gopkgs/cmd/gopkgs SUCCEEDED
Installing github.com/ramya-rao-a/go-outline SUCCEEDED
Installing github.com/acroca/go-symbols SUCCEEDED
Installing golang.org/x/tools/cmd/guru SUCCEEDED
Installing golang.org/x/tools/cmd/gorename SUCCEEDED
Installing github.com/cweill/gotests/... SUCCEEDED
Installing github.com/fatih/gomodifytags SUCCEEDED
Installing github.com/josharian/impl SUCCEEDED
Installing github.com/davidrjenni/reftools/cmd/fillstruct SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay SUCCEEDED
Installing github.com/godoctor/godoctor SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv SUCCEEDED
Installing github.com/stamblerre/gocode FAILED
Installing github.com/rogpeppe/godef SUCCEEDED
Installing golang.org/x/tools/cmd/goimports SUCCEEDED
Installing golang.org/x/lint/golint SUCCEEDED

1 tools failed to install.

gocode-gomod:
Error: Command failed: /usr/local/go/bin/go build -o /Users/gert/go/bin/gocode-gomod github.com/stamblerre/gocode
can't load package: cannot find module providing package github.com/stamblerre/gocode: working directory is not part of a module

How can this fork be much faster than the origin?

What version of Go are you using (go version)?

go version go1.11.5 linux/amd64

just out of curiosity, I am using Emacs with company-go,and when I use the gocode from mdempsky/gocode with -cache, the completion was sometimes slow and sometimes got suck, though very accurate. I heard this fork from vscode-go and it's extremely fast!

Is there any trade-off in accuracy v.s. speed or some bug get fixed?

Thanks for providing such good completion experience 👍

Readme file contains stale info

The readme file still contains this section:

This version of gocode is a fork of the original, which is no longer supported. This fork should work for all versions of Go > 1.8. It only works for $GOPATH projects. For a version of gocode that works with Modules, please see github.com/stamblerre/gocode.

I think this should be removed.

Nil panic, no method _, internal error

I created a repro to keep things simple: https://github.com/karalabe/gocodekiller. This single dependency more or less murders gocode in wondrous ways:

internal error: error "context canceled" (*errors.errorString) without position
error in package github.com/karalabe/gocodekiller: /work/mod/github.com/ipsn/gocodekiller/main.go:11:8:node._ undefined (type *core.IpfsNode has no field or method _)
panic: runtime error: invalid memory address or nil pointer dereference

goroutine 7064 [running]:
runtime/debug.Stack(0x49, 0x0, 0x0)
	/opt/google/go/src/runtime/debug/stack.go:24 +0x9d
runtime/debug.PrintStack()
	/opt/google/go/src/runtime/debug/stack.go:16 +0x22
main.(*Server).AutoComplete.func1(0xc013eec960)
	/work/src/github.com/stamblerre/gocode/server.go:80 +0xad
panic(0x8a06e0, 0xd02c00)
	/opt/google/go/src/runtime/panic.go:522 +0x1b5
golang.org/x/tools/go/packages.goListDriver(0xc00014f2c8, 0xc016c0a5a0, 0x1, 0x1, 0x45, 0x10, 0xc00014f2c0)
	/work/src/golang.org/x/tools/go/packages/golist.go:195 +0x5e4
golang.org/x/tools/go/packages.defaultDriver(0xc00014f2c8, 0xc016c0a5a0, 0x1, 0x1, 0xc0071a8000, 0xc0046f3500, 0x34)
	/work/src/golang.org/x/tools/go/packages/packages.go:188 +0x68
golang.org/x/tools/go/packages.Load(0xc002c157e8, 0xc016c0a5a0, 0x1, 0x1, 0x1, 0xc00c6979c0, 0x34, 0x1, 0xc013e32860)
	/work/src/golang.org/x/tools/go/packages/packages.go:173 +0x6f
github.com/stamblerre/gocode/internal/suggest.(*Config).analyzePackage(0xc002c15b08, 0xc01206c840, 0x2f, 0xc0001b0a00, 0x14bc, 0x14bc, 0xe6f, 0x0, 0x0, 0x13, ...)
	/work/src/github.com/stamblerre/gocode/internal/suggest/suggest.go:183 +0x587
github.com/stamblerre/gocode/internal/suggest.(*Config).Suggest(0xc002c15b08, 0xc01206c840, 0x2f, 0xc0001b0a00, 0x14bc, 0x14bc, 0xe6f, 0x40a0ac, 0xc000012000, 0x8b1f60, ...)
	/work/src/github.com/stamblerre/gocode/internal/suggest/suggest.go:59 +0x9a
main.(*Server).AutoComplete(0xc0000acbc0, 0x9d5500, 0xc017ec3bc0, 0xc017ec38c0, 0xc013eec960, 0x0, 0x0)
	/work/src/github.com/stamblerre/gocode/server.go:127 +0x250
reflect.Value.call(0xc000122400, 0xc0000b6578, 0x13, 0x92096f, 0x4, 0xc000aa2ef8, 0x4, 0x4, 0xc000cd6690, 0x10, ...)
	/opt/google/go/src/reflect/value.go:447 +0x461
reflect.Value.Call(0xc000122400, 0xc0000b6578, 0x13, 0xc000cd66f8, 0x4, 0x4, 0x503e53, 0xc00db79500, 0x28)
	/opt/google/go/src/reflect/value.go:308 +0xa4
github.com/stamblerre/gocode/vendor/github.com/keegancsmith/rpc.(*service).call(0xc0000bba80, 0xc000136000, 0xc017d7ef30, 0xc017053000, 0xc017d7ef60, 0xc000122480, 0xc00015a0a0, 0x862de0, 0xc017ec38c0, 0x16, ...)
	/work/src/github.com/stamblerre/gocode/vendor/github.com/keegancsmith/rpc/server.go:419 +0x288
created by github.com/stamblerre/gocode/vendor/github.com/keegancsmith/rpc.(*Server).ServeCodec
	/work/src/github.com/stamblerre/gocode/vendor/github.com/keegancsmith/rpc/server.go:517 +0x498

test2

Please answer these questions before submitting your issue. Thanks!
Also, remember that to restart gocode, you have to run gocode close.

What version of Go are you using (go version)?

What operating system and processor architecture are you using (go env)?

What is the debug output of gocode?

Run gocode close and then run gocode -s -debug to restart gocode in debug mode.
Try to complete once again from your editor, and paste the output printed by gocode here.

What (client-side) flags are you passing into gocode?

Please note here if you are using -source, -builtin, -ignore-case, -unimported-packages, or -fallback-to-source.

What editor are using?

No completions for external package at first tries (integrated with ycmd)

Please answer these questions before submitting your issue. Thanks!
Also, remember that to restart gocode, you have to run gocode close.

What version of Go are you using (go version)?

go1.11

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/magodo/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/magodo/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/magodo/projects/udb-v2/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build613089893=/tmp/go-build -gno-record-gcc-switches"

What editor are using?

vim

Description

I substitute mdempsky/gocode with this one in ycmd. I also added -source option for external package completion. It almost works besides when I first open a go file and complete some external package, it will fail with no completions found error. After several (~3 times) retries, it works.

vscode install fail

Installing github.com/stamblerre/gocode FAILED

1 tools failed to install.

gocode-gomod:
Error: Command failed: D:\go\Go\bin\go.exe get -v -d github.com/stamblerre/gocode
go: downloading github.com/stamblerre/gocode v1.0.0
verifying github.com/stamblerre/[email protected]: github.com/stamblerre/[email protected]: Get https://sum.golang.org/lookup/github.com/stamblerre/[email protected]: dial tcp 216.58.200.241:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
go: downloading github.com/stamblerre/gocode v1.0.0
verifying github.com/stamblerre/[email protected]: github.com/stamblerre/[email protected]: Get https://sum.golang.org/lookup/github.com/stamblerre/[email protected]: dial tcp 216.58.200.241:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

get clone the git
windows use cmd "go install xxx" is ok
others gomode ok ,but only gocode fail in vs

not working with vim 8.1

I added : Plug 'stamblerre/gocode', {'rtp': 'vim/', 'do': '~/.vim/plugged/gocode/vim/symlink.sh'} to .vimrc and installed it, vim-go works fine but gocode does not, there is no autocomplete, do I need do anything extra other than PlugInstall it? I made sure GOPATH,PATH, and 'go get -u github.com/stamblerre/gocode' are done correctly. Do I need type any key to bring up the autocomplete dropdown list?

I'm using go1.13beta1.

gocode is using gigabytes and gigabytes of memory

Ever since I switched to the stamblerre fork to get Go 1.11's modules to work, gocode has been really, really slow, and it takes up gigabytes and gigabytes of RAM and ultimately gets OOM'ed. This seems to happen when Atom is trying to autocomplete as I'm typing, or sometimes when I've saved a file with invalid syntax. I essentially have a while loop running that kills gocode every 30 seconds to play it safe.

I'm really not sure what's up.

What version of Go are you using (go version)?

go version go1.11.4 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="linux"

What is the debug output of gocode?

Not particularly relevant, but:

2019/01/16 21:17:59 =======================================================
2019/01/16 21:17:59 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/types.go:230:8:undeclared name: str
2019/01/16 21:17:59 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:11:2:"github.com/davecgh/go-spew/spew" imported but not used
2019/01/16 21:17:59 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:4:2:"bytes" imported but not used
2019/01/16 21:17:59 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:5:2:"encoding/json" imported but not used
2019/01/16 21:17:59 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:6:2:"fmt" imported but not used
2019/01/16 21:17:59 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:7:2:"io/ioutil" imported but not used
2019/01/16 21:17:59 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:9:2:"net/url" imported but not used
2019/01/16 21:17:59 Elapsed duration: 7.867751923s
2019/01/16 21:17:59 Offset: 0
2019/01/16 21:17:59 Number of candidates found: 1
2019/01/16 21:17:59 Candidates are:
2019/01/16 21:17:59   type string string
2019/01/16 21:17:59 =======================================================
2019/01/16 21:18:00 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/types.go:230:8:undeclared name: st
2019/01/16 21:18:00 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:7:2:"io/ioutil" imported but not used
2019/01/16 21:18:00 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:9:2:"net/url" imported but not used
2019/01/16 21:18:00 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:11:2:"github.com/davecgh/go-spew/spew" imported but not used
2019/01/16 21:18:00 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:4:2:"bytes" imported but not used
2019/01/16 21:18:00 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:5:2:"encoding/json" imported but not used
2019/01/16 21:18:00 error in package bitbucket.org/tekkamanendless/emergencyreporting/erclient: /home/doug/src/bitbucket.org/tekkamanendless/emergencyreporting/erclient/client.go:6:2:"fmt" imported but not used
2019/01/16 21:18:00 Elapsed duration: 7.895922867s
2019/01/16 21:18:00 Offset: 0
2019/01/16 21:18:00 Number of candidates found: 1
2019/01/16 21:18:00 Candidates are:
2019/01/16 21:18:00   type string string
2019/01/16 21:18:00 =======================================================

What (client-side) flags are you passing into gocode?

Whatever go-plus is doing in Atom.

What editor are using?

Atom

External packages no autocomplete

What version of Go are you using (go version)?

go version go1.12 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mike/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mike/development/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/mike/development/thought-ops/matcher-stream/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/6q/yt_hgwkx7950h3w3thf4_49r0000gn/T/go-build541360341=/tmp/go-build -gno-record-gcc-switches -fno-common"

What is the debug output of gocode?

2019/03/04 19:27:25 gbimporter: no package found for github.com/Shopify/sarama: can't find import: "github.com/Shopify/sarama"

2019/03/04 19:27:25 gbimporter: no package found for github.com/movio/kasper: can't find import: "github.com/movio/kasper"

What editor are using?

neovim

I am unable to get any autocomplete suggestions from external packages. Standard library packages like 'fmt' autocomplete fine. My project uses go modules and is located outside of the $GOPATH. When I look at the debug output i see

gbimporter: no package found for github.com/Shopify/sarama: can't find import: "github.com/Shopify/sarama"

I have go installed all of my dependencies as well as my project. It seems like it might have to do with my environment but I can't figure out what the problem is.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.