Skip to content

Commit 0784bcd

Browse files
committed
go fmt
1 parent daaca9c commit 0784bcd

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

simpleyaml.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ func (y *Yaml) IsArray() bool {
8989
}
9090

9191
// return the size of array
92-
func (y *Yaml)GetArraySize() (int, error ) {
92+
func (y *Yaml) GetArraySize() (int, error) {
9393
a, err := y.Array()
9494
if err != nil {
9595
return 0, err
9696
}
97-
return len( a ), nil
97+
return len(a), nil
9898
}
9999

100100
// GetIndex returns a pointer to a new `Yaml` object.
@@ -152,22 +152,22 @@ func (y *Yaml) Map() (map[interface{}]interface{}, error) {
152152
}
153153

154154
// Check if it is a map
155-
func (y *Yaml)IsMap() bool {
155+
func (y *Yaml) IsMap() bool {
156156
_, err := y.Map()
157157
return err == nil
158158
}
159159

160160
// Get all the keys of the map
161-
func (y *Yaml)GetMapKeys() ([]string,error) {
161+
func (y *Yaml) GetMapKeys() ([]string, error) {
162162
m, err := y.Map()
163163

164164
if err != nil {
165165
return nil, err
166166
}
167-
keys := make([]string, 0 )
167+
keys := make([]string, 0)
168168
for k, _ := range m {
169-
if s,ok := k.(string) ; ok {
170-
keys = append( keys, s )
169+
if s, ok := k.(string); ok {
170+
keys = append(keys, s)
171171
}
172172
}
173173
return keys, nil

simpleyaml_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,20 @@ func TestArray(t *testing.T) {
139139
}
140140
}
141141

142-
143142
func TestMap(t *testing.T) {
144-
y, err := NewYaml( data )
143+
y, err := NewYaml(data)
145144
if err != nil {
146145
t.Fatal("init yaml failed")
147146
}
148147
if !y.IsMap() {
149-
t.Fatal( "map check failed")
148+
t.Fatal("map check failed")
150149
}
151150

152151
keys, err := y.GetMapKeys()
153152
if err != nil {
154-
t.Fatal( "get keys from map is failed" )
153+
t.Fatal("get keys from map is failed")
155154
}
156-
if len( keys ) != 6 {
157-
t.Fatal( "fail to check number of keys")
155+
if len(keys) != 6 {
156+
t.Fatal("fail to check number of keys")
158157
}
159158
}

0 commit comments

Comments
 (0)