-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: consider static configuration for multiple builds #65757
Comments
This comment has been minimized.
This comment has been minimized.
@findleyr @hyangah I think this is an opportunity to bring vscode-go and gopls's notions of build configuration closer. I would like to see one of two scenarios:
Of those two, I think option (1) is more viable because option (2) would mean vscode-go is somewhat crippled if gopls is not present or has an issue. Alternatively, we could do a hybrid: vscode-go reads the build configuration and acts on it; but if gopls is present then vscode-go passes the build configuration to it and gopls returns an 'expanded' build configuration. I think this could give us the best of both worlds. For example, if no build configuration is specified then vscode-go will do its best to infer it, but if gopls is present then it will provide a detailed build configuration including tool paths, etc. I'd also like to talk about the current state of build configuration and how we can improve on it. As discussed on golang/vscode-go#3670, there are some issues with
I suggest something along these lines for build configuration: build_config.gotype BuildConfiguration struct {
Env map[string]string
Tags []string
Flags BuildFlags
TestEnv map[string]string
TestFlags TestFlags
BenchFlags TestFlags
}
type commonFlags struct {
// Flags that are valid for `go build` and `go test`
Extra []string // Additional flags, may cause issues e.g. -tags
Ldflags []string
Gcflags []string
Cover bool
Covermode string
Coverpkg []string
}
type BuildFlags struct {
commonFlags
// Flags that are only valid for `go build`
}
type TestFlags struct {
commonFlags
// Flags that are only valid for `go test`
Count int
CPU int
Short bool
}
|
This is a follow up to #29202. In that issue, we added dynamic support for tracking multiple GOOS/GOARCH combinations, based on the set of open files. (e.g. if you open
foo_windows.go
, gopls will create a new View withGOOS=windows
).In some cases, it may be desirable for users to explicitly configure these builds, for example if they know a priori that they are targeting several ports, or sets of build tags. We should consider supporting this, for example via configuration like so:
The text was updated successfully, but these errors were encountered: