Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
KopiasCsaba committed Nov 8, 2023
1 parent 6acaf3b commit 14bd599
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export GOPATH=""
echo -e "Downloading dependencies...\n"
go mod download

git config --global --add safe.directory /mnt

REVISION=$(git rev-parse HEAD 2>/dev/null || echo 1)
# build_application($1,$2,$3) executes go build with all the required parameters.
# $1: The selected go operating system
# $2: The selected go architecture
Expand All @@ -25,8 +28,8 @@ build_application() {
rm "$BUILD_DIR/app-$GOOS-$GOARCH.bin" >/dev/null 2>&1

go build -tags netgo \
-ldflags "-s -w -X main.Revision=$(git rev-parse HEAD 2>/dev/null || echo 1) -X main.BuildTime=$(date +'%Y-%m-%d_%T') " \
-o "$BUILD_DIR/app-$GOOS-$GOARCH.$EXTENSION" \
-ldflags "-s -w -X main.Revision=$REVISION -X main.BuildTime=$(date +'%Y-%m-%d_%T') " \
-o "$BUILD_DIR/oscbridge-${REVISION:0:8}-$GOOS-$GOARCH.$EXTENSION" \
cmd/main/main.go


Expand Down
2 changes: 1 addition & 1 deletion docker/rundev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ while true; do

echo "> Starting app..."
# shellcheck disable=SC2086
go run -ldflags "-s -w -X main.Revision='development' -X main.BuildTime=$(date +'%Y-%m-%d_%T')" cmd/main/main.go &
go run -ldflags "-s -w -X main.Revision='devel' -X main.BuildTime=$(date +'%Y-%m-%d_%T')" cmd/main/main.go &

# Store PID
PID=$!
Expand Down
5 changes: 4 additions & 1 deletion src/cmd/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ import (
"net.kopias.oscbridge/app/usecase/usecaseifs"
)

const Version = "v1.0.0"

var (

// Revision is the git revision of the current executable, filled in with the build command.
Revision string
// BuildTime is the time of build of the current executable, filled in with the build command.
Expand All @@ -51,7 +54,7 @@ func main() {

log := logger.New()
log.Infof(ctx, "OPEN SOUND CONTROL BRIDGE is starting.")
log.Infof(ctx, "Build time: %s Revision: %s", BuildTime, Revision)
log.Infof(ctx, "Version: %s Revision: %.8s Built at: %s", Version, Revision, BuildTime)

err := startApp(ctx, log)
if err != nil {
Expand Down

0 comments on commit 14bd599

Please sign in to comment.