@@ -894,7 +894,7 @@ func TestMaintenanceModeWithStaticFiles(t *testing.T) {
894894 if err != nil {
895895 t .Fatalf ("Failed to create temp dir: %v" , err )
896896 }
897- defer os .RemoveAll (tempDir )
897+ defer func () { _ = os .RemoveAll (tempDir ) }( )
898898
899899 // Create a static HTML file
900900 staticHTML := `<!DOCTYPE html>
@@ -1028,7 +1028,7 @@ func TestAssetServingIntegration(t *testing.T) {
10281028 if err != nil {
10291029 t .Fatalf ("Failed to create temp dir: %v" , err )
10301030 }
1031- defer os .RemoveAll (tempDir )
1031+ defer func () { _ = os .RemoveAll (tempDir ) }( )
10321032
10331033 // Create assets directory and test files
10341034 assetsDir := filepath .Join (tempDir , "assets" )
@@ -1139,11 +1139,12 @@ func TestAssetServingIntegration(t *testing.T) {
11391139 }
11401140
11411141 // Verify actual content matches expected
1142- if assetTest .expectedExt == ".js" {
1142+ switch assetTest .expectedExt {
1143+ case ".js" :
11431144 if ! strings .Contains (body , "Live scores controller loaded" ) {
11441145 t .Errorf ("JS file content not found in response for %s" , assetTest .path )
11451146 }
1146- } else if assetTest . expectedExt == ".css" {
1147+ case ".css" :
11471148 if ! strings .Contains (body , ".live-scores" ) {
11481149 t .Errorf ("CSS content not found in response for %s" , assetTest .path )
11491150 }
@@ -1161,7 +1162,7 @@ func TestAssetServingIntegrationErrorCases(t *testing.T) {
11611162 if err != nil {
11621163 t .Fatalf ("Failed to create temp dir: %v" , err )
11631164 }
1164- defer os .RemoveAll (tempDir )
1165+ defer func () { _ = os .RemoveAll (tempDir ) }( )
11651166
11661167 cfg := & config.Config {
11671168 LocationConfigMutex : sync.RWMutex {},
@@ -1197,7 +1198,7 @@ func TestAssetServingRootPathVariations(t *testing.T) {
11971198 if err != nil {
11981199 t .Fatalf ("Failed to create temp dir: %v" , err )
11991200 }
1200- defer os .RemoveAll (tempDir )
1201+ defer func () { _ = os .RemoveAll (tempDir ) }( )
12011202
12021203 // Create test asset
12031204 assetsDir := filepath .Join (tempDir , "assets" )
@@ -1452,8 +1453,7 @@ func TestHandler_HandleRewritesFlyReplay(t *testing.T) {
14521453 t .Run (tt .name , func (t * testing.T ) {
14531454 // Set up environment
14541455 if tt .flyAppName != "" {
1455- os .Setenv ("FLY_APP_NAME" , tt .flyAppName )
1456- defer os .Unsetenv ("FLY_APP_NAME" )
1456+ t .Setenv ("FLY_APP_NAME" , tt .flyAppName )
14571457 }
14581458
14591459 // Create handler with test configuration
@@ -1544,8 +1544,7 @@ func TestHandler_HandleRewritesFlyReplayWithMethods(t *testing.T) {
15441544}
15451545
15461546func TestHandler_HandleRewritesFlyReplayLargeRequest (t * testing.T ) {
1547- os .Setenv ("FLY_APP_NAME" , "testapp" )
1548- defer os .Unsetenv ("FLY_APP_NAME" )
1547+ t .Setenv ("FLY_APP_NAME" , "testapp" )
15491548
15501549 cfg := & config.Config {}
15511550 cfg .Server .Listen = "3000"
0 commit comments