-
Notifications
You must be signed in to change notification settings - Fork 433
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
Nested cmd directories support #93
Comments
@thockin what is required to be done to support nested folders
BINS=cmd/folder1 make build |
This part is failing when BIN has a nested path |
Ok got it the issue is Makefile is expecting the binary to be created at bin/darwin_arm64/acquiring/server but build.sh does not generate like that! |
We need to use GOBIN in the build.sh as it is building in a flat out way and not following the same structure of cmd/acquring/server |
This can start throwing binaries at the required folder which Makefile expects, but need more polishing and also go install part in the end needs a fix. ./build.sh needs a fix with below: # Iterate through all Go packages under github.com/XXX/XXX/cmd
for pkg in $(go list github.com/XXX/XXX/cmd/...); do
relative_path=$(echo "${pkg}" | sed 's|^github.com/razorpay/upi-switch/||')
if [ -f "${relative_path}/main.go" ]; then
# Identify main packages and create binaries
binary_name=$(basename "${relative_path}")
binary_path=$(echo "${relative_path}" | sed 's|^cmd/||')
echo "relative_path: ${relative_path}"
echo "binary_name: ${binary_name}"
echo "binary_path: ${binary_path}"
# Construct binary_install_path
binary_install_path="${GOPATH}/bin/${binary_path}"
# Ensure the directory structure exists
mkdir -p "${binary_install_path}"
echo "go install -o ${binary_install_path}/${binary_name} -ldflags '-X ${pkg}/pkg/version.Version=${VERSION}' ${relative_path}"
echo "--"
fi
done |
Note that GOBIN is hostile to cross-compiles. |
Fails with:
The text was updated successfully, but these errors were encountered: