Home >Backend Development >Golang >Why Doesn't My Makefile Interpolate Expressions in $(())?

Why Doesn't My Makefile Interpolate Expressions in $(())?

Susan Sarandon
Susan SarandonOriginal
2024-12-30 22:27:10885browse

Why Doesn't My Makefile Interpolate Expressions in $(())?

Makefile Interpolation Issue

When attempting to interpolate an expression within a Makefile command, it remains unevaluated. This occurs when the expression is enclosed in double curly brackets $(()).

To resolve this issue, double the dollar sign ($) within the recipe section of the Makefile. This effectively escapes the first dollar sign, allowing for proper interpolation.

Here's an example of a corrected Makefile:

test:
    go test $$(go list ./... | grep -v /vendor/)

.PHONY: test

With this modification, the expression $$(go list ./... | grep -v /vendor/) will be evaluated properly when running the make test command.

The above is the detailed content of Why Doesn't My Makefile Interpolate Expressions in $(())?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn