ARG VERSION
RUN go build -ldflags="-w -s -X \"main.version=${VERSION}\"" -o /server ./cmd/server
The backslashes around main.version= are needed to handle the case where ${VERSION} has spaces. However, VSCode sees the 2nd double quote (this one: \"main) as the end of the string literal. See the syntax coloring in the image:
I expect the entire sting literal "-w -s -X \"main.version=${VERSION}\"" to be yellow, apart from ${VERSION} which is correctly colored white.
For example,
The backslashes around
main.version=
are needed to handle the case where${VERSION}
has spaces. However, VSCode sees the 2nd double quote (this one:\"main
) as the end of the string literal. See the syntax coloring in the image:I expect the entire sting literal
"-w -s -X \"main.version=${VERSION}\""
to be yellow, apart from${VERSION}
which is correctly colored white.