In theory, you simply do as you did, and it copies the binaries from the build area to /usr/local/bin
and then makes them belong to group procmod
and SetGID.
Consider running:
sh -x sudo.bash
That should show you what it is doing as it does it.
I don't entirely agree with what that script does; I want the Go debuggers not in /usr/local/bin
, thank you, but under $GOROOT, so I don't use the official sudo.bash
but instead created my own sudo.bash.goroot
which contains:
#!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
set -e
. ./env.bash
case "`uname`" in
Darwin)
;;
*)
exit 0
esac
for i in prof cov
do
sudo cp "$GOROOT"/src/cmd/$i/6$i $GOROOT/bin/6$i
sudo chgrp procmod $GOROOT/bin/6$i
sudo chmod g+s $GOROOT/bin/6$i
done
That works fine for me.