github.com/goplusjs/gopherjs@v1.2.6-0.20211206034512-f187917453b8/testpkg.go (about) 1 // +build !go1.16 2 3 package main 4 5 import ( 6 "go/build" 7 8 gbuild "github.com/goplusjs/gopherjs/build" 9 ) 10 11 func makeTestPkg(pkg *gbuild.PackageData, xtest bool) *gbuild.PackageData { 12 if xtest { 13 return &gbuild.PackageData{ 14 Package: &build.Package{ 15 Name: pkg.Name + "_test", 16 ImportPath: pkg.ImportPath + "_test", 17 Dir: pkg.Dir, 18 GoFiles: pkg.XTestGoFiles, 19 Imports: pkg.XTestImports, 20 }, 21 IsTest: true, 22 } 23 } else { 24 return &gbuild.PackageData{ 25 Package: &build.Package{ 26 Name: pkg.Name, 27 ImportPath: pkg.ImportPath, 28 Dir: pkg.Dir, 29 GoFiles: append(pkg.GoFiles, pkg.TestGoFiles...), 30 Imports: append(pkg.Imports, pkg.TestImports...), 31 }, 32 IsTest: true, 33 JSFiles: pkg.JSFiles, 34 } 35 } 36 }