From aa910dee0a63a56c5ccd6cf6e7948c3dbd073cb3 Mon Sep 17 00:00:00 2001 From: Galaco Date: Sun, 1 Oct 2023 14:20:15 +0900 Subject: [PATCH] Corrected writer log --- .github/workflows/test.yml | 11 +---------- lump/primitive/common/common.go | 5 +---- .../leafambientlighting/leafambientlighting.go | 2 +- writer_test.go | 10 +++++----- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5d1648b..844ee76 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Test and coverage on: push: - branches: [main] + branches: [*] pull_request: branches: [main] jobs: @@ -17,14 +17,5 @@ jobs: uses: actions/setup-go@v2 with: go-version: '1.19.0' - - name: Check gofmt on libs - run: | - unformatted_files=$(gofmt -l libs) - if [[ -n "$unformatted_files" ]]; then - echo "The following files are not properly formatted:" - echo "$unformatted_files" - echo "Run 'gofmt -w libs' to fix formatting." - exit 1 - fi - name: Run coverage run: go test ./... -race -coverpkg=./libs/... -coverprofile=coverage.out -covermode=atomic diff --git a/lump/primitive/common/common.go b/lump/primitive/common/common.go index 9bab76f..ba9470c 100644 --- a/lump/primitive/common/common.go +++ b/lump/primitive/common/common.go @@ -107,7 +107,4 @@ type MapDispInfo struct { } // CompressedLightCube -type CompressedLightCube struct { - // Color - Color [6]ColorRGBExponent32 `json:"color"` -} +type CompressedLightCube = [6]ColorRGBExponent32 diff --git a/lump/primitive/leafambientlighting/leafambientlighting.go b/lump/primitive/leafambientlighting/leafambientlighting.go index 9a05a1d..ba710d9 100644 --- a/lump/primitive/leafambientlighting/leafambientlighting.go +++ b/lump/primitive/leafambientlighting/leafambientlighting.go @@ -15,5 +15,5 @@ type LeafAmbientLighting struct { // Z z Z byte `json:"z"` // Pad is padding to 4 bytes (any other purpose unknown). - Unknown1 byte + Pad byte } diff --git a/writer_test.go b/writer_test.go index 1380325..a8ba72f 100644 --- a/writer_test.go +++ b/writer_test.go @@ -88,8 +88,8 @@ func TestWriter_Write(t *testing.T) { expectedLumpOffset := int(binary.LittleEndian.Uint32(expectedBytes[offset : offset+4])) expectedLumpLength := int(binary.LittleEndian.Uint32(expectedBytes[offset+4 : offset+8])) - actualLumpOffset := int(binary.LittleEndian.Uint32(expectedBytes[offset : offset+4])) - actualLumpLength := int(binary.LittleEndian.Uint32(expectedBytes[offset+4 : offset+8])) + actualLumpOffset := int(binary.LittleEndian.Uint32(actual[offset : offset+4])) + actualLumpLength := int(binary.LittleEndian.Uint32(actual[offset+4 : offset+8])) log.Printf("%d: offset: %d, %d (%d). length: %d, %d (%d). Version: %d, %d\n", i, expectedLumpOffset, @@ -126,9 +126,9 @@ func TestWriter_Write(t *testing.T) { t.Errorf("toBytes(%s) returned unexpected bytes", tc.filePath) } - //if diff := cmp.Diff(expectedBytes, actual); diff != "" { - // t.Errorf("toBytes(%s) returned unexpected diff (-want +got):\n%s", tc.filePath, diff) - //} + if diff := cmp.Diff(expectedBytes, actual); diff != "" { + t.Errorf("toBytes(%s) returned unexpected diff (-want +got):\n%s", tc.filePath, diff) + } } }) }