@@ -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
}
@@ -668,8 +667,7 @@ func TestWasmExport(t *testing.T) {
668
667
builder := r .NewHostModuleBuilder ("tester" )
669
668
builder .NewFunctionBuilder ().WithFunc (callOutside ).Export ("callOutside" )
670
669
builder .NewFunctionBuilder ().WithFunc (callTestMain ).Export ("callTestMain" )
671
- _ , err = builder .Instantiate (ctx )
672
- if err != nil {
670
+ if _ , err = builder .Instantiate (ctx ); err != nil {
673
671
t .Fatal (err )
674
672
}
675
673
@@ -719,8 +717,7 @@ func TestWasmFuncOf(t *testing.T) {
719
717
cmd := exec .Command ("node" , "testdata/wasmfunc.js" , result .Binary , buildConfig .BuildMode ())
720
718
cmd .Stdout = output
721
719
cmd .Stderr = output
722
- err = cmd .Run ()
723
- if err != nil {
720
+ if err = cmd .Run (); err != nil {
724
721
t .Error ("failed to run node:" , err )
725
722
}
726
723
checkOutput (t , "testdata/wasmfunc.txt" , output .Bytes ())
@@ -757,8 +754,8 @@ func TestWasmExportJS(t *testing.T) {
757
754
cmd := exec .Command ("node" , "testdata/wasmexport.js" , result .Binary , buildConfig .BuildMode ())
758
755
cmd .Stdout = output
759
756
cmd .Stderr = output
760
- err = cmd . Run ()
761
- if err != nil {
757
+
758
+ if err = cmd . Run (); err != nil {
762
759
t .Error ("failed to run node:" , err )
763
760
}
764
761
checkOutput (t , "testdata/wasmexport.txt" , output .Bytes ())
@@ -979,8 +976,7 @@ func TestMain(m *testing.M) {
979
976
switch os .Args [1 ] {
980
977
case "clang" , "ld.lld" , "wasm-ld" :
981
978
// 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 {
984
980
// The tool should have printed an error message already.
985
981
// Don't print another error message here.
986
982
os .Exit (1 )
0 commit comments