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")    
}
原文地址:https://www.cnblogs.com/lavin/p/6088611.html