Skip to content
Snippets Groups Projects
build-go.sh 1.23 KiB
Newer Older
#!/bin/sh
# Copyright (C) 2022 Associated Universities, Inc. Washington DC, USA.
#
# This file is part of NRAO Workspaces.
#
# Workspaces is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Workspaces is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Workspaces.  If not, see <https://www.gnu.org/licenses/>.
#

# Set failfast
set -e
set -o pipefail

BUILD_DIR=/builds/ssa/workspaces/go
[[ -d $BUILD_DIR ]] ||  mkdir -p $BUILD_DIR

cd  apps/cli/executables/go/
for module in "$@"
do
  if [ $module == "ingest" ]; then
    echo "Skipping $module"
    continue
  fi

  # if directory doesn't exist, skip
  if [ ! -d "$module" ]; then
    echo "Directory $module doesn't exist skipping"
    continue
  fi

  cd  "$module"

  # Run the build
  CGO_ENABLED=0 go build -a -ldflags "-w -s" -o $BUILD_DIR/$module