@@ -340,8 +340,7 @@ func emuCheck(t *testing.T, options compileopts.Options) {
340340 }
341341 if spec .Emulator != "" {
342342 emulatorCommand := strings .SplitN (spec .Emulator , " " , 2 )[0 ]
343- _ , err := exec .LookPath (emulatorCommand )
344- if err != nil {
343+ if _ , err := exec .LookPath (emulatorCommand ); err != nil {
345344 if errors .Is (err , exec .ErrNotFound ) {
346345 t .Skipf ("emulator not installed: %q" , emulatorCommand )
347346 }
@@ -668,8 +667,7 @@ func TestWasmExport(t *testing.T) {
668667 builder := r .NewHostModuleBuilder ("tester" )
669668 builder .NewFunctionBuilder ().WithFunc (callOutside ).Export ("callOutside" )
670669 builder .NewFunctionBuilder ().WithFunc (callTestMain ).Export ("callTestMain" )
671- _ , err = builder .Instantiate (ctx )
672- if err != nil {
670+ if _ , err = builder .Instantiate (ctx ); err != nil {
673671 t .Fatal (err )
674672 }
675673
@@ -719,8 +717,7 @@ func TestWasmFuncOf(t *testing.T) {
719717 cmd := exec .Command ("node" , "testdata/wasmfunc.js" , result .Binary , buildConfig .BuildMode ())
720718 cmd .Stdout = output
721719 cmd .Stderr = output
722- err = cmd .Run ()
723- if err != nil {
720+ if err = cmd .Run (); err != nil {
724721 t .Error ("failed to run node:" , err )
725722 }
726723 checkOutput (t , "testdata/wasmfunc.txt" , output .Bytes ())
@@ -757,8 +754,8 @@ func TestWasmExportJS(t *testing.T) {
757754 cmd := exec .Command ("node" , "testdata/wasmexport.js" , result .Binary , buildConfig .BuildMode ())
758755 cmd .Stdout = output
759756 cmd .Stderr = output
760- err = cmd . Run ()
761- if err != nil {
757+
758+ if err = cmd . Run (); err != nil {
762759 t .Error ("failed to run node:" , err )
763760 }
764761 checkOutput (t , "testdata/wasmexport.txt" , output .Bytes ())
@@ -979,8 +976,7 @@ func TestMain(m *testing.M) {
979976 switch os .Args [1 ] {
980977 case "clang" , "ld.lld" , "wasm-ld" :
981978 // Invoke a specific tool.
982- err := builder .RunTool (os .Args [1 ], os .Args [2 :]... )
983- if err != nil {
979+ if err := builder .RunTool (os .Args [1 ], os .Args [2 :]... ); err != nil {
984980 // The tool should have printed an error message already.
985981 // Don't print another error message here.
986982 os .Exit (1 )
0 commit comments