Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
name: golangci-lint
on:
pull_request:
paths-ignore:
paths-ignore:
- 'README.md'
- '*_test.go'
jobs:
golangci:
strategy:
matrix:
go-version: [1.22.x]
# os: [ubuntu-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
name: lint
runs-on: ${{ matrix.os }}
Expand All @@ -18,13 +17,27 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Check for Cgo dependencies
shell: bash
run: |
echo "Searching for packages that require Cgo..."
CGO_PACKAGES=$(go list -f '{{if .CgoFiles}}{{.ImportPath}}{{end}}' -tags cgo ./...)
if [ -n "$CGO_PACKAGES" ]; then
echo "::error::Found packages that require Cgo, which is not allowed."
echo "This will result in a dynamically linked binary."
echo "The following packages must be removed or refactored:"
echo "$CGO_PACKAGES"
# Exit with a non-zero status to fail the workflow
exit 1
else
echo "Success: No Cgo dependencies found."
fi

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.63

# Optional: golangci-lint command line arguments.
args: --timeout=5m

# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true

17 changes: 7 additions & 10 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ VERSION=$(cat releaseVersion.txt | awk -F'majorMinor=' '{printf$2}')
BUILD_TIMESTAMP=$(date -u '+%Y-%m-%d_%I:%M:%S%p')
LDFLAGS="-s -w -X ${CONFIG_PATH}.Version=${VERSION}.${VERSION_NUMBER} -X ${CONFIG_PATH}.BuildTimestamp=${BUILD_TIMESTAMP} -X ${CONFIG_PATH}.USUsageEndpoint=${US_USAGE_ENDPOINT} -X ${CONFIG_PATH}.USAttachmentEndpoint=${US_ATTACHMENT_ENDPOINT} -X ${CONFIG_PATH}.USHaberdasherURL=${US_HABERDASHER_URL} -X ${CONFIG_PATH}.EUUsageEndpoint=${EU_USAGE_ENDPOINT} -X ${CONFIG_PATH}.EUAttachmentEndpoint=${EU_ATTACHMENT_ENDPOINT} -X ${CONFIG_PATH}.EUHaberdasherURL=${EU_HABERDASHER_URL}"

# Disable CGO to ensure we're using pure go and to fix 'version `GLIBC_2.34' not found' errors
CGO_ENABLED=0

# Set version based on version.txt file and auto version number
echo "Build version is $VERSION.$VERSION_NUMBER"
echo "Buildstamp is $BUILD_TIMESTAMP"
Expand All @@ -52,29 +49,29 @@ echo "running GOOS=windows go get -t ./..."
$(GOOS=windows go get -t ./...)

echo "Building Mac x64 $EXENAME"
GOOS=darwin GOARCH=amd64 go build -o "$TEMPNAME" -ldflags "$LDFLAGS"
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -tags netgo -o "$TEMPNAME" -ldflags "$LDFLAGS"
$(mv "$TEMPNAME" "bin/mac/${EXENAME}_x64")

echo "Building Mac arm64 $EXENAME"
GOOS=darwin GOARCH=arm64 go build -o "$TEMPNAME" -ldflags "$LDFLAGS"
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -tags netgo -o "$TEMPNAME" -ldflags "$LDFLAGS"
$(mv "$TEMPNAME" "bin/mac/${EXENAME}_arm64")

echo "Building Linux x64"
GOOS=linux GOARCH=amd64 go build -o "$TEMPNAME" -ldflags "$LDFLAGS"
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -tags netgo -o "$TEMPNAME" -ldflags "$LDFLAGS"
$(mv "$TEMPNAME" "bin/linux/${EXENAME}_x64")

echo "Building Linux arm64"
GOOS=linux GOARCH=arm64 go build -o "$TEMPNAME" -ldflags "$LDFLAGS"
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -tags netgo -o "$TEMPNAME" -ldflags "$LDFLAGS"
$(mv "$TEMPNAME" "bin/linux/${EXENAME}_arm64")

echo "Building Windows 386"
GOOS=windows GOARCH=386 go build -o "$TEMPNAME" -ldflags "$LDFLAGS"
GOOS=windows GOARCH=386 CGO_ENABLED=0 go build -tags netgo -o "$TEMPNAME" -ldflags "$LDFLAGS"
$(mv "$TEMPNAME" "bin/win/$EXENAME.exe")

echo "Building Windows x64"
GOOS=windows GOARCH=amd64 go build -o "$TEMPNAME" -ldflags "$LDFLAGS"
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -tags netgo -o "$TEMPNAME" -ldflags "$LDFLAGS"
$(mv "$TEMPNAME" "bin/win/${EXENAME}_x64.exe")

echo "Building Windows arm64"
GOOS=windows GOARCH=arm64 go build -o "$TEMPNAME" -ldflags "$LDFLAGS"
GOOS=windows GOARCH=arm64 CGO_ENABLED=0 go build -tags netgo -o "$TEMPNAME" -ldflags "$LDFLAGS"
$(mv "$TEMPNAME" "bin/win/${EXENAME}_arm64.exe")
Loading