Skip to content
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

fix: made build target to work predictably #247

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

defanator
Copy link
Contributor

Proposed changes

Previously make build did not do anything if a binary was deleted from the build directory, or the directory was created before running the target, as the target was not marked as PHONY:

% make clean
rm -rf ./build
% make build
GOWORK=off CGO_ENABLED=0 go build -ldflags="-w -X main.version=v2.23.1 -X main.commit=7a08fe56 -X main.date=2023-03-10_18-46-36" -o ./build/nginx-agent
% make build
make: `build' is up to date.
% rm build/nginx-agent 
% make build
make: `build' is up to date.
% ls -l build 
total 0

After the change:

% make clean
rm -rf ./build
% make build
GOWORK=off CGO_ENABLED=0 go build -ldflags="-w -X main.version=v2.23.1 -X main.commit=efc82b89 -X main.date=2023-03-10_19-53-49" -o ./build/nginx-agent
% make build
make: Nothing to be done for `build'.
% rm build/nginx-agent 
% make build
GOWORK=off CGO_ENABLED=0 go build -ldflags="-w -X main.version=v2.23.1 -X main.commit=efc82b89 -X main.date=2023-03-10_19-54-14" -o ./build/nginx-agent

(simply marking it as PHONY makes no sense as in usual workflows one would never need to rebuild the same binary in subsequent calls)

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • I have updated any relevant documentation (README.md)

Previously "make build" did not do anything if a binary was deleted
from the "build" directory, as the target was not marked as PHONY.
@netlify
Copy link

netlify bot commented Mar 10, 2023

Deploy Preview for agent-public-docs canceled.

Name Link
🔨 Latest commit efc82b8
🔍 Latest deploy log https://app.netlify.com/sites/agent-public-docs/deploys/640b536c4dfdbe0008094c9b

@github-actions github-actions bot added the bug Something isn't working label Mar 10, 2023
@Dean-Coakley Dean-Coakley merged commit 7d7fbaa into nginx:main Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants