golang

作者: 已不再更新 | 来源:发表于2018-05-20 00:16 被阅读9次

    打包工具

    https://blog.bluerain.io/p/Golang-Glide.html

    import

    import (
        "database/sql"
        _ "github.com/lib/pq" // 只引入, 不运行 init 函数
    )
    

    Printf

    %d        十进制
    %x %o %b  十六进制 八进制 二进制
    %f %g %e  浮点数
    %t        布尔类型
    %c        字符(unicode码点)
    %s        字符串
    %q        带引号的字符
    %v        内置格式的任何类型
    %T        任何值的类型( 代替 reflect.TypeOf(x) )
    %%        %本身(转义符)
    
    fmt.Printf("|%-6s|%-6s|\n", "foo", "b")
    s := fmt.Sprintf("a %s", "string")
    fmt.Println(s)
    // Printf通过 os.Stdout输出格式化的字符串,Sprintf格式化并返回一个字符串而不带任何输出
    
    fmt.Fprintf(os.Stderr, "an %s\n", "error")
    //使用 Fprintf 来格式化并输出到 io.Writers而不是 os.Stdout
    

    Reflect

    https://my.oschina.net/solate/blog/715681
    http://www.cnblogs.com/coder2012/p/4881854.html

    相关文章

      网友评论

          本文标题:golang

          本文链接:https://www.haomeiwen.com/subject/qlkzdftx.html