Skip to content

Commit

Permalink
chore: Modernize packaging scripts
Browse files Browse the repository at this point in the history
- Adds shebang directive for the default shell (used when the directive
  is missing).
- Ignore shellcheck warnings related to missing `compile.env` source
  files.
- Removes unnecessary GOPATH export.
- Removes `-mod=vendor` flag from `go build` command, as that flag is on
  by default in recent versions of Go.
  • Loading branch information
ctlong committed Mar 26, 2024
1 parent 12870cd commit a1c5bbe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
6 changes: 4 additions & 2 deletions packages/log-cache-cf-auth-proxy/packaging
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash

set -ex

# shellcheck source=/dev/null
source /var/vcap/packages/golang-1.21-linux/bosh/compile.env
export GOPATH=/var/vcap

go build -mod=vendor -o ${BOSH_INSTALL_TARGET}/log-cache-cf-auth-proxy ./cmd/cf-auth-proxy
go build -o "${BOSH_INSTALL_TARGET}/log-cache-cf-auth-proxy" ./cmd/cf-auth-proxy
8 changes: 5 additions & 3 deletions packages/log-cache-gateway/packaging
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash

set -ex

# shellcheck source=/dev/null
source /var/vcap/packages/golang-1.21-linux/bosh/compile.env
export GOPATH=/var/vcap

VERSION=$(cat version)
go build -mod=vendor \
-o ${BOSH_INSTALL_TARGET}/log-cache-gateway \
go build \
-o "${BOSH_INSTALL_TARGET}/log-cache-gateway" \
-ldflags "-X main.buildVersion=${VERSION}" \
./cmd/gateway
6 changes: 4 additions & 2 deletions packages/log-cache-syslog-server/packaging
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash

set -ex

# shellcheck source=/dev/null
source /var/vcap/packages/golang-1.21-linux/bosh/compile.env
export GOPATH=/var/vcap

go build -mod=vendor -o ${BOSH_INSTALL_TARGET}/log-cache-syslog-server ./cmd/syslog-server
go build -o "${BOSH_INSTALL_TARGET}/log-cache-syslog-server" ./cmd/syslog-server
6 changes: 4 additions & 2 deletions packages/log-cache/packaging
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash

set -ex

# shellcheck source=/dev/null
source /var/vcap/packages/golang-1.21-linux/bosh/compile.env
export GOPATH=/var/vcap

go build -mod=vendor -o ${BOSH_INSTALL_TARGET}/log-cache ./cmd/log-cache
go build -o "${BOSH_INSTALL_TARGET}/log-cache" ./cmd/log-cache

0 comments on commit a1c5bbe

Please sign in to comment.