@@ -340,8 +340,7 @@ func emuCheck(t *testing.T, options compileopts.Options) {
340
340
}
341
341
if spec .Emulator != "" {
342
342
emulatorCommand := strings .SplitN (spec .Emulator , " " , 2 )[0 ]
343
- _ , err := exec .LookPath (emulatorCommand )
344
- if err != nil {
343
+ if _ , err := exec .LookPath (emulatorCommand ); err != nil {
345
344
if errors .Is (err , exec .ErrNotFound ) {
346
345
t .Skipf ("emulator not installed: %q" , emulatorCommand )
347
346
}
@@ -685,8 +684,7 @@ func TestWasmExport(t *testing.T) {
685
684
builder := r .NewHostModuleBuilder ("tester" )
686
685
builder .NewFunctionBuilder ().WithFunc (callOutside ).Export ("callOutside" )
687
686
builder .NewFunctionBuilder ().WithFunc (callTestMain ).Export ("callTestMain" )
688
- _ , err = builder .Instantiate (ctx )
689
- if err != nil {
687
+ if _ , err = builder .Instantiate (ctx ); err != nil {
690
688
t .Fatal (err )
691
689
}
692
690
@@ -743,8 +741,7 @@ func TestWasmFuncOf(t *testing.T) {
743
741
cmd := exec .Command ("node" , "testdata/wasmfunc.js" , result .Binary , buildConfig .BuildMode ())
744
742
cmd .Stdout = output
745
743
cmd .Stderr = output
746
- err = cmd .Run ()
747
- if err != nil {
744
+ if err = cmd .Run (); err != nil {
748
745
t .Error ("failed to run node:" , err )
749
746
}
750
747
checkOutput (t , "testdata/wasmfunc.txt" , output .Bytes ())
@@ -784,8 +781,8 @@ func TestWasmExportJS(t *testing.T) {
784
781
cmd := exec .Command ("node" , "testdata/wasmexport.js" , result .Binary , buildConfig .BuildMode ())
785
782
cmd .Stdout = output
786
783
cmd .Stderr = output
787
- err = cmd . Run ()
788
- if err != nil {
784
+
785
+ if err = cmd . Run (); err != nil {
789
786
t .Error ("failed to run node:" , err )
790
787
}
791
788
checkOutput (t , "testdata/wasmexport.txt" , output .Bytes ())
@@ -1050,8 +1047,7 @@ func TestMain(m *testing.M) {
1050
1047
switch os .Args [1 ] {
1051
1048
case "clang" , "ld.lld" , "wasm-ld" :
1052
1049
// Invoke a specific tool.
1053
- err := builder .RunTool (os .Args [1 ], os .Args [2 :]... )
1054
- if err != nil {
1050
+ if err := builder .RunTool (os .Args [1 ], os .Args [2 :]... ); err != nil {
1055
1051
// The tool should have printed an error message already.
1056
1052
// Don't print another error message here.
1057
1053
os .Exit (1 )
0 commit comments