github.com/keysonzzz/kmg@v0.0.0-20151121023212-05317bfd7d39/encoding/kmgGoLiteral/kmgGoLiteral.go (about)

     1  package kmgGoLiteral
     2  
     3  import (
     4  	"fmt"
     5  	//"bytes"
     6  	//"reflect"
     7  )
     8  
     9  // 未完成,请不要调用.
    10  // TODO 完成它
    11  func MustMarshalToString(obj interface{}) (s string) {
    12  	return fmt.Sprintf("%#v", obj) //不可以使用 fmt.Sprintf("%#v",obj) 会导出私有变量.
    13  	//buf:=&bytes.Buffer{}
    14  
    15  }
    16  
    17  /*
    18  func mustMarshalReflectWithBuffer(v reflect.Value,buf *bytes.Buffer){
    19  	switch v.Kind() {
    20  	case reflect.String:
    21  
    22  	case reflect.Slice:
    23  	case reflect.Struct:
    24  	case reflect.Ptr:
    25  	default:
    26  		panic(fmt.Errorf("[mustMarshalReflectWithBuffer] can not handle reflect kind %s",v.Kind()))
    27  	}
    28  }
    29  */