本文整理汇总了Golang中github.com/jingweno/gotask/tasking.T.Error方法的典型用法代码示例。如果您正苦于以下问题:Golang T.Error方法的具体用法?Golang T.Error怎么用?Golang T.Error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jingweno/gotask/tasking.T
的用法示例。
在下文中一共展示了T.Error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TaskClean
// NAME
// clean - Clean all generated files
//
// DESCRIPTION
// Clean all generated files and paths.
//
// OPTIONS
// --backup, -b
// clean all backup files (*~, #*)
// --verbose, -v
// run in verbose mode
func TaskClean(t *tasking.T) {
var paths []string
paths = append(
paths,
ARMBinaryPath,
"pkg",
filepath.Join("bin", ProjectName),
filepath.Join(AndroidPath, "bin"),
filepath.Join(AndroidPath, "gen"),
filepath.Join(AndroidPath, "libs"),
filepath.Join(AndroidPath, "obj"),
)
// Actually remove files using rm
for _, path := range paths {
err := rm_rf(t, path)
if err != nil {
t.Error(err)
}
}
if t.Flags.Bool("backup") {
err := t.Exec(`sh -c`, `"find ./ -name '*~' -print0 | xargs -0 rm -f"`)
if err != nil {
t.Error(err)
}
}
if t.Failed() {
t.Fatalf("%-20s %s\n", status(t.Failed()), "Clean all generated files and paths.")
}
t.Logf("%-20s %s\n", status(t.Failed()), "Clean all generated files and paths.")
}
示例2: TaskClean
// NAME
// clean - Clean all generated files
//
// DESCRIPTION
// Clean all generated files and paths.
//
func TaskClean(t *tasking.T) {
var paths []string
paths = append(
paths,
ARMBinaryPath,
"pkg",
filepath.Join("bin"),
filepath.Join(AndroidPath, "bin"),
filepath.Join(AndroidPath, "gen"),
filepath.Join(AndroidPath, "libs"),
filepath.Join(AndroidPath, "obj"),
)
// Actually remove files using rm
for _, path := range paths {
err := rm_rf(t, path)
if err != nil {
t.Error(err)
}
}
if t.Failed() {
t.Fatalf("%-20s %s\n", status(t.Failed()), "Clean all generated files and paths.")
}
t.Logf("%-20s %s\n", status(t.Failed()), "Clean all generated files and paths.")
}
示例3: deployAndroid
func deployAndroid(t *tasking.T) {
buildAndroid(t)
err := t.Exec("ant -f android/build.xml clean debug")
if err != nil {
t.Error(err)
}
uploadAndroid(t)
}
示例4: runXorg
func runXorg(t *tasking.T, flags string) {
err := t.Exec(
filepath.Join("bin", LibName),
flags,
)
if err != nil {
t.Error(err)
}
}
示例5: runXorg
func runXorg(t *tasking.T) {
err := t.Exec(
filepath.Join("bin", LibName),
t.Flags.String("flags"),
)
if err != nil {
t.Error(err)
}
}
示例6: runXorg
func runXorg(t *tasking.T) {
buildXorg(t)
err := t.Exec(
filepath.Join("bin", ProjectName),
t.Flags.String("flags"),
)
if err != nil {
t.Error(err)
}
}
示例7: buildXorg
func buildXorg(t *tasking.T) {
err := t.Exec(
`sh -c "`,
"GOPATH=`pwd`:$GOPATH",
`go get`, t.Flags.String("flags"),
LibName, `"`,
)
if err != nil {
t.Error(err)
}
}
示例8: buildXorg
func buildXorg(t *tasking.T) {
err := t.Exec(
`sh -c "`,
"GOPATH=`pwd`:$GOPATH",
`go install`, t.Flags.String("buildflags"),
ProjectName, `"`,
)
if err != nil {
t.Error(err)
}
}
示例9: TaskBuild
// NAME
// build - Build the tests
//
// DESCRIPTION
// Build the tests for the given platforms (xorg/android).
//
// OPTIONS
// --buildflags=
// pass the given flags to the compiler
// --verbose, -v
// run in verbose mode
func TaskBuild(t *tasking.T) {
if len(t.Args) == 0 {
t.Error("At least a platform name must be specified!")
}
if f, ok := buildFun[t.Args[0]]; ok {
f(t)
}
if t.Failed() {
t.Fatalf("%-20s %s\n", status(t.Failed()), "Build the tests for the given platforms.")
}
t.Logf("%-20s %s\n", status(t.Failed()), "Build the tests for the given platforms.")
}
示例10: TaskBuild
// NAME
// build - Build the application
//
// DESCRIPTION
// Build the application for the given platforms.
//
// OPTIONS
// --flags=<FLAGS>
// pass FLAGS to the compiler
// --verbose, -v
// run in verbose mode
func TaskBuild(t *tasking.T) {
if len(t.Args) < 1 {
t.Error("You must specify a build platform!")
} else {
for _, platform := range t.Args {
buildFun[platform](t)
}
}
if t.Failed() {
t.Fatalf("%-20s %s\n", status(t.Failed()), "Build the application for the given platforms.")
}
t.Logf("%-20s %s\n", status(t.Failed()), "Build the application for the given platforms.")
}
示例11: TaskInit
// NAME
// init - Initialize a new Mandala application
//
// DESCRIPTION
// Initialize a new Mandala application based on application.json
//
func TaskInit(t *tasking.T) {
var err error
// read application.json
app, err := readJSON(jsonPath)
if err != nil {
t.Error(err)
}
var paths []string
// execute templates and copy the files
err = filepath.Walk(
"templates",
func(path string, info os.FileInfo, err error) error {
if !info.IsDir() {
paths = append(paths, path)
}
return nil
},
)
if err != nil {
t.Error(err)
}
for _, path := range paths {
var dstPath string
splits := strings.Split(path, "/")
if len(splits) > 1 {
dstPath = filepath.Join(splits[1:]...)
} else {
dstPath = filepath.Base(path)
}
if err = copyFile(path, dstPath, app); err != nil {
t.Error(err)
}
}
// Rename paths accordly to app.LibName
if err = os.Rename("_task.go", strings.ToLower(app.LibName)+"_task.go"); err != nil {
t.Error(err)
}
if err = os.Rename("src/_app", filepath.Join("src", strings.ToLower(app.LibName))); err != nil {
t.Error(err)
}
if t.Failed() {
t.Fatalf("%-20s %s\n", status(t.Failed()), "Initialize a new Mandala application")
}
t.Logf("%-20s %s\n", status(t.Failed()), "Initialize a new Mandala application")
}
示例12: TaskTestSQLite
// NAME
// test-sqlite - check data generated from ModSQL into a SQLite database
func TaskTestSQLite(t *tasking.T) {
filename := dbname + ".db"
defer func() {
if err := os.Remove(filename); err != nil {
t.Error(err)
}
}()
db, err := sql.Open("sqlite3", filename)
if err != nil {
t.Fatal(err)
}
if err = modsql.Load(db, filepath.Join("data", "sql", "sqlite_init.sql")); err != nil {
t.Error(err)
} else {
if err = modsql.Load(db, filepath.Join("data", "sql", "sqlite_test.sql")); err != nil {
t.Error(err)
}
testInsert(t, db, modsql.SQLite)
if err = modsql.Load(db, filepath.Join("data", "sql", "sqlite_drop.sql")); err != nil {
t.Error(err)
}
}
db.Close()
if !t.Failed() {
t.Log("--- PASS")
}
}
示例13: buildXorg
func buildXorg(t *tasking.T, buildAll bool) {
allFlagString := ""
if buildAll {
allFlagString = "-a"
}
err := t.Exec(
`sh -c "`,
"GOPATH=`pwd`:$GOPATH",
`go install`, allFlagString,
LibName, `"`,
)
if err != nil {
t.Error(err)
}
}
示例14: runAndroid
func runAndroid(t *tasking.T) {
buildAndroid(t)
deployAndroid(t)
err := t.Exec(
fmt.Sprintf(
"adb shell am start -a android.intent.action.MAIN -n net.mandala.%s/android.app.NativeActivity",
ProjectName,
))
if err != nil {
t.Error(err)
}
err = t.Exec("adb shell logcat", "Mandala:* stdout:* stderr:* *:S")
if err != nil {
t.Error(err)
}
}
示例15: buildAndroid
func buildAndroid(t *tasking.T, buildMode ...bool) {
// Build mode for ant:
// buildMode not specified or false => ant debug
// buildMode true => ant release
antBuildParam := "debug"
if len(buildMode) > 0 && buildMode[0] == true {
antBuildParam = "release"
}
// Generate AdmobActivity using the UnitId in admob.json
err := generateAdmobActivity()
if err != nil {
t.Error(err)
}
os.MkdirAll("android/libs/armeabi-v7a", 0777)
os.MkdirAll("android/obj/local/armeabi-v7a", 0777)
err = t.Exec(`sh -c "`,
`CC="$NDK_ROOT/bin/arm-linux-androideabi-gcc"`,
"GOPATH=`pwd`:$GOPATH",
`GOROOT=""`,
"GOOS=linux",
"GOARCH=arm",
"GOARM=7",
"CGO_ENABLED=1",
"$GOANDROID/go get", t.Flags.String("flags"),
"$GOFLAGS",
`-ldflags=\"-android -shared -extld $NDK_ROOT/bin/arm-linux-androideabi-gcc -extldflags '-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16'\"`,
"-tags android",
LibName, `"`,
)
if err != nil {
t.Error(err)
}
for _, path := range SharedLibraryPaths {
err := t.Exec(
"cp",
filepath.Join(ARMBinaryPath, LibName),
filepath.Join(path, "lib"+LibName+".so"),
)
if err != nil {
t.Error(err)
}
}
if err == nil {
err = t.Exec("ant -f android/build.xml clean", antBuildParam)
if err != nil {
t.Error(err)
}
}
}