#!stacks
"bug.Reportf" && "cache.port.matches:+5"

Issue created by stacks.

func (p port) matches(path string, content []byte) bool {
    ctxt := build.Default // make a copy
    ctxt.UseAllFiles = false
    path = filepath.Clean(path)
    if !filepath.IsAbs(path) {
        bug.Reportf("non-abs file path %q", path)   // <---------
        return false // fail closed
    ...

This stack NaAAKw was reported by telemetry:

golang.org/x/tools/gopls@v0.17.0-pre.2 go1.23.2 windows/amd64 vscode (2)

Dups: HAiIaQ TeKpaQ odV-aw TO9VqA 4ysk1A iieLfw

Comment From: gabyhelp

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: adonovan

This implies that session.DidModifyFiles was passed a list of modifications that include relative paths. This is most likely because DidOpen (among others) was passed a relative path that it should have either rejected or absolutized.

Comment From: findleyr

Agreed. The bug is not that the client sent bad paths, but that they weren't rejected earlier.

I feel like there's a whole category of bad inputs that gopls could do a better job of catching and handling. In this case, there's no good way to reject a bad notification, so gopls needs raise a message or diagnostic (or both) alerting the user that their client is misbehaving.

Comment From: adonovan

This stack HAiIaQ was reported by telemetry:

golang.org/x/tools/gopls@v0.17.1 go1.23.3 windows/amd64 other,vscode (1)

Comment From: adonovan

This stack TeKpaQ was reported by telemetry:

golang.org/x/tools/gopls@v0.17.1 go1.23.4 windows/amd64 vscode (1)

Comment From: adonovan

This stack odV-aw was reported by telemetry:

golang.org/x/tools/gopls@v0.18.0-pre.1 go1.23.4 windows/amd64 other,vscode (2)

Comment From: adonovan

This stack TO9VqA was reported by telemetry:

golang.org/x/tools/gopls@v0.18.1 go1.24.2 windows/amd64 other,vscode (2)

Comment From: adonovan

This stack 4ysk1A was reported by telemetry:

golang.org/x/tools/gopls@v0.19.0 go1.24.4 windows/amd64 vscode (1)

Comment From: adonovan

This stack iieLfw was reported by telemetry:

golang.org/x/tools/gopls@v0.19.1 go1.24.4 windows/amd64 other,vscode (1)