summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-01-10 09:06:52 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-01-10 09:25:51 +0100
commitdd877bc8168c1a87a9d05d36f42b333b861c6e7e (patch)
tree0c489720344e4e67ec56097ae0466a1aa2607470
parent55976cdcd58ed3311090aeb9d371bff53c49dcc1 (diff)
Fixed go linter warnings.
-rw-r--r--lib/syncthing/stEvent.go30
-rw-r--r--lib/xdsconfig/data.go3
-rw-r--r--lib/xdsconfig/fileconfig.go4
3 files changed, 25 insertions, 12 deletions
diff --git a/lib/syncthing/stEvent.go b/lib/syncthing/stEvent.go
index 605778c..ec11b56 100644
--- a/lib/syncthing/stEvent.go
+++ b/lib/syncthing/stEvent.go
@@ -42,32 +42,44 @@ type Events struct {
mutex sync.Mutex
}
+// Event Syncthing events structure
type Event struct {
Type string `json:"type"`
Time time.Time `json:"time"`
Data map[string]string `json:"data"`
}
+// EventsCBData Data parameter of Event callback
type EventsCBData map[string]interface{}
+
+// EventsCB Event callback
type EventsCB func(ev Event, cbData *EventsCBData)
const (
+ // EventFolderCompletion .
EventFolderCompletion string = "FolderCompletion"
- EventFolderSummary string = "FolderSummary"
- EventFolderPaused string = "FolderPaused"
- EventFolderResumed string = "FolderResumed"
- EventFolderErrors string = "FolderErrors"
- EventStateChanged string = "StateChanged"
+ // EventFolderSummary .
+ EventFolderSummary string = "FolderSummary"
+ // EventFolderPaused .
+ EventFolderPaused string = "FolderPaused"
+ // EventFolderResumed .
+ EventFolderResumed string = "FolderResumed"
+ // EventFolderErrors .
+ EventFolderErrors string = "FolderErrors"
+ // EventStateChanged .
+ EventStateChanged string = "StateChanged"
)
-var EventsAll string = EventFolderCompletion + "|" +
+// EventsAll .
+var EventsAll = EventFolderCompletion + "|" +
EventFolderSummary + "|" +
EventFolderPaused + "|" +
EventFolderResumed + "|" +
EventFolderErrors + "|" +
EventStateChanged
-type STEvent struct {
+// SyncthingEvent Syncthing Event structure definition
+type SyncthingEvent struct {
// Per-subscription sequential event ID. Named "id" for backwards compatibility with the REST API
SubscriptionID int `json:"id"`
// Global ID of the event across all subscriptions
@@ -158,9 +170,9 @@ func (e *Events) UnRegister(id string) error {
}
// GetEvents returns the Syncthing events
-func (e *Events) getEvents(since int) ([]STEvent, error) {
+func (e *Events) getEvents(since int) ([]SyncthingEvent, error) {
var data []byte
- ev := []STEvent{}
+ ev := []SyncthingEvent{}
url := "events"
if since != -1 {
url += "?since=" + strconv.Itoa(since)
diff --git a/lib/xdsconfig/data.go b/lib/xdsconfig/data.go
index b582ec5..ad18d60 100644
--- a/lib/xdsconfig/data.go
+++ b/lib/xdsconfig/data.go
@@ -35,13 +35,14 @@ type xmlServerData struct {
Data ServerData `xml:"server-data"`
}
+// ServerData Hold server data saved in ServerData file
type ServerData struct {
ID string `xml:"id"`
}
var sdMutex = sync.NewMutex()
-// ServerIDGet
+// ServerIDGet Get Server unique ID
func ServerIDGet() (string, error) {
var f string
var err error
diff --git a/lib/xdsconfig/fileconfig.go b/lib/xdsconfig/fileconfig.go
index 46afc57..69467b4 100644
--- a/lib/xdsconfig/fileconfig.go
+++ b/lib/xdsconfig/fileconfig.go
@@ -173,12 +173,12 @@ func configFilenameGet(cfgFile string) (string, error) {
return path.Join(usr.HomeDir, ConfigDir, cfgFile), nil
}
-// FoldersConfigFilenameGet
+// FoldersConfigFilenameGet Return the FoldersConfig filename
func FoldersConfigFilenameGet() (string, error) {
return configFilenameGet(FoldersConfigFilename)
}
-// ServerDataFilenameGet
+// ServerDataFilenameGet Return the ServerData filename
func ServerDataFilenameGet() (string, error) {
return configFilenameGet(ServerDataFilename)
}