Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

fix: resolve golangci-lint failures in Go CI (#1629)

Harrison Conlin9ba56493cdaf
diff --git a/backend/internal/core/services/service_user_login_test.go b/backend/internal/core/services/service_user_login_test.go
index 90d52331..09ccfd95 100644
--- a/backend/internal/core/services/service_user_login_test.go
+++ b/backend/internal/core/services/service_user_login_test.go
@@ -2,7 +2,6 @@ package services
import (
"context"
- "errors"
"testing"
"github.com/stretchr/testify/assert"
@@ -33,12 +32,12 @@ func TestLogin_EndToEnd(t *testing.T) {
t.Run("wrong password is rejected with generic error", func(t *testing.T) {
_, err := tSvc.User.Login(ctx, reg.Email, "wrong-password", false)
require.Error(t, err)
- assert.True(t, errors.Is(err, ErrorInvalidLogin))
+ assert.ErrorIs(t, err, ErrorInvalidLogin)
})
t.Run("nonexistent user is rejected with the same generic error", func(t *testing.T) {
_, err := tSvc.User.Login(ctx, "[email protected]", "any-password", false)
require.Error(t, err)
- assert.True(t, errors.Is(err, ErrorInvalidLogin))
+ assert.ErrorIs(t, err, ErrorInvalidLogin)
})
}
diff --git a/backend/internal/data/repo/repo_entities.go b/backend/internal/data/repo/repo_entities.go
index 3bbe452d..8b894b2f 100644
--- a/backend/internal/data/repo/repo_entities.go
+++ b/backend/internal/data/repo/repo_entities.go
@@ -111,15 +111,15 @@ type (
PurchaseDate types.Date `json:"purchaseDate"`
// Sold
SoldDate types.Date `json:"soldDate"`
- Name string `json:"name" validate:"required,min=1,max=255"`
- Description string `json:"description" validate:"max=1000"`
+ Name string `json:"name" validate:"required,min=1,max=255"`
+ Description string `json:"description" validate:"max=1000"`
// Identifications
SerialNumber string `json:"serialNumber"`
ModelNumber string `json:"modelNumber"`
Manufacturer string `json:"manufacturer"`
WarrantyDetails string `json:"warrantyDetails"`
- PurchaseFrom string `json:"purchaseFrom" validate:"max=255"`
- SoldTo string `json:"soldTo" validate:"max=255"`
+ PurchaseFrom string `json:"purchaseFrom" validate:"max=255"`
+ SoldTo string `json:"soldTo" validate:"max=255"`
SoldNotes string `json:"soldNotes"`
// Extras
Notes string `json:"notes"`
@@ -128,8 +128,8 @@ type (
Fields []EntityFieldData `json:"fields"`
AssetID AssetID `json:"assetId" swaggertype:"string"`
Quantity float64 `json:"quantity"`
- PurchasePrice float64 `json:"purchasePrice" extensions:"x-nullable,x-omitempty"`
- SoldPrice float64 `json:"soldPrice" extensions:"x-nullable,x-omitempty"`
+ PurchasePrice float64 `json:"purchasePrice" extensions:"x-nullable,x-omitempty"`
+ SoldPrice float64 `json:"soldPrice" extensions:"x-nullable,x-omitempty"`
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable,x-omitempty"`
ID uuid.UUID `json:"id"`
EntityTypeID uuid.UUID `json:"entityTypeId"`
diff --git a/backend/internal/data/repo/repo_entity_templates.go b/backend/internal/data/repo/repo_entity_templates.go
index 8a344f6d..609a5f3a 100644
--- a/backend/internal/data/repo/repo_entity_templates.go
+++ b/backend/internal/data/repo/repo_entity_templates.go
@@ -44,15 +44,15 @@ type (
EntityTemplateCreate struct {
// Default values for entities
DefaultQuantity *float64 `json:"defaultQuantity,omitempty" extensions:"x-nullable"`
- DefaultName *string `json:"defaultName,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
- DefaultDescription *string `json:"defaultDescription,omitempty" validate:"omitempty,max=1000" extensions:"x-nullable"`
- DefaultManufacturer *string `json:"defaultManufacturer,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
- DefaultModelNumber *string `json:"defaultModelNumber,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
- DefaultWarrantyDetails *string `json:"defaultWarrantyDetails,omitempty" validate:"omitempty,max=1000" extensions:"x-nullable"`
- DefaultTagIDs *[]uuid.UUID `json:"defaultTagIds,omitempty" extensions:"x-nullable"`
- Name string `json:"name" validate:"required,min=1,max=255"`
- Description string `json:"description" validate:"max=1000"`
- Notes string `json:"notes" validate:"max=1000"`
+ DefaultName *string `json:"defaultName,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
+ DefaultDescription *string `json:"defaultDescription,omitempty" validate:"omitempty,max=1000" extensions:"x-nullable"`
+ DefaultManufacturer *string `json:"defaultManufacturer,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
+ DefaultModelNumber *string `json:"defaultModelNumber,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
+ DefaultWarrantyDetails *string `json:"defaultWarrantyDetails,omitempty" validate:"omitempty,max=1000" extensions:"x-nullable"`
+ DefaultTagIDs *[]uuid.UUID `json:"defaultTagIds,omitempty" extensions:"x-nullable"`
+ Name string `json:"name" validate:"required,min=1,max=255"`
+ Description string `json:"description" validate:"max=1000"`
+ Notes string `json:"notes" validate:"max=1000"`
// Custom fields
Fields []TemplateField `json:"fields"`
// Default location and tags
@@ -68,15 +68,15 @@ type (
EntityTemplateUpdate struct {
// Default values for entities
DefaultQuantity *float64 `json:"defaultQuantity,omitempty" extensions:"x-nullable"`
- DefaultName *string `json:"defaultName,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
- DefaultDescription *string `json:"defaultDescription,omitempty" validate:"omitempty,max=1000" extensions:"x-nullable"`
- DefaultManufacturer *string `json:"defaultManufacturer,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
- DefaultModelNumber *string `json:"defaultModelNumber,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
- DefaultWarrantyDetails *string `json:"defaultWarrantyDetails,omitempty" validate:"omitempty,max=1000" extensions:"x-nullable"`
- DefaultTagIDs *[]uuid.UUID `json:"defaultTagIds,omitempty" extensions:"x-nullable"`
- Name string `json:"name" validate:"required,min=1,max=255"`
- Description string `json:"description" validate:"max=1000"`
- Notes string `json:"notes" validate:"max=1000"`
+ DefaultName *string `json:"defaultName,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
+ DefaultDescription *string `json:"defaultDescription,omitempty" validate:"omitempty,max=1000" extensions:"x-nullable"`
+ DefaultManufacturer *string `json:"defaultManufacturer,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
+ DefaultModelNumber *string `json:"defaultModelNumber,omitempty" validate:"omitempty,max=255" extensions:"x-nullable"`
+ DefaultWarrantyDetails *string `json:"defaultWarrantyDetails,omitempty" validate:"omitempty,max=1000" extensions:"x-nullable"`
+ DefaultTagIDs *[]uuid.UUID `json:"defaultTagIds,omitempty" extensions:"x-nullable"`
+ Name string `json:"name" validate:"required,min=1,max=255"`
+ Description string `json:"description" validate:"max=1000"`
+ Notes string `json:"notes" validate:"max=1000"`
// Custom fields
Fields []TemplateField `json:"fields"`
ID uuid.UUID `json:"id"`