Skip to content

Option to run diagnostics only on current package #1275

Open
@wackywendell

Description

@wackywendell

Problem

I work in a large "monorepo", with many packages in it. With the default settings for gopls, on save I get 4K+ errors from parts of the repo I don't work on, due to all sorts of setup issues (e.g. setting CGO_CFLAGS) in those packages. I could try and get the setup correct for all of them, but this would be very time-consuming, and I already have the setup working correctly for the packages I am interested in.

Previous Behavior

Before using gopls, I had the setting "go.buildOnSave": "package", and as such, on save I would only see compiler errors for the package I was currently editing. This worked fine with the monorepo. With gopls, this is apparently not an option; as the option text for "Build on Save" says, "Options are 'workspace', 'package', or 'off'. Not applicable when using the language server's diagnostics. See 'go.languageServerExperimentalFeatures.diagnostics' setting.".

Workarounds

I can disable that experimental diagnostics setting (as discussed in #50), but this isn't really what I want, and will likely be deprecated eventually - I'm happy to get compiler errors from gopls, I just want them limited to the current package (and its dependencies in the current workspace), the same as if I called go build . in that package.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions