vscode-proto3 icon indicating copy to clipboard operation
vscode-proto3 copied to clipboard

Not executing backtick command in `--proto_path`

Open meling opened this issue 2 years ago • 0 comments

In several of my projects I use a configuration like this (and it works fine):

"options": [
	"--proto_path=${workspaceRoot}/",
	"--proto_path=`go list -m -f {{.Dir}} github.com/relab/gorums`",
	"--go_out=proto/"
]

However, I'm trying to set up the same in an another project, but I cannot seem to get it to work. I get this error and the plugin show errors in the Problems pane:

`go list -m -f {{.Dir}} github.com/relab/gorums`: warning: directory does not exist. gorums.proto: File not found.

If I run the command go list -m -f {{.Dir}} github.com/relab/gorums in the terminal and copy the output, the errors go away and all is fine:

"options": [
	"--proto_path=${workspaceRoot}/",
	"--proto_path=/Users/meling/go/pkg/mod/github.com/relab/[email protected]",
	"--go_out=proto/"
]

I've also tried with the $(shell ...) thing:

"options": [
	"--proto_path=${workspaceRoot}/",
	"--proto_path=$(shell go list -m -f {{.Dir}} github.com/relab/gorums)",
	"--go_out=proto/"
]

Anyone know what could be the problem?

PS: The reason for using the command to populate the proto_path is so that I can commit the settings.json to git and allow other developers get this working out of the box.

meling avatar Jun 17 '23 19:06 meling