Skip to content

Commit 4ff8dd2

Browse files
committed
remove tags type introducing an exported function
1 parent a1aeead commit 4ff8dd2

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

command/device/device.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type DeviceInfo struct {
3535

3636
func getDeviceInfo(device *iotclient.ArduinoDevicev2) (*DeviceInfo, error) {
3737
// Retrieve device tags
38-
tags, err := tag.Tags(device.Tags).Info()
38+
tags, err := tag.TagsInfo(device.Tags)
3939
if err != nil {
4040
return nil, err
4141
}

command/tag/tag.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ package tag
22

33
import "fmt"
44

5-
type Tags map[string]interface{}
6-
7-
// Info transforms tags into user-readable strings
5+
// TagsInfo transforms tags into user-readable strings
86
// An error is returned if a tag value is not a string
9-
func (t Tags) Info() ([]string, error) {
7+
func TagsInfo(tags map[string]interface{}) ([]string, error) {
108
var str []string
11-
for key, value := range t {
9+
for key, value := range tags {
1210
if valStr, ok := value.(string); ok {
1311
str = append(str, key+": "+valStr)
1412
} else {

command/thing/thing.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func getThingInfo(thing *iotclient.ArduinoThing) (*ThingInfo, error) {
3939
vars = append(vars, p.Name)
4040
}
4141
// Retrieve thing tags
42-
tags, err := tag.Tags(thing.Tags).Info()
42+
tags, err := tag.TagsInfo(thing.Tags)
4343
if err != nil {
4444
return nil, err
4545
}

0 commit comments

Comments
 (0)