@@ -37,7 +37,7 @@ func TestLoadConfigDefaults(t *testing.T) {
3737 require .NoError (t , err )
3838 require .NoError (t , os .Chdir (tmpDir ))
3939 t .Cleanup (func () {
40- os .Chdir (oldWd )
40+ _ = os .Chdir (oldWd )
4141 })
4242
4343 config , err := LoadConfig ("" )
@@ -102,7 +102,7 @@ func TestLoadConfigFromJSON(t *testing.T) {
102102 require .NoError (t , err )
103103 require .NoError (t , os .Chdir (tmpDir ))
104104 t .Cleanup (func () {
105- os .Chdir (oldWd )
105+ _ = os .Chdir (oldWd )
106106 })
107107
108108 config , err := LoadConfig ("" )
@@ -166,7 +166,7 @@ schemas:
166166 require .NoError (t , err )
167167 require .NoError (t , os .Chdir (tmpDir ))
168168 t .Cleanup (func () {
169- os .Chdir (oldWd )
169+ _ = os .Chdir (oldWd )
170170 })
171171
172172 config , err := LoadConfig ("" )
@@ -210,7 +210,7 @@ output: report.json
210210 require .NoError (t , err )
211211 require .NoError (t , os .Chdir (tmpDir ))
212212 t .Cleanup (func () {
213- os .Chdir (oldWd )
213+ _ = os .Chdir (oldWd )
214214 })
215215
216216 config , err := LoadConfig ("" )
@@ -238,7 +238,7 @@ func TestLoadConfigRootPathOverride(t *testing.T) {
238238 require .NoError (t , err )
239239 require .NoError (t , os .Chdir (tmpDir ))
240240 t .Cleanup (func () {
241- os .Chdir (oldWd )
241+ _ = os .Chdir (oldWd )
242242 })
243243
244244 // Load with override
@@ -274,7 +274,7 @@ func TestLoadConfigEnvironmentVariables(t *testing.T) {
274274 require .NoError (t , err )
275275 require .NoError (t , os .Chdir (tmpDir ))
276276 t .Cleanup (func () {
277- os .Chdir (oldWd )
277+ _ = os .Chdir (oldWd )
278278 })
279279
280280 config , err := LoadConfig ("" )
@@ -298,14 +298,14 @@ func TestLoadConfigConfigFilePriority(t *testing.T) {
298298 // Create multiple config files
299299 jsonConfig := map [string ]interface {}{"root" : "/json/root" }
300300 jsonData , _ := json .MarshalIndent (jsonConfig , "" , " " )
301- os .WriteFile (filepath .Join (tmpDir , ".cclintrc.json" ), jsonData , 0644 )
301+ _ = os .WriteFile (filepath .Join (tmpDir , ".cclintrc.json" ), jsonData , 0644 )
302302
303303 yamlContent := "root: /yaml/root\n "
304- os .WriteFile (filepath .Join (tmpDir , ".cclintrc.yaml" ), []byte (yamlContent ), 0644 )
304+ _ = os .WriteFile (filepath .Join (tmpDir , ".cclintrc.yaml" ), []byte (yamlContent ), 0644 )
305305
306306 oldWd , _ := os .Getwd ()
307- os .Chdir (tmpDir )
308- defer os .Chdir (oldWd )
307+ _ = os .Chdir (tmpDir )
308+ defer func () { _ = os .Chdir (oldWd ) }( )
309309
310310 config , err := LoadConfig ("" )
311311 require .NoError (t , err )
@@ -500,7 +500,7 @@ func TestSaveConfigInvalidPath(t *testing.T) {
500500 // Try to save to an invalid path (file as directory)
501501 tmpDir := setupTestDir (t )
502502 filePath := filepath .Join (tmpDir , "file" )
503- os .WriteFile (filePath , []byte ("test" ), 0644 )
503+ _ = os .WriteFile (filePath , []byte ("test" ), 0644 )
504504
505505 invalidPath := filepath .Join (filePath , "config.json" )
506506 err := SaveConfig (config , invalidPath )
@@ -518,8 +518,8 @@ func TestLoadConfigUnmarshalError(t *testing.T) {
518518 require .NoError (t , os .WriteFile (configPath , []byte (invalidJSON ), 0644 ))
519519
520520 oldWd , _ := os .Getwd ()
521- os .Chdir (tmpDir )
522- defer os .Chdir (oldWd )
521+ _ = os .Chdir (tmpDir )
522+ defer func () { _ = os .Chdir (oldWd ) }( )
523523
524524 config , err := LoadConfig ("" )
525525 assert .Error (t , err )
@@ -539,11 +539,11 @@ func TestLoadConfigValidationError(t *testing.T) {
539539
540540 configPath := filepath .Join (tmpDir , ".cclintrc.json" )
541541 jsonData , _ := json .MarshalIndent (configData , "" , " " )
542- os .WriteFile (configPath , jsonData , 0644 )
542+ _ = os .WriteFile (configPath , jsonData , 0644 )
543543
544544 oldWd , _ := os .Getwd ()
545- os .Chdir (tmpDir )
546- defer os .Chdir (oldWd )
545+ _ = os .Chdir (tmpDir )
546+ defer func () { _ = os .Chdir (oldWd ) }( )
547547
548548 config , err := LoadConfig ("" )
549549 assert .Error (t , err )
@@ -637,11 +637,11 @@ func TestLoadConfigWithEmptyExclude(t *testing.T) {
637637
638638 configPath := filepath .Join (tmpDir , ".cclintrc.json" )
639639 jsonData , _ := json .MarshalIndent (configData , "" , " " )
640- os .WriteFile (configPath , jsonData , 0644 )
640+ _ = os .WriteFile (configPath , jsonData , 0644 )
641641
642642 oldWd , _ := os .Getwd ()
643- os .Chdir (tmpDir )
644- defer os .Chdir (oldWd )
643+ _ = os .Chdir (tmpDir )
644+ defer func () { _ = os .Chdir (oldWd ) }( )
645645
646646 config , err := LoadConfig ("" )
647647 require .NoError (t , err )
@@ -662,11 +662,11 @@ func TestLoadConfigWithNullExtensions(t *testing.T) {
662662
663663 configPath := filepath .Join (tmpDir , ".cclintrc.json" )
664664 jsonData , _ := json .MarshalIndent (configData , "" , " " )
665- os .WriteFile (configPath , jsonData , 0644 )
665+ _ = os .WriteFile (configPath , jsonData , 0644 )
666666
667667 oldWd , _ := os .Getwd ()
668- os .Chdir (tmpDir )
669- defer os .Chdir (oldWd )
668+ _ = os .Chdir (tmpDir )
669+ defer func () { _ = os .Chdir (oldWd ) }( )
670670
671671 config , err := LoadConfig ("" )
672672 require .NoError (t , err )
@@ -685,11 +685,11 @@ func TestLoadConfigEmptyRootPath(t *testing.T) {
685685
686686 configPath := filepath .Join (tmpDir , ".cclintrc.json" )
687687 jsonData , _ := json .MarshalIndent (configData , "" , " " )
688- os .WriteFile (configPath , jsonData , 0644 )
688+ _ = os .WriteFile (configPath , jsonData , 0644 )
689689
690690 oldWd , _ := os .Getwd ()
691- os .Chdir (tmpDir )
692- defer os .Chdir (oldWd )
691+ _ = os .Chdir (tmpDir )
692+ defer func () { _ = os .Chdir (oldWd ) }( )
693693
694694 // Pass empty string for rootPath
695695 config , err := LoadConfig ("" )
@@ -808,13 +808,13 @@ func TestLoadConfigNoConfigFiles(t *testing.T) {
808808 tmpDir := setupTestDir (t )
809809
810810 // Ensure no config files exist
811- os .Remove (filepath .Join (tmpDir , ".cclintrc.json" ))
812- os .Remove (filepath .Join (tmpDir , ".cclintrc.yaml" ))
813- os .Remove (filepath .Join (tmpDir , ".cclintrc.yml" ))
811+ _ = os .Remove (filepath .Join (tmpDir , ".cclintrc.json" ))
812+ _ = os .Remove (filepath .Join (tmpDir , ".cclintrc.yaml" ))
813+ _ = os .Remove (filepath .Join (tmpDir , ".cclintrc.yml" ))
814814
815815 oldWd , _ := os .Getwd ()
816- os .Chdir (tmpDir )
817- defer os .Chdir (oldWd )
816+ _ = os .Chdir (tmpDir )
817+ defer func () { _ = os .Chdir (oldWd ) }( )
818818
819819 // Should succeed with defaults
820820 config , err := LoadConfig ("" )
@@ -838,11 +838,11 @@ func TestLoadConfigPartialConfig(t *testing.T) {
838838
839839 configPath := filepath .Join (tmpDir , ".cclintrc.json" )
840840 jsonData , _ := json .MarshalIndent (configData , "" , " " )
841- os .WriteFile (configPath , jsonData , 0644 )
841+ _ = os .WriteFile (configPath , jsonData , 0644 )
842842
843843 oldWd , _ := os .Getwd ()
844- os .Chdir (tmpDir )
845- defer os .Chdir (oldWd )
844+ _ = os .Chdir (tmpDir )
845+ defer func () { _ = os .Chdir (oldWd ) }( )
846846
847847 config , err := LoadConfig ("" )
848848 require .NoError (t , err )
0 commit comments