From 54c24c1227761eeac7121971cd392c49a176f05b Mon Sep 17 00:00:00 2001 From: Matt Jibson Date: Tue, 19 May 2015 18:24:23 -0400 Subject: [PATCH] Use correct name during decode with omit options --- decode_test.go | 2 +- type_fields.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/decode_test.go b/decode_test.go index 3805931f..23843623 100644 --- a/decode_test.go +++ b/decode_test.go @@ -553,7 +553,7 @@ ip = "10.0.0.2" } type server struct { - IP string `toml:"ip"` + IP string `toml:"ip,omitempty"` Config serverConfig `toml:"config"` } diff --git a/type_fields.go b/type_fields.go index 7592f87a..158b1fa2 100644 --- a/type_fields.go +++ b/type_fields.go @@ -95,7 +95,7 @@ func typeFields(t reflect.Type) []field { if sf.PkgPath != "" { // unexported continue } - name := sf.Tag.Get("toml") + name, _ := getOptions(sf.Tag.Get("toml")) if name == "-" { continue }