本文整理汇总了Golang中github.com/jingweno/gotask/tasking.T.Logf方法的典型用法代码示例。如果您正苦于以下问题:Golang T.Logf方法的具体用法?Golang T.Logf怎么用?Golang T.Logf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jingweno/gotask/tasking.T
的用法示例。
在下文中一共展示了T.Logf方法的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: TaskDeploy
// NAME
// deploy - Deploy the application
//
// DESCRIPTION
// Build and deploy the application on the device via ant.
//
// OPTIONS
// --verbose, -v
// run in verbose mode
func TaskDeploy(t *tasking.T) {
deployAndroid(t)
if t.Failed() {
t.Fatalf("%-20s %s\n", status(t.Failed()), "Build and deploy the application on the device via ant.")
}
t.Logf("%-20s %s\n", status(t.Failed()), "Build and deploy the application on the device via ant.")
}
示例3: 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.")
}
示例4: TaskSpecgen
// NAME
// specgen - generates Go code from the UPnP specification files.
//
// DESCRIPTION
// The specification is available for download from:
//
// OPTIONS
// -s, --specs_dir=<spec directory>
// Path to the specification storage directory. This is used to find (and download if not present) the specification ZIP files. Defaults to 'specs'
// -o, --out_dir=<output directory>
// Path to the output directory. This is is where the DCP source files will be placed. Should normally correspond to the directory for github.com/huin/goupnp/dcps. Defaults to '../dcps'
// --nogofmt
// Disable passing the output through gofmt. Do this if debugging code output problems and needing to see the generated code prior to being passed through gofmt.
func TaskSpecgen(t *tasking.T) {
specsDir := fallbackStrValue("specs", t.Flags.String("specs_dir"), t.Flags.String("s"))
if err := os.MkdirAll(specsDir, os.ModePerm); err != nil {
t.Fatalf("Could not create specs-dir %q: %v\n", specsDir, err)
}
outDir := fallbackStrValue("../dcps", t.Flags.String("out_dir"), t.Flags.String("o"))
useGofmt := !t.Flags.Bool("nogofmt")
NEXT_DCP:
for _, d := range dcpMetadata {
specFilename := filepath.Join(specsDir, d.Name+".zip")
err := acquireFile(specFilename, d.XMLSpecURL)
if err != nil {
t.Logf("Could not acquire spec for %s, skipping: %v\n", d.Name, err)
continue NEXT_DCP
}
dcp := newDCP(d)
if err := dcp.processZipFile(specFilename); err != nil {
log.Printf("Error processing spec for %s in file %q: %v", d.Name, specFilename, err)
continue NEXT_DCP
}
for i, hack := range d.Hacks {
if err := hack(dcp); err != nil {
log.Printf("Error with Hack[%d] for %s: %v", i, d.Name, err)
continue NEXT_DCP
}
}
dcp.writePackage(outDir, useGofmt)
if err := dcp.writePackage(outDir, useGofmt); err != nil {
log.Printf("Error writing package %q: %v", dcp.Metadata.Name, err)
continue NEXT_DCP
}
}
}
示例5: TaskCrossCompile
// NAME
// cross-compile - cross-compiles gh for current platform.
//
// DESCRIPTION
// Cross-compiles gh for current platform. Build artifacts will be in target/VERSION
func TaskCrossCompile(t *tasking.T) {
t.Logf("Cross-compiling gh for %s...\n", runtime.GOOS)
t.Logf("GOPATH=%s\n", os.Getenv("GOPATH"))
err := t.Exec("goxc", "-wd=.", "-os="+runtime.GOOS, "-c="+runtime.GOOS)
if err != nil {
t.Fatalf("Can't cross-compile gh: %s\n", err)
}
}
示例6: TaskSayHello
// NAME
// say-hello - Say hello to current user
//
// DESCRIPTION
// Print out hello to current user
//
// OPTIONS
// --verbose, -v
// run in verbose mode
func TaskSayHello(t *tasking.T) {
user, _ := user.Current()
if t.Flags.Bool("v") || t.Flags.Bool("verbose") {
t.Logf("Hello %s, the time now is %s\n", user.Name, time.Now())
} else {
t.Logf("Hello %s\n", user.Name)
}
}
示例7: 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 err = os.Rename("test/src/_app", filepath.Join("test/src/", strings.ToLower(app.TestLibName))); 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")
}
示例8: 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) {
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.")
}
示例9: TaskTest
// NAME
// test - Run the tests
//
// DESCRIPTION
// Build and run the tests on the given platform returning output using logcat.
//
// OPTIONS
// --flags=<FLAGS>
// pass the given flags to the executable
// --verbose, -v
// run in verbose mode
func TaskTest(t *tasking.T) {
TaskBuild(t)
if f, ok := runFun[t.Args[0]]; ok {
f(t)
}
if t.Failed() {
t.Fatalf("%-20s %s\n", status(t.Failed()), "Run the example on the given platforms.")
}
t.Logf("%-20s %s\n", status(t.Failed()), "Run the example on the given platforms.")
}
示例10: TaskTest
// NAME
// test - Run black-box tests
//
// DESCRIPTION
// Build and run the application on the given platforms.
//
// OPTIONS
// --flags=<FLAGS>
// pass the flags to the executable
// --logcat=Mandala:* stdout:* stderr:* *:S
// show logcat output (android only)
// --verbose, -v
// run in verbose mode
func TaskTest(t *tasking.T) {
TaskBuild(t)
for _, platform := range t.Args {
runFun[platform](t)
}
if t.Failed() {
t.Fatalf("%-20s %s\n", status(t.Failed()), "Run the application on the given platforms.")
}
t.Logf("%-20s %s\n", status(t.Failed()), "Run the application on the given platforms.")
}
示例11: TaskRelease
// NAME
// release - Build the application in 'release mode'
//
// DESCRIPTION
// Build the application for Android in 'release mode'.
//
// OPTIONS
// --flags=<FLAGS>
// pass FLAGS to the compiler
// --verbose, -v
// run in verbose mode
func TaskRelease(t *tasking.T) {
// Build app in 'release mode'
buildAndroid(t, true)
// Sign and 'zipalign' app
signAndroid(t)
// Check task
if t.Failed() {
t.Fatalf("%-20s %s\n", status(t.Failed()), "Release the application for Android.")
}
t.Logf("%-20s %s\n", status(t.Failed()), "Release the application for Android.")
}
示例12: 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.")
}
示例13: TaskInstallDeps
// NAME
// install-deps - install dependencies with go get
//
// DESCRIPTION
// Install dependencies with go get.
func TaskInstallDeps(t *tasking.T) {
deps := []string{
"github.com/laher/goxc",
}
for _, dep := range deps {
t.Logf("Installing %s\n", dep)
err := t.Exec("go get", dep)
if err != nil {
t.Fatalf("Can't download dependency %s", err)
}
}
}
示例14: 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.")
}
示例15: TaskSayHello
// NAME
// say-hello - Say hello to current user
//
// DESCRIPTION
// Print out hello to current user
//
// OPTIONS
// -n, --name="NAME"
// say hello to an user with the given NAME
// -v, --verbose
// run in verbose mode
func TaskSayHello(t *tasking.T) {
username := t.Flags.String("name")
if username == "" {
user, _ := user.Current()
username = user.Name
}
if t.Flags.Bool("verbose") {
t.Logf("Hello %s, the time now is %s\n", username, time.Now())
} else {
t.Logf("Hello %s\n", username)
}
}