Skip to content

fix the variable override mechanism#362

Merged
SuperSandro2000 merged 1 commit intomainfrom
better-variable-overrides
Sep 4, 2025
Merged

fix the variable override mechanism#362
SuperSandro2000 merged 1 commit intomainfrom
better-variable-overrides

Conversation

@majewsky
Copy link
Copy Markdown
Contributor

@majewsky majewsky commented Sep 4, 2025

The override mechanism proposed by @stanislav-zaprudskiy in #352 is problematic because --warn-undefined-variables makes noise about it:

$ make
Makefile:67: warning: undefined variable 'GO_BUILDFLAGS'
Makefile:68: warning: undefined variable 'GO_LDFLAGS'
Makefile:69: warning: undefined variable 'GO_TESTFLAGS'
Makefile:70: warning: undefined variable 'GO_TESTENV'
Makefile:71: warning: undefined variable 'GO_BUILDENV'
env  go build -mod vendor  -ldflags '-s -w ...

However, through much experimentation, I discovered that the += operator behaves in the intended way, as documented in the new generated comment.

The override mechanism proposed by @stanislav-zaprudskiy in #352 is
problematic because --warn-undefined-variables makes noise about it:

```shellSession
$ make
Makefile:67: warning: undefined variable 'GO_BUILDFLAGS'
Makefile:68: warning: undefined variable 'GO_LDFLAGS'
Makefile:69: warning: undefined variable 'GO_TESTFLAGS'
Makefile:70: warning: undefined variable 'GO_TESTENV'
Makefile:71: warning: undefined variable 'GO_BUILDENV'
env  go build -mod vendor  -ldflags '-s -w ...
```

However, through much experimentation, I discovered that the += operator
behaves in the intended way, as documented in the new generated comment.
@majewsky majewsky force-pushed the better-variable-overrides branch from 17a8dc7 to f56b186 Compare September 4, 2025 11:41
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 4, 2025

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/sapcc/go-makefile-maker/internal/makefile 8.00% (-0.05%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/sapcc/go-makefile-maker/internal/makefile/makefile.go 0.00% (ø) 196 (+2) 0 196 (+2)

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@SuperSandro2000 SuperSandro2000 merged commit 56cafea into main Sep 4, 2025
8 checks passed
@majewsky majewsky deleted the better-variable-overrides branch September 4, 2025 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants