-
Notifications
You must be signed in to change notification settings - Fork 569
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
Add Go 1.16 to prerequisites (contributing doc) #1065
Conversation
Makefile
Outdated
install-dev: $(EMBEDDED_MANIFESTS_TARGET) | ||
CGO_ENABLED=0 go build -o /usr/local/bin ./cmd/flux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has never worked on my system, as /usr/local/bin
is protected, and I do not run my make
commands with sudo
:
$ make install-dev
CGO_ENABLED=0 go build -o /usr/local/bin ./cmd/flux
go build github.com/fluxcd/flux2/cmd/flux: copying /tmp/go-build3338692359/b001/exe/a.out: open /usr/local/bin/flux: permission denied
make: *** [Makefile:35: install-dev] Error 1
If you change it to something like this, it will prompt for a password, while (hopefully) not creating any problems on MacOS:
install-dev: $(EMBEDDED_MANIFESTS_TARGET) | |
CGO_ENABLED=0 go build -o /usr/local/bin ./cmd/flux | |
install-dev: $(EMBEDDED_MANIFESTS_TARGET) | |
CGO_ENABLED=0 go build -o /tmp/flux-dev ./cmd/flux | |
sudo install -Dm755 /tmp/flux-dev /usr/local/bin/flux |
This results in the following output, which should make clear why it asks for a password:
$ make install-dev
CGO_ENABLED=0 go build -o /tmp/flux-dev ./cmd/flux
sudo install -Dm755 /tmp/flux-dev /usr/local/bin/flux
[sudo] password for hidde:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that we are in a deadlock here, you don't want sudo make and I don't want make sudo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sudo make
would make Go run as root, which is not something you want as all Go Modules are cached for the normal user.
My suggestion makes this target work on any system, and the issue you have with it for MacOS (or more specifically, Homebrew) can be overcome by running brew
with the --overwrite
flag. Given all this, I see much stronger arguments in favor of my suggestion, than against.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've undone the changes to Makefile
1b89121
to
e285608
Compare
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
e285608
to
a29d0c5
Compare
Changes to contributing doc: