Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:GoDebugStart or Test "could not determine package name" #2260

Closed
sebastianst opened this issue May 3, 2019 · 7 comments
Closed

:GoDebugStart or Test "could not determine package name" #2260

sebastianst opened this issue May 3, 2019 · 7 comments

Comments

@sebastianst
Copy link
Contributor

sebastianst commented May 3, 2019

What did you do?

Run :GoDebugStart or :GoDebugTest while the active buffer was in any of the following two go source files:

package gotest

import "fmt"

func main() {
	fmt.Println("vim-go")
}
package gotest

import "testing"

func TestMain(t *testing.T) {
	main()
}

What did you expect to happen?

The debugger to open

What happened instead?

vim prints the error "could not determine package name"

Configuration:

  • vim-go version: 3e9a292 (2019-04-26)
  • vimrc you used to reproduce:
call plug#begin('~/.vim/bundle')
Plug 'fatih/vim-go'
call plug#end()
  • Vim version (first three lines from :version): NVIM v0.3.5, Build type: Release, LuaJIT 2.0.5
  • Go version (go version): go version go1.12.4 linux/amd64
  • Go environment (go env):
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/seb/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/seb/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-build336271311=/tmp/go-build -gno-record-gcc-switches"
@bhcleek
Copy link
Collaborator

bhcleek commented May 3, 2019

What does :echo getcwd() report?

What is the path to the files?

Have you updated delve recently (:GoUpdateBinaries dlv)?

@sebastianst
Copy link
Contributor Author

sebastianst commented May 3, 2019

cwd: /home/seb/tmp/gotest
files are home/seb/tmp/gotest/gotest{,_test}.go
I've updated all binaries. Still the same error.

@sebastianst sebastianst changed the title :GoDebugTest "could not determine package name" :GoDebugStart or Test "could not determine package name" May 3, 2019
@bhcleek
Copy link
Collaborator

bhcleek commented May 3, 2019

It doesn't know the package name, because they're neither in the $GOPATH nor is there a go.mod file.

@sebastianst
Copy link
Contributor Author

ah sure. but I have the same problem in an actual go.mod enabled repo. I'll update the test.
BTW seems to be pretty similar to #2236

@sebastianst
Copy link
Contributor Author

OK I added the following go.mod

module github.com/sebastianst/gotest

go 1.12

and now :GoDebugTest works in the minimal example. But it still doesn't work in my big repo, where I actually encounter the problem. I'll try to reproduce the error.

@bhcleek
Copy link
Collaborator

bhcleek commented May 5, 2019

I've only seen a few cases where :GoDebug or :GoDebugTest will show a could not determine package name:

  1. when trying to debug a package that is outside of GOPATH and doesn't contain a go.mod.
  2. when go list fails for some reason.

I've resolved the former in #2269. I don't know if it will resolve your issue or not since we don't know how to replicate your issue, but it seems worth a shot.

@sebastianst
Copy link
Contributor Author

I suddenly cannot reproduce the bug, sorry for the confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants