From 7d26a3d6a5f221f0a5734bc186808e17d55931f3 Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 26 Apr 2024 20:40:57 +0000 Subject: [PATCH] Delete build.sh.save --- build.sh.save | 57 --------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 build.sh.save diff --git a/build.sh.save b/build.sh.save deleted file mode 100644 index f357679..0000000 --- a/build.sh.save +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# Default architecture -DEFAULT_ARCH="linux/amd64" - -# Supported architectures (adjust as needed) -ARCHITECTURES=("linux/amd64" "linux/arm64" "linux/arm/v7") - -# Ensure all necessary directories exist and go modules are ready -prepare_build() { - # Create necessary directories if they don't exist - mkdir -p dist - mkdir -p build_logs - - # Initialize go modules if go.mod does not exist - if [ ! -f go.mod ]; then - echo "Initializing Go modules" - go mod init yourmodule # Replace 'yourmodule' with your actual module name or path - fi - - # Fetch and ensure all dependencies are up to date - echo "Checking dependencies..." - go mod tidy -} - -# Build function -build_binary() { - os=$1 - arch=$2 - output_name="haste-it" - - if [[ "$os/$arch" != "$DEFAULT_ARCH" ]]; then - output_name="${output_name}_${os}_${arch}" - fi - - output_name="build_output/${output_name}" - - echo "Building for ${os}/${arch} -> ${output_name}" - GOOS=${os} GOARCH=${arch} go build -o ${output_name} main.go 2>build_logs/${os}_${arch}_build.log - if [ $? -eq 0 ]; then - echo "Successfully built ${output_name}" - else - echo "Failed to build ${output_name}" - fi -} - -# Main Build Process -prepare_build -for arch in "${ARCHITECTURES[@]}"; do - IFS='/' read -r -a parts <<< "$arch" # Split architecture string - os=${parts[0]} - arch=${parts[1]} - build_binary $os $arch -done - -echo "Build process completed." -