golang print struct with key

https://play.golang.org/p/YMfpuluzef

判断结构体是否为空

打印带attribute(key) 的结构体

package main

import (
    "fmt"
)
type  Imp struct {
  Imp  int 
  Dev  string 
 
}

func main() {
   imp := Imp{ }
     //print struct with key
    fmt.Printf("%+v", imp )
    // struct is emputy 
    fmt.Println(imp ==( Imp{}) )
    fmt.Println("Hello, playground")    
}

 

posted on 2016-11-22 11:42  iokde.com  阅读(998)  评论(0编辑  收藏  举报

导航