Merge branch '11016-doc-signing-ttl'
[arvados.git] / build / run-library.sh
index af95cdc6012cb65b160819fd78042e8d8ba4d4fd..ea839aa0de2828234e84b85eca93ec9d2767b930 100755 (executable)
@@ -104,6 +104,9 @@ handle_ruby_gem() {
 }
 
 calculate_go_package_version() {
+  # $__returnvar has the nameref attribute set, which means it is a reference
+  # to another variable that is passed in as the first argument to this function.
+  # see https://www.gnu.org/software/bash/manual/html_node/Shell-Parameters.html
   local -n __returnvar="$1"; shift
   local src_path="$1"; shift
 
@@ -161,7 +164,7 @@ package_go_binary() {
       return 1
     fi
 
-    go get -ldflags "-X main.version=${go_package_version}" "git.curoverse.com/arvados.git/$src_path"
+    go get -ldflags "-X git.curoverse.com/arvados.git/lib/cmd.version=${go_package_version} -X main.version=${go_package_version}" "git.curoverse.com/arvados.git/$src_path"
 
     local -a switches=()
     systemd_unit="$WORKSPACE/${src_path}/${prog}.service"
@@ -226,6 +229,15 @@ test_rails_package_presence() {
 }
 
 get_complete_package_name() {
+  # if the errexit flag is set, unset it until this function returns
+  # otherwise, the shift calls below will abort the program if optional arguments are not supplied
+  if [ -o errexit ]; then
+    set +e
+    trap 'set -e' RETURN
+  fi
+  # $__returnvar has the nameref attribute set, which means it is a reference
+  # to another variable that is passed in as the first argument to this function.
+  # see https://www.gnu.org/software/bash/manual/html_node/Shell-Parameters.html
   local -n __returnvar="$1"; shift
   local pkgname="$1"; shift
   local version="$1"; shift