Refactor XML response handling in device extended and security tests

- Adjusted formatting in XML response strings for consistency in device_extended_test.go and device_security_test.go.
- Improved readability by aligning XML declaration and body content.
- Updated mock server responses to ensure proper handling of various ONVIF operations.

Enhance device security and storage handling

- Refactored struct field declarations in device_security.go and device_storage_test.go for improved clarity.
- Ensured consistent formatting across struct definitions and XML tags.

Standardize whitespace and formatting across multiple files

- Removed unnecessary blank lines and adjusted indentation in discovery, imaging, media, and PTZ server files.
- Improved overall code readability and maintainability by ensuring consistent formatting.

Update example applications for better readability

- Cleaned up whitespace in example applications to enhance code clarity.
- Ensured consistent formatting in main.go files across various examples.

Refactor server and SOAP handler code for consistency

- Standardized struct field declarations and XML tag formatting in server and SOAP handler files.
- Improved readability by aligning struct fields and ensuring consistent use of whitespace.

General code cleanup and formatting adjustments

- Applied consistent formatting across various files, including types.go and test files.
- Enhanced readability by aligning struct fields and removing unnecessary blank lines.
This commit is contained in:
ProtoTess
2025-12-01 00:49:36 +00:00
parent 856f49c82d
commit b4e4982876
37 changed files with 318 additions and 322 deletions
+18 -18
View File
@@ -18,15 +18,15 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
with: with:
go-version: '1.23' go-version: '1.23'
- name: Cache Go modules - name: Cache Go modules
uses: actions/cache@v4 uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with: with:
path: ~/go/pkg/mod path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
@@ -45,7 +45,7 @@ jobs:
fi fi
- name: Lint - name: Lint
uses: golangci/golangci-lint-action@v4 uses: golangci/golangci-lint-action@3cfe3a4ac716397848d91e4042119f51a40b6aaf # v4.0.0
with: with:
version: latest version: latest
args: --timeout=5m --fix=false args: --timeout=5m --fix=false
@@ -58,15 +58,15 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
with: with:
go-version: '1.23' go-version: '1.23'
- name: Cache Go modules - name: Cache Go modules
uses: actions/cache@v4 uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with: with:
path: ~/go/pkg/mod path: ~/go/pkg/mod
key: ${{ runner.os }}-go-1.23-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-1.23-${{ hashFiles('**/go.sum') }}
@@ -83,7 +83,7 @@ jobs:
run: go tool cover -html=coverage.out -o coverage.html run: go tool cover -html=coverage.out -o coverage.html
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v4 uses: codecov/codecov-action@8a4b2d1c64a2a31fb92d9fa9f1e2b02e35d2db1a # v4.0.1
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.out files: ./coverage.out
@@ -93,7 +93,7 @@ jobs:
- name: Archive coverage - name: Archive coverage
if: always() if: always()
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@89ef406dd8d8a50a2f1e5e903c0e970c27a27de8 # v4.3.5
with: with:
name: coverage-report name: coverage-report
path: | path: |
@@ -119,15 +119,15 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
- name: Cache Go modules - name: Cache Go modules
uses: actions/cache@v4 uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with: with:
path: | path: |
~/.cache/go-build ~/.cache/go-build
@@ -151,17 +151,17 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Download coverage from test job - name: Download coverage from test job
uses: actions/download-artifact@v4 uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with: with:
name: coverage-report name: coverage-report
- name: SonarCloud Scan - name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master uses: SonarSource/sonarcloud-github-action@3b335e14ab49358d133eef17b8c1590fe7c21c0e # v2.2.0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
@@ -179,15 +179,15 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
with: with:
go-version: '1.23' go-version: '1.23'
- name: Cache Go modules - name: Cache Go modules
uses: actions/cache@v4 uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with: with:
path: ~/go/pkg/mod path: ~/go/pkg/mod
key: ${{ runner.os }}-go-1.23-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-1.23-${{ hashFiles('**/go.sum') }}
+2 -2
View File
@@ -15,10 +15,10 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with: with:
name: coverage-report name: coverage-report
+11 -11
View File
@@ -39,12 +39,12 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
with: with:
go-version: '1.21' go-version: '1.21'
@@ -142,12 +142,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with: with:
path: all-releases path: all-releases
pattern: release-* pattern: release-*
@@ -177,7 +177,7 @@ jobs:
fi fi
- name: Create Release - name: Create Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with: with:
files: all-releases/* files: all-releases/*
draft: true draft: true
@@ -228,23 +228,23 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@49b3bc8e6f341ff684fb5300544cda1ff1a290d5 # v3.2.0
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@4fd812986e6c8ec69f87869bf8f84174f3426a6d # v3.4.0
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1b4ee7e33440 # v3.3.0
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
continue-on-error: true continue-on-error: true
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1b4ee7e33440 # v3.3.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
@@ -255,7 +255,7 @@ jobs:
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build and push - name: Build and push
uses: docker/build-push-action@v5 uses: docker/build-push-action@5f63d2b5a0f13e6fe58a2658b1cf779280e04def # v6.2.0
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
+3 -3
View File
@@ -18,15 +18,15 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
- name: Cache Go modules - name: Cache Go modules
uses: actions/cache@v4 uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with: with:
path: ~/go/pkg/mod path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
-1
View File
@@ -497,4 +497,3 @@ func generateNonce() string {
// Generate a simple nonce // Generate a simple nonce
return fmt.Sprintf("%d", time.Now().UnixNano()) return fmt.Sprintf("%d", time.Now().UnixNano())
} }
-1
View File
@@ -150,7 +150,6 @@ func listNetworkInterfaces() {
} }
} }
func connectAndShowInfo() { func connectAndShowInfo() {
reader := bufio.NewReader(os.Stdin) reader := bufio.NewReader(os.Stdin)
-1
View File
@@ -1092,4 +1092,3 @@ func (c *Client) SetNetworkDefaultGateway(ctx context.Context, gateway *NetworkG
return nil return nil
} }
-1
View File
@@ -1,5 +1,4 @@
package onvif package onvif
package captures
import ( import (
"context" "context"