From ba052312f2cc3f5b53bc33a17e5e26aced276b0c Mon Sep 17 00:00:00 2001 From: Ole-Morten Duesund Date: Sun, 24 Aug 2025 18:52:39 +0200 Subject: [PATCH] Format and lint codebase for consistency and quality MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Run go fmt on all Go code (server.go formatting cleanup) - Fix shellcheck issues in build-deb.sh script: - Replace indirect exit code checks ($?) with direct command checks - Use 'if ! command' instead of 'if [ $? -ne 0 ]' - Use 'if command' instead of 'if [ $? -eq 0 ]' - All quality checks now pass: - go fmt: ✅ Code properly formatted - go vet: ✅ No issues found - shellcheck: ✅ All shell scripts validated - go test: ✅ No test failures (no tests yet) Follows project guidelines for shell script validation and code quality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- internal/server/server.go | 2 +- scripts/build-deb.sh | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/internal/server/server.go b/internal/server/server.go index fd66b4c..76e89a8 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -149,7 +149,7 @@ func (s *Server) Start() error { // IPv6 address needs brackets addr = fmt.Sprintf("[%s]:%d", s.host, s.port) } - + s.server = &http.Server{ Addr: addr, Handler: router, diff --git a/scripts/build-deb.sh b/scripts/build-deb.sh index 5c102f7..7534373 100755 --- a/scripts/build-deb.sh +++ b/scripts/build-deb.sh @@ -45,22 +45,18 @@ LDFLAGS="-w -s -X main.version=$VERSION" # Build main skyview binary echo_info "Building skyview..." -go build -ldflags="$LDFLAGS" \ +if ! go build -ldflags="$LDFLAGS" \ -o "$DEB_DIR/usr/bin/skyview" \ - ./cmd/skyview - -if [ $? -ne 0 ]; then + ./cmd/skyview; then echo_error "Failed to build skyview" exit 1 fi # Build beast-dump utility echo_info "Building beast-dump..." -go build -ldflags="$LDFLAGS" \ +if ! go build -ldflags="$LDFLAGS" \ -o "$DEB_DIR/usr/bin/beast-dump" \ - ./cmd/beast-dump - -if [ $? -ne 0 ]; then + ./cmd/beast-dump; then echo_error "Failed to build beast-dump" exit 1 fi @@ -88,9 +84,7 @@ sed -i "s/Installed-Size:.*/Installed-Size: $INSTALLED_SIZE/" "$DEB_DIR/DEBIAN/c echo "Installed-Size: $INSTALLED_SIZE" >> "$DEB_DIR/DEBIAN/control" # Build the package -dpkg-deb --root-owner-group --build "$DEB_DIR" "$BUILD_DIR/$DEB_FILE" - -if [ $? -eq 0 ]; then +if dpkg-deb --root-owner-group --build "$DEB_DIR" "$BUILD_DIR/$DEB_FILE"; then echo_info "Successfully created: $BUILD_DIR/$DEB_FILE" # Show package info