Update go version to 1.7, fix vet errors

closes #1728
This commit is contained in:
Cameron Sparr 2016-09-09 15:46:31 +01:00
parent ca8fb440cc
commit 811567a2f4
3 changed files with 31 additions and 15 deletions

View File

@ -4,9 +4,9 @@ machine:
post: post:
- sudo service zookeeper stop - sudo service zookeeper stop
- go version - go version
- go version | grep 1.6.2 || sudo rm -rf /usr/local/go - go version | grep 1.7.1 || sudo rm -rf /usr/local/go
- wget https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz - wget https://storage.googleapis.com/golang/go1.7.1.linux-amd64.tar.gz
- sudo tar -C /usr/local -xzf go1.6.2.linux-amd64.tar.gz - sudo tar -C /usr/local -xzf go1.7.1.linux-amd64.tar.gz
- go version - go version
dependencies: dependencies:

File diff suppressed because one or more lines are too long

View File

@ -26,12 +26,26 @@ func (s *Server) gatherData(acc telegraf.Accumulator, gatherDbStats bool) error
s.Session.SetMode(mgo.Eventual, true) s.Session.SetMode(mgo.Eventual, true)
s.Session.SetSocketTimeout(0) s.Session.SetSocketTimeout(0)
result_server := &ServerStatus{} result_server := &ServerStatus{}
err := s.Session.DB("admin").Run(bson.D{{"serverStatus", 1}, {"recordStats", 0}}, result_server) err := s.Session.DB("admin").Run(bson.D{
{
Name: "serverStatus",
Value: 1,
},
{
Name: "recordStats",
Value: 0,
},
}, result_server)
if err != nil { if err != nil {
return err return err
} }
result_repl := &ReplSetStatus{} result_repl := &ReplSetStatus{}
err = s.Session.DB("admin").Run(bson.D{{"replSetGetStatus", 1}}, result_repl) err = s.Session.DB("admin").Run(bson.D{
{
Name: "replSetGetStatus",
Value: 1,
},
}, result_repl)
if err != nil { if err != nil {
log.Println("Not gathering replica set status, member not in replica set (" + err.Error() + ")") log.Println("Not gathering replica set status, member not in replica set (" + err.Error() + ")")
} }
@ -52,7 +66,12 @@ func (s *Server) gatherData(acc telegraf.Accumulator, gatherDbStats bool) error
} }
for _, db_name := range names { for _, db_name := range names {
db_stat_line := &DbStatsData{} db_stat_line := &DbStatsData{}
err = s.Session.DB(db_name).Run(bson.D{{"dbStats", 1}}, db_stat_line) err = s.Session.DB(db_name).Run(bson.D{
{
Name: "dbStats",
Value: 1,
},
}, db_stat_line)
if err != nil { if err != nil {
log.Println("Error getting db stats from " + db_name + "(" + err.Error() + ")") log.Println("Error getting db stats from " + db_name + "(" + err.Error() + ")")
} }