fix: Resolve CSS bundling in production and lint errors
- Fix golangci-lint errcheck errors by using t.Setenv() instead of os.Setenv() - Add CSS bundle build step to deploy workflow for production - Add graceful fallback to modular CSS if bundle doesn't exist - Remove unused os import from preferences_test.go
This commit is contained in:
@@ -3,7 +3,6 @@ package middleware
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -385,12 +384,8 @@ func TestIsProductionMode(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// Save original environment
|
||||
originalEnv := os.Getenv("GO_ENV")
|
||||
defer os.Setenv("GO_ENV", originalEnv)
|
||||
|
||||
// Set test environment
|
||||
os.Setenv("GO_ENV", tt.envValue)
|
||||
// t.Setenv automatically restores the original value after the test
|
||||
t.Setenv("GO_ENV", tt.envValue)
|
||||
|
||||
result := isProductionMode()
|
||||
|
||||
@@ -428,12 +423,8 @@ func TestSetPreferenceCookieSecureFlag(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// Save original environment
|
||||
originalEnv := os.Getenv("GO_ENV")
|
||||
defer os.Setenv("GO_ENV", originalEnv)
|
||||
|
||||
// Set test environment
|
||||
os.Setenv("GO_ENV", tt.envValue)
|
||||
// t.Setenv automatically restores the original value after the test
|
||||
t.Setenv("GO_ENV", tt.envValue)
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
SetPreferenceCookie(w, "test-cookie", "test-value")
|
||||
|
||||
Reference in New Issue
Block a user