本文整理汇总了Golang中fmt.Fprintln函数的典型用法代码示例。如果您正苦于以下问题:Golang Fprintln函数的具体用法?Golang Fprintln怎么用?Golang Fprintln使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Fprintln函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Create

// Create three folders for each id
// mnt, layers, and diff
func (a *Driver) Create(id, parent, mountLabel string, storageOpt map[string]string) error {

    if len(storageOpt) != 0 {
        return fmt.Errorf("--storage-opt is not supported for aufs")
    }

    if err := a.createDirsFor(id); err != nil {
        return err
    }
    // Write the layers metadata
    f, err := os.Create(path.Join(a.rootPath(), "layers", id))
    if err != nil {
        return err
    }
    defer f.Close()

    if parent != "" {
        ids, err := getParentIds(a.rootPath(), parent)
        if err != nil {
            return err
        }

        if _, err := fmt.Fprintln(f, parent); err != nil {
            return err
        }
        for _, i := range ids {
            if _, err := fmt.Fprintln(f, i); err != nil {
                return err
            }
        }
    }

    return nil
}

开发者ID:ungureanuvladvictor,项目名称:docker,代码行数:36,代码来源:aufs.go

示例2: drawFittedTableQLetters

//line fitted_type.got:17
func drawFittedTableQLetters(rSeq, qSeq alphabet.QLetters, index alphabet.Index, table []int, a [][]int) {
    tw := tabwriter.NewWriter(os.Stdout, 0, 0, 0, ' ', tabwriter.AlignRight|tabwriter.Debug)
    fmt.Printf("rSeq: %s\n", rSeq)
    fmt.Printf("qSeq: %s\n", qSeq)
    fmt.Fprint(tw, "\tqSeq\t")
    for _, l := range qSeq {
        fmt.Fprintf(tw, "%c\t", l)
    }
    fmt.Fprintln(tw)

    r, c := rSeq.Len()+1, qSeq.Len()+1
    fmt.Fprint(tw, "rSeq\t")
    for i := 0; i < r; i++ {
        if i != 0 {
            fmt.Fprintf(tw, "%c\t", rSeq[i-1].L)
        }

        for j := 0; j < c; j++ {
            p := pointerFittedQLetters(rSeq, qSeq, i, j, table, index, a, c)
            if p != "" {
                fmt.Fprintf(tw, "%s % 3v\t", p, table[i*c+j])
            } else {
                fmt.Fprintf(tw, "%v\t", table[i*c+j])
            }
        }
        fmt.Fprintln(tw)
    }
    tw.Flush()
}

开发者ID:krieg,项目名称:biogo,代码行数:30,代码来源:fitted_qletters.go

示例3: printColors

func printColors() {
    ansi.DisableColors(false)
    stdout := colorable.NewColorableStdout()

    bgColors := []string{
        "",
        ":black",
        ":red",
        ":green",
        ":yellow",
        ":blue",
        ":magenta",
        ":cyan",
        ":white",
    }

    keys := []string{}
    for fg := range ansi.Colors {
        _, err := strconv.Atoi(fg)
        if err != nil {
            keys = append(keys, fg)
        }
    }
    sort.Strings(keys)

    for _, fg := range keys {
        for _, bg := range bgColors {
            fmt.Fprintln(stdout, padColor(fg, []string{"" + bg, "+b" + bg, "+bh" + bg, "+u" + bg}))
            fmt.Fprintln(stdout, padColor(fg, []string{"+uh" + bg, "+B" + bg, "+Bb" + bg /* backgrounds */, "" + bg + "+h"}))
            fmt.Fprintln(stdout, padColor(fg, []string{"+b" + bg + "+h", "+bh" + bg + "+h", "+u" + bg + "+h", "+uh" + bg + "+h"}))
        }
    }
}

开发者ID:DaveBlooman,项目名称:slingshot,代码行数:33,代码来源:main.go

示例4: TestDisconnectEverythingFromSpecificSlot

func (s *SnapSuite) TestDisconnectEverythingFromSpecificSlot(c *C) {
    s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) {
        switch r.URL.Path {
        case "/v2/interfaces":
            c.Check(r.Method, Equals, "POST")
            c.Check(DecodedRequestBody(c, r), DeepEquals, map[string]interface{}{
                "action": "disconnect",
                "plugs": []interface{}{
                    map[string]interface{}{
                        "snap": "",
                        "plug": "",
                    },
                },
                "slots": []interface{}{
                    map[string]interface{}{
                        "snap": "consumer",
                        "slot": "slot",
                    },
                },
            })
            fmt.Fprintln(w, `{"type":"async", "status-code": 202, "change": "zzz"}`)
        case "/v2/changes/zzz":
            c.Check(r.Method, Equals, "GET")
            fmt.Fprintln(w, `{"type":"sync", "result":{"ready": true, "status": "Done"}}`)
        default:
            c.Fatalf("unexpected path %q", r.URL.Path)
        }
    })
    rest, err := Parser().ParseArgs([]string{"disconnect", "consumer:slot"})
    c.Assert(err, IsNil)
    c.Assert(rest, DeepEquals, []string{})
    c.Assert(s.Stdout(), Equals, "")
    c.Assert(s.Stderr(), Equals, "")
}

开发者ID:pedronis,项目名称:snappy,代码行数:34,代码来源:cmd_disconnect_test.go

示例5: printUsageErrorAndExit

func printUsageErrorAndExit(message string) {
    fmt.Fprintln(os.Stderr, "ERROR:", message)
    fmt.Fprintln(os.Stderr)
    fmt.Fprintln(os.Stderr, "Available command line options:")
    flag.PrintDefaults()
    os.Exit(64)
}

开发者ID:ChongFeng,项目名称:beats,代码行数:7,代码来源:kafka-console-producer.go

最后编辑: kuteng  文档更新时间: 2021-08-23 19:14   作者:kuteng