Skip to content

Commit

Permalink
Bumped version
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Persson committed Sep 9, 2015
1 parent f5b6204 commit 64b9b6f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/github.com/mickep76/common/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package common

// Version
const Version = "0.6"
const Version = "0.7"
2 changes: 1 addition & 1 deletion src/github.com/mickep76/etcd-import/etcd-import.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func main() {
}

// Setup Etcd client.
if *node == "" {
if *node != "" {
conn = []string{fmt.Sprintf("http://%v:%v", *node, *port)}
}
client := etcd.NewClient(conn)
Expand Down
4 changes: 2 additions & 2 deletions vendor/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
"importpath": "github.com/mickep76/etcdmap",
"repository": "https://github.com/mickep76/etcdmap",
"revision": "3dc145c669a773963370d390afd50a89c36cfc97",
"revision": "87c4403f69d72d43abc584a638d78958ce22e3b4",
"branch": "master"
},
{
Expand All @@ -29,7 +29,7 @@
{
"importpath": "github.com/ugorji/go/codec",
"repository": "https://github.com/ugorji/go",
"revision": "5c83d75b24f35bd4b4a03bdfba76a2cbcce76e36",
"revision": "44024c561b3b217e190440d74b97dd254f8e52e8",
"branch": "master",
"path": "/codec"
},
Expand Down
15 changes: 15 additions & 0 deletions vendor/src/github.com/mickep76/etcdmap/etcdmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,22 @@ func Map(root *etcd.Node) map[string]interface{} {

// Create Etcd directory structure from a map, slice or struct.
func Create(client *etcd.Client, path string, val reflect.Value) error {
// fmt.Printf("# %s : %s : %s\n", path, val.Kind(), val.Type())

switch val.Kind() {
case reflect.Ptr:
orig := val.Elem()
if !orig.IsValid() {
return nil
}
if err := Create(client, path, orig); err != nil {
return err
}
case reflect.Interface:
orig := val.Elem()
if err := Create(client, path, orig); err != nil {
return err
}
case reflect.Struct:
for i := 0; i < val.NumField(); i++ {
t := val.Type().Field(i)
Expand Down
3 changes: 2 additions & 1 deletion vendor/src/github.com/ugorji/go/codec/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,8 @@ func NewEncoderBytes(out *[]byte, h Handle) *Encoder {
// The empty values (for omitempty option) are false, 0, any nil pointer
// or interface value, and any array, slice, map, or string of length zero.
//
// Anonymous fields are encoded inline if no struct tag is present.
// Anonymous fields are encoded inline if the struct tag is "effectively" blank
// i.e. it is not present or does not have any parameters specified.
// Else they are encoded as regular fields.
//
// Examples:
Expand Down
35 changes: 29 additions & 6 deletions vendor/src/github.com/ugorji/go/codec/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ type structFieldInfo struct {
toArray bool // if field is _struct, is the toArray set?
}

func (si *structFieldInfo) isZero() bool {
return si.encName == "" && len(si.is) == 0 && si.i == 0 && !si.omitEmpty && !si.toArray
}

// rv returns the field of the struct.
// If anonymous, it returns an Invalid
func (si *structFieldInfo) field(v reflect.Value, update bool) (rv2 reflect.Value) {
Expand Down Expand Up @@ -516,9 +520,9 @@ func (si *structFieldInfo) setToZeroValue(v reflect.Value) {
}

func parseStructFieldInfo(fname string, stag string) *structFieldInfo {
if fname == "" {
panic(noFieldNameToStructFieldInfoErr)
}
// if fname == "" {
// panic(noFieldNameToStructFieldInfoErr)
// }
si := structFieldInfo{
encName: fname,
}
Expand Down Expand Up @@ -723,8 +727,20 @@ func rgetTypeInfo(rt reflect.Type, indexstack []int, fnameToHastag map[string]bo
if r1, _ := utf8.DecodeRuneInString(f.Name); r1 == utf8.RuneError || !unicode.IsUpper(r1) {
continue
}
// if anonymous and there is no struct tag and its a struct (or pointer to struct), inline it.
if f.Anonymous && stag == "" {
var si *structFieldInfo
// if anonymous and there is no struct tag (or it's blank)
// and its a struct (or pointer to struct), inline it.
var doInline bool
if f.Anonymous {
doInline = stag == ""
if !doInline {
si = parseStructFieldInfo("", stag)
doInline = si.isZero()
// fmt.Printf(">>>> doInline for si.isZero: %s: %v\n", f.Name, doInline)
}
}

if doInline {
ft := f.Type
for ft.Kind() == reflect.Ptr {
ft = ft.Elem()
Expand All @@ -744,7 +760,14 @@ func rgetTypeInfo(rt reflect.Type, indexstack []int, fnameToHastag map[string]bo
if _, ok := fnameToHastag[f.Name]; ok {
continue
}
si := parseStructFieldInfo(f.Name, stag)
if f.Name == "" {
panic(noFieldNameToStructFieldInfoErr)
}
if si == nil {
si = parseStructFieldInfo(f.Name, stag)
} else if si.encName == "" {
si.encName = f.Name
}
// si.ikind = int(f.Type.Kind())
if len(indexstack) == 0 {
si.i = int16(j)
Expand Down

0 comments on commit 64b9b6f

Please sign in to comment.