alvarolm / GoGuru

GoGuru is a Golang plugin for SublimeText 3 that integrates the Go guru tool.
http://alvarolm.github.io/GoGuru
MIT License
82 stars 9 forks source link

Packages in $GOROOT/pkg/mod are not detected #45

Closed Endermanbugzjfc closed 2 years ago

Endermanbugzjfc commented 2 years ago

Error

Running guru definition command...

guru: cannot find package "github.com/sirupsen/logrus" in any of:
    /Users/Eurus/U/dev/goroot/src/github.com/sirupsen/logrus (from $GOROOT)
    ($GOPATH not set. For more details see: 'go help gopath')

Reproduce

  1. go get github.com/sirupsen/logrus (Installs to $GOROOT/pkg/mod)
  2. Write logrus.StandardLogger()
  3. Select StandardLogger
  4. Run "GoGuru: Definition"
  5. See the error

    Config

    {
    "goguru_debug": true,
    "goguru_output": "buffer",
    "goguru_jumpto_definition": true,
    }

    Log

    GoGuru [DEBUG]: ('cmd_env', {'GOROOT': '/Users/Eurus/U/dev/goroot', 'PWD': '/Applications/Sublime Text.app/Contents/MacOS', 'XPC_FLAGS': '0x0', 'GOPATH': '/Users/Eurus/U/dev/goroot', '__CF_USER_TEXT_ENCODING': '0x1F5:0x0:0x0', 'SHELL': '/bin/bash', '__CFBundleIdentifier': 'com.sublimetext.4', 'PATH': '~/U/dev/go1.18/bin:~/U/exe:~/Documents/Dev/PocketMine-MP/4/bin/php7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:~/U/dev/go1.18/bin:~/U/exe:~/Documents/Dev/PocketMine-MP/4/bin/php7/bin:/Users/Eurus/U/dev/goroot/bin', 'XPC_SERVICE_NAME': '0', 'STARSHIP_SHELL': 'bash', 'HOME': '/Users/Eurus', 'COMMAND_MODE': 'unix2003', '_': '/usr/bin/env\n\x1b[48;5;4;38;5;15m \x1b[0m\x1b[48;5;4;38;5;15m/Applications/Sublime Text.app/Contents/MacOS\x1b[0m\x1b[48;5;4;38;5;15m \x1b[0m\x1b[48;5;6;38;5;4m\ue0b0\x1b[0m\x1b[48;5;8;38;5;6m\ue0b0\x1b[0m\x1b[38;5;8m\ue0b0\x1b[0m                       \x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08logout', 'TMPDIR': '/var/folders/ss/jlr803w55s7gxqgb8gd7kv_r0000gn/T/', 'LOGNAME': 'Eurus', 'SSL_CERT_FILE': '/Applications/Sublime Text.app/Contents/MacOS/Lib/python3/certifi/cacert.pem', 'SHLVL': '1', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.P0qObF4omF/Listeners', 'USER': 'Eurus', 'STARSHIP_SESSION_KEY': '2773020636708932'})
    GoGuru [DEBUG]: ('goguru_env', {})
    GoGuru [DEBUG]: ('final_env', {'GOROOT': '/Users/Eurus/U/dev/goroot', 'PWD': '/Applications/Sublime Text.app/Contents/MacOS', 'XPC_FLAGS': '0x0', 'GOPATH': '/Users/Eurus/U/dev/goroot', '__CF_USER_TEXT_ENCODING': '0x1F5:0x0:0x0', 'SHELL': '/bin/bash', '__CFBundleIdentifier': 'com.sublimetext.4', 'PATH': '~/U/dev/go1.18/bin:~/U/exe:~/Documents/Dev/PocketMine-MP/4/bin/php7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:~/U/dev/go1.18/bin:~/U/exe:~/Documents/Dev/PocketMine-MP/4/bin/php7/bin:/Users/Eurus/U/dev/goroot/bin', 'XPC_SERVICE_NAME': '0', 'STARSHIP_SHELL': 'bash', 'HOME': '/Users/Eurus', 'COMMAND_MODE': 'unix2003', '_': '/usr/bin/env\n\x1b[48;5;4;38;5;15m \x1b[0m\x1b[48;5;4;38;5;15m/Applications/Sublime Text.app/Contents/MacOS\x1b[0m\x1b[48;5;4;38;5;15m \x1b[0m\x1b[48;5;6;38;5;4m\ue0b0\x1b[0m\x1b[48;5;8;38;5;6m\ue0b0\x1b[0m\x1b[38;5;8m\ue0b0\x1b[0m                       \x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08logout', 'TMPDIR': '/var/folders/ss/jlr803w55s7gxqgb8gd7kv_r0000gn/T/', 'LOGNAME': 'Eurus', 'SSL_CERT_FILE': '/Applications/Sublime Text.app/Contents/MacOS/Lib/python3/certifi/cacert.pem', 'SHLVL': '1', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.P0qObF4omF/Listeners', 'USER': 'Eurus', 'STARSHIP_SESSION_KEY': '2773020636708932'})
    GoGuru [DEBUG]: ('goguru_use_current_package', True)
    GoGuru [DEBUG]: ('GOPATH', '/Volumes/NO NAME/dev/goroot')
    GoGuru [DEBUG]: ('local_package', '')
    GoGuru [DEBUG]: ('guru_scope', ',')
    GoGuru [DEBUG]: ('cmd', 'guru -modified -scope , -tags ""  definition /Users/Eurus/Documents/Dev/Go/github.com/Endermanbugzjfc/MlogGo/tview/main.go:#235,#249')
    GoGuru [ERROR]: ('guru: cannot find package "github.com/sirupsen/logrus" in any of:\n\t/Users/Eurus/U/dev/goroot/src/github.com/sirupsen/logrus (from $GOROOT)\n\t($GOPATH not set. For more details see: \'go help gopath\')\n',)

    Environment

    OS: macOS 12.1 Sublime Text: (Unregistered) Stable Channel, Build 4126 GoGuru Executable Sha256: 77f0b981f63254d080a12f4f0693efa1bac4f864a1b1123f2e5768327f580a54

Endermanbugzjfc commented 2 years ago

I do not know why logrus is only in pkg/mod. Others have a copy in both src and pkg/mod.

Endermanbugzjfc commented 2 years ago

Tired also go get -u, still does not work.

Endermanbugzjfc commented 2 years ago

I decide to ignore this problem.

I will run the get command twice. One has GO111MODULE=off.