You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ran into 2 minor issue with the do.sh script on FreeBSD.
uname -a
FreeBSD syslogserver.cidercreekranch.net 12.2-RELEASE-p2 FreeBSD 12.2-RELEASE-p2 663e6b09467(HEAD) TRUENAS amd64
The do.sh script uses a shebang of #!/bin/bash, but on FreeBSD bash is found at /usr/local/bin/bash. To get around this problem I change the shebang to:
$!/usr/bin/env bash
The hostname command on FreeBSD does not support the -fqdn switch. The same results can be achieved by simply calling hostname without switches.
I added an OS test in the build function which allowed the build to complete.
build () {
local VERSION=$(git describe --always --long)
local DT=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # ISO-8601
#-- Added OS test for FreeBSD
if [ $(uname) = "FreeBSD" ]; then
local FQDN=$(hostname)
else
local FQDN=$(hostname --fqdn)
fi
local SEMVER=$(git tag --list --sort="v:refname" | tail -n -1)
local BRANCH=$(git rev-parse --abbrev-ref HEAD)
go build -i -v -ldflags=" -X main.version=${VERSION} -X main.builddt=${DT} -X main.host=${FQDN} -X main.semver=${SEMVER} -X main.branch=${BRANCH}" .
}
The text was updated successfully, but these errors were encountered:
I submitted a PR for the two changes I made. Note that I created a new function, Hostname(), to hide the details since how to query for the FQDN can vary from OS to OS.
I'm assuming that the suggested changes to main.go were intended for someone else since I have not yet to passed GO nor collected ... :)
Ran into 2 minor issue with the do.sh script on FreeBSD.
$!/usr/bin/env bash
I added an OS test in the build function which allowed the build to complete.
The text was updated successfully, but these errors were encountered: