I'm developing a GOCACHEPROG implementation that should store compiler cache in S3-compatible storage. Recently we faced a strange issue with golangci-lint running on a project that uses CGO.

After investigation I found a root cause. Golangci-lint uses packages.Load as a key function to inspect a project. Under the hood this function contains a code that excludes files with non-.go extensions from CompiledGoFiles but does not exclude files without extensions. A comment to that code explicitly metions that files without extensions are cached objects. Issue has been solved by changing a naming scheme for files returned in DiskPath field from /<storage_root>/<action_id>.data to /<storage_root>/<action_id>-data.

It looks like some clarification should be added here because I used this file as documentation during GOCACHEPROG helper development. Something like

type Response struct {
    // other fields

    // DiskPath is the absolute path on disk of the body corresponding to a
    // "get" (on cache hit) or "put" request's ActionID.
        // DiskPath should not contain extension in filename.
    DiskPath string `json:",omitempty"`
}

I've filed a blank issue becuse it's unclear for me which type to choose: it's not an actual bug but also it's not a language-changing proposal.

Comment From: gopherbot

Change https://go.dev/cl/685915 mentions this issue: cmd/go: clarify that DiskPath should not contain file extension