-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/gopls: go/packages work-around not activated with empty module cache #36770
Comments
Can you run |
@stamblerre {
"Dir": "/home/urandom/.go/pkg/mod/github.com/dgrijalva/jwt-go@v3.2.0+incompatible",
"ImportPath": "github.com/dgrijalva/jwt-go",
"Name": "jwt",
"Doc": "Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html See README.md for more info.",
"Root": "/home/urandom/.go/pkg/mod/github.com/dgrijalva/jwt-go@v3.2.0+incompatible",
"Module": {
"Path": "github.com/dgrijalva/jwt-go",
"Version": "v3.2.0+incompatible",
"Time": "2018-03-08T23:13:08Z",
"Dir": "/home/urandom/.go/pkg/mod/github.com/dgrijalva/jwt-go@v3.2.0+incompatible",
"GoMod": "/home/urandom/.go/pkg/mod/cache/download/github.com/dgrijalva/jwt-go/@v/v3.2.0+incompatible.mod"
},
"DepOnly": true,
"Stale": true,
"StaleReason": "not installed but available in build cache",
"GoFiles": [
"claims.go",
"doc.go",
"ecdsa.go",
"ecdsa_utils.go",
"errors.go",
"hmac.go",
"map_claims.go",
"none.go",
"parser.go",
"rsa.go",
"rsa_pss.go",
"rsa_utils.go",
"signing_method.go",
"token.go"
],
"CompiledGoFiles": [
"claims.go",
"doc.go",
"ecdsa.go",
"ecdsa_utils.go",
"errors.go",
"hmac.go",
"map_claims.go",
"none.go",
"parser.go",
"rsa.go",
"rsa_pss.go",
"rsa_utils.go",
"signing_method.go",
"token.go"
],
"Imports": [
"bytes",
"crypto",
"crypto/ecdsa",
"crypto/hmac",
"crypto/rand",
"crypto/rsa",
"crypto/subtle",
"crypto/x509",
"encoding/base64",
"encoding/json",
"encoding/pem",
"errors",
"fmt",
"math/big",
"strings",
"sync",
"time"
],
"Deps": [
"bufio",
"bytes",
"context",
"crypto",
"crypto/aes",
"crypto/cipher",
"crypto/des",
"crypto/dsa",
"crypto/ecdsa",
"crypto/ed25519",
"crypto/ed25519/internal/edwards25519",
"crypto/elliptic",
"crypto/hmac",
"crypto/internal/randutil",
"crypto/internal/subtle",
"crypto/md5",
"crypto/rand",
"crypto/rsa",
"crypto/sha1",
"crypto/sha256",
"crypto/sha512",
"crypto/subtle",
"crypto/x509",
"crypto/x509/pkix",
"encoding",
"encoding/asn1",
"encoding/base64",
"encoding/binary",
"encoding/hex",
"encoding/json",
"encoding/pem",
"errors",
"fmt",
"hash",
"internal/bytealg",
"internal/cpu",
"internal/fmtsort",
"internal/nettrace",
"internal/oserror",
"internal/poll",
"internal/race",
"internal/reflectlite",
"internal/singleflight",
"internal/syscall/unix",
"internal/testlog",
"io",
"io/ioutil",
"math",
"math/big",
"math/bits",
"math/rand",
"net",
"net/url",
"os",
"path/filepath",
"reflect",
"runtime",
"runtime/cgo",
"runtime/internal/atomic",
"runtime/internal/math",
"runtime/internal/sys",
"sort",
"strconv",
"strings",
"sync",
"sync/atomic",
"syscall",
"time",
"unicode",
"unicode/utf16",
"unicode/utf8",
"unsafe",
"vendor/golang.org/x/crypto/cryptobyte",
"vendor/golang.org/x/crypto/cryptobyte/asn1",
"vendor/golang.org/x/net/dns/dnsmessage"
],
"XTestGoFiles": [
"ecdsa_test.go",
"example_test.go",
"hmac_example_test.go",
"hmac_test.go",
"http_example_test.go",
"none_test.go",
"parser_test.go",
"rsa_pss_test.go",
"rsa_test.go"
],
"XTestImports": [
"bytes",
"crypto/ecdsa",
"crypto/rsa",
"encoding/json",
"fmt",
"github.com/dgrijalva/jwt-go",
"github.com/dgrijalva/jwt-go/request",
"github.com/dgrijalva/jwt-go/test",
"io",
"io/ioutil",
"log",
"net",
"net/http",
"net/url",
"reflect",
"strings",
"testing",
"time"
]
} However, the command does exit with 2, and the following error (visible from the logs as well) is also present:
|
Thanks for the logs! Once #36769 is resolved, can you share the output of |
#36769 is resolved, so if you could install |
@stamblerre, there's a lot of output now, though I'm not sure I'll be able to share it since the repo is private. Instead, is there anything specific I should be looking for? And it looks like some references are being returned now. Though unfortunately, only references within the definition package, but not others within other packages. |
You should specifically look for a log line that contains text like this:
I'd be interested to see how many packages are returned for that query. Any errors that are logged will also be helpful. In general, when you first start up VS Code, if you see any log message that contains " |
Scratch my last comment. I was actually pulling 0.2.2. I just assumed that Now, with master, I'm still not getting any references. There are tons of errors related to
|
Thanks for sharing this log! /cc @matloob for go/packages + cgo insight |
In general, go list needs to be able to work for our tools to work. Does your project build with |
go build works fine as well. I'm sure there's a main package somewhere that ends up using the problematic dependency and probably won't build without help, but that's not a problem for the vast majority of the code and the plethora of main packages in the module.
No |
Change https://golang.org/cl/217078 mentions this issue: |
Change https://golang.org/cl/217083 mentions this issue: |
@urandom: Can you confirm that this issue is fixed by downloading |
@stamblerre after updating gopls to master, i can now see some references. though it appears that they are only from the current package. The output of the check subcommand now looks like this:
|
Ah, looks like Michael's CL still didn't fix your error. @matloob: Can you take a look? |
I'm a bit stumped as to why this is happening. It would be really helpful if there was a repo we could try to reproduce this with locally so we can try to debug this. Is that something you could give us? |
Some more information: On a mac, the error message doesn't begin with a '#', so the workaround will not work there. This is what go list's stderr contains there:
Also, it appears that this github.com/foomo/bimg is responsible for the whole pkg-config mess. The following trivial example reproduces the error: package main
import (
"fmt"
_ "github.com/foomo/bimg"
)
func main() {
fmt.Println("test")
} |
Thanks for the repro, I'll see what's going on. The weird thing is that I'm getting the "#" in my stderr:
|
Change https://golang.org/cl/261502 mentions this issue: |
@urandom Could you give golang.org/cl/261502 a try to see if it fixes this? |
Just ran into this once again with the following error message:
|
This is still reproducible with the following repro case: -- go.mod --
module mod9.com
go 1.17
require github.com/foomo/bimg v1.0.18
-- go.sum --
github.com/foomo/bimg v1.0.18 h1:DealzQZr5XxafkD6f9RpkTAnLq+Y9Z6AZ9viF6bY8rA=
github.com/foomo/bimg v1.0.18/go.mod h1:Y9M1HDLviZ+H1lmP75eC054PXYYsNrwvVx5Q+ZO4POk=
-- main.go --
package main
import "github.com/foomo/bimg"
func main() int {
bimg.Initialize()
} Run This is an edge case, so lowering the priority as this is not a 1.0 blocker. |
This error occurs when querying for references on a type with gopls@8fe064f8
As a result of this, no references are being displayed. Whereas the preferred solution would be to ignore the problematic dependency and search for references in the valid ones. It is also possible that other commands fail because of the same error as well.
The text was updated successfully, but these errors were encountered: