Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Commit

Permalink
Don't use mixedCase in package name
Browse files Browse the repository at this point in the history
This is now a rule in golint
  • Loading branch information
Craig Jellick committed Mar 12, 2018
1 parent 28b8101 commit 836226a
Show file tree
Hide file tree
Showing 28 changed files with 47 additions and 47 deletions.
6 changes: 3 additions & 3 deletions cloudprovider/aliyun/aliyun_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/loganhz/aliyungo/metadata"

"github.com/rancher/agent/cloudprovider"
"github.com/rancher/agent/core/hostInfo"
"github.com/rancher/agent/core/hostinfo"
)

const (
Expand Down Expand Up @@ -53,7 +53,7 @@ func (p *Provider) Name() string {
return aliyunTag
}

func (p *Provider) GetHostInfo() (i *hostInfo.Info, err error) {
func (p *Provider) GetHostInfo() (i *hostinfo.Info, err error) {
zone, err := p.client.Zone()
if err != nil {
return
Expand All @@ -62,7 +62,7 @@ func (p *Provider) GetHostInfo() (i *hostInfo.Info, err error) {
if err != nil {
return
}
i = &hostInfo.Info{}
i = &hostinfo.Info{}
i.Labels = map[string]string{}
i.Labels[cloudprovider.RegionLabel] = region
i.Labels[cloudprovider.AvailabilityZoneLabel] = zone
Expand Down
4 changes: 2 additions & 2 deletions cloudprovider/aliyun/aliyun_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
. "gopkg.in/check.v1"

"github.com/rancher/agent/cloudprovider"
"github.com/rancher/agent/core/hostInfo"
"github.com/rancher/agent/core/hostinfo"
"github.com/rancher/agent/utilities/config"
)

Expand Down Expand Up @@ -53,7 +53,7 @@ func (s *ComputeTestSuite) TestGetHostInfo(c *C) {
retryCount: 2,
}

i := &hostInfo.Info{}
i := &hostinfo.Info{}
i.Labels = map[string]string{
cloudprovider.RegionLabel: "fake",
cloudprovider.AvailabilityZoneLabel: "fake",
Expand Down
6 changes: 3 additions & 3 deletions cloudprovider/aws/aws_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/aws/aws-sdk-go/aws/session"

"github.com/rancher/agent/cloudprovider"
"github.com/rancher/agent/core/hostInfo"
"github.com/rancher/agent/core/hostinfo"
)

const (
Expand Down Expand Up @@ -53,12 +53,12 @@ func (p *Provider) Name() string {
return awsTag
}

func (p *Provider) GetHostInfo() (i *hostInfo.Info, err error) {
func (p *Provider) GetHostInfo() (i *hostinfo.Info, err error) {
document, err := p.client.getInstanceIdentityDocument()
if err != nil {
return
}
i = &hostInfo.Info{}
i = &hostinfo.Info{}
i.Labels = map[string]string{}
i.Labels[cloudprovider.RegionLabel] = document.Region
i.Labels[cloudprovider.AvailabilityZoneLabel] = document.AvailabilityZone
Expand Down
4 changes: 2 additions & 2 deletions cloudprovider/aws/aws_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
. "gopkg.in/check.v1"

"github.com/rancher/agent/cloudprovider"
"github.com/rancher/agent/core/hostInfo"
"github.com/rancher/agent/core/hostinfo"
"github.com/rancher/agent/utilities/config"
)

Expand Down Expand Up @@ -45,7 +45,7 @@ func (s *ComputeTestSuite) TestGetHostInfo(c *C) {
interval: time.Second,
retryCount: 2,
}
i := &hostInfo.Info{}
i := &hostinfo.Info{}
i.Labels = map[string]string{
cloudprovider.RegionLabel: "fake",
cloudprovider.AvailabilityZoneLabel: "fake",
Expand Down
6 changes: 3 additions & 3 deletions cloudprovider/cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/Sirupsen/logrus"

"github.com/rancher/agent/core/hostInfo"
"github.com/rancher/agent/core/hostinfo"
"github.com/rancher/agent/utilities/config"
)

Expand All @@ -31,7 +31,7 @@ var (

type Provider interface {
Init() error
GetHostInfo() (*hostInfo.Info, error)
GetHostInfo() (*hostinfo.Info, error)
RetryCount() int
Interval() time.Duration
Name() string
Expand Down Expand Up @@ -77,7 +77,7 @@ func GetCloudProviderInfo() {
return
}

func WriteHostInfo(i *hostInfo.Info) error {
func WriteHostInfo(i *hostinfo.Info) error {
bytes, err := json.Marshal(i)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions core/compute/compute_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/docker/docker/client"
"github.com/docker/go-connections/nat"
"github.com/pkg/errors"
"github.com/rancher/agent/core/hostInfo"
"github.com/rancher/agent/core/hostinfo"
"github.com/rancher/agent/core/storage"
"github.com/rancher/agent/model"
"github.com/rancher/agent/utilities/constants"
Expand Down Expand Up @@ -426,7 +426,7 @@ func setupDeviceOptions(hostConfig *container.HostConfig, instance model.Instanc
for dev, options := range deviceOptions {
if dev == "DEFAULT_DISK" {
// ignore this error because if we can't find the device we just skip that device
dev, _ = hostInfo.GetDefaultDisk(infoData)
dev, _ = hostinfo.GetDefaultDisk(infoData)
if dev == "" {
logrus.Warn(fmt.Sprintf("Couldn't find default device. Not setting device options: %s", options))
continue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/cpu.go → core/hostinfo/cpu.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/cpu_info.go → core/hostinfo/cpu_info.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

import (
"github.com/shirou/gopsutil/cpu"
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/disk.go → core/hostinfo/disk.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

import (
"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/disk_info.go → core/hostinfo/disk_info.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

import (
"github.com/rancher/agent/model"
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/host_info.go → core/hostinfo/host_info.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

import (
"github.com/Sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/iops.go → core/hostinfo/iops.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

import (
"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/iops_unix.go → core/hostinfo/iops_unix.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build linux freebsd solaris openbsd darwin

package hostInfo
package hostinfo

import (
"encoding/json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

func (i IopsCollector) parseIopsData() (map[string]interface{}, error) {
return map[string]interface{}{}, nil
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/key_info.go → core/hostinfo/key_info.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

import (
"crypto/rand"
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/memory.go → core/hostinfo/memory.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

import (
"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/os_c.go → core/hostinfo/os_c.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hostInfo
package hostinfo

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion core/hostInfo/os_c_unix.go → core/hostinfo/os_c_unix.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//+build !windows

package hostInfo
package hostinfo

import (
"bufio"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//+build windows

package hostInfo
package hostinfo

import (
"bufio"
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions core/ping/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package ping
import (
"github.com/docker/docker/client"
"github.com/pkg/errors"
"github.com/rancher/agent/core/hostInfo"
"github.com/rancher/agent/core/hostinfo"
"github.com/rancher/agent/model"
"github.com/rancher/agent/utilities/config"
"github.com/rancher/agent/utilities/constants"
revents "github.com/rancher/event-subscriber/events"
)

func DoPingAction(event *revents.Event, resp *model.PingResponse, dockerClient *client.Client, collectors []hostInfo.Collector) error {
func DoPingAction(event *revents.Event, resp *model.PingResponse, dockerClient *client.Client, collectors []hostinfo.Collector) error {
if !config.DockerEnable() {
return nil
}
Expand Down
10 changes: 5 additions & 5 deletions core/ping/ping_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/pkg/errors"
"github.com/rancher/agent/core/hostInfo"
"github.com/rancher/agent/core/hostinfo"
"github.com/rancher/agent/model"
"github.com/rancher/agent/utilities/config"
"github.com/rancher/agent/utilities/constants"
Expand All @@ -29,13 +29,13 @@ const (
requireAnyLabel = "io.rancher.scheduler.require_any"
)

func addResource(ping *revents.Event, pong *model.PingResponse, dockerClient *client.Client, collectors []hostInfo.Collector) error {
func addResource(ping *revents.Event, pong *model.PingResponse, dockerClient *client.Client, collectors []hostinfo.Collector) error {
if !pingIncludeResource(ping) {
return nil
}
stats := map[string]interface{}{}
if pingIncludeStats(ping) {
data := hostInfo.CollectData(collectors)
data := hostinfo.CollectData(collectors)
stats = data
}

Expand Down Expand Up @@ -208,8 +208,8 @@ func pingIncludeInstance(ping *revents.Event) bool {
return utils.InterfaceToBool(value)
}

func getHostLabels(collectors []hostInfo.Collector) (map[string]string, error) {
return hostInfo.HostLabels("io.rancher.host", collectors)
func getHostLabels(collectors []hostinfo.Collector) (map[string]string, error) {
return hostinfo.HostLabels("io.rancher.host", collectors)
}

func getAllContainerByState(dockerClient *client.Client, done chan bool) (map[string]types.Container, map[string]types.Container, error) {
Expand Down
18 changes: 9 additions & 9 deletions handlers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
goUUID "github.com/nu7hatch/gouuid"
"github.com/patrickmn/go-cache"
"github.com/pkg/errors"
"github.com/rancher/agent/core/hostInfo"
"github.com/rancher/agent/core/hostinfo"
"github.com/rancher/agent/model"
"github.com/rancher/agent/utilities/docker"
revents "github.com/rancher/event-subscriber/events"
Expand Down Expand Up @@ -133,27 +133,27 @@ func initializeHandlers() *Handler {
}
storageCache := cache.New(5*time.Minute, 30*time.Second)
cache := cache.New(5*time.Minute, 30*time.Second)
Collectors := []hostInfo.Collector{
hostInfo.CPUCollector{},
hostInfo.DiskCollector{
Collectors := []hostinfo.Collector{
hostinfo.CPUCollector{},
hostinfo.DiskCollector{
Unit: 1048576,
InfoData: model.InfoData{
Info: info,
Version: version,
},
},
hostInfo.IopsCollector{},
hostInfo.MemoryCollector{
hostinfo.IopsCollector{},
hostinfo.MemoryCollector{
Unit: 1024.00,
},
hostInfo.OSCollector{
hostinfo.OSCollector{
InfoData: model.InfoData{
Info: info,
Version: version,
},
},
hostInfo.KeyCollector{},
hostInfo.CloudProviderCollector{},
hostinfo.KeyCollector{},
hostinfo.CloudProviderCollector{},
}
computerHandler := ComputeHandler{
dockerClientWithTimeout: clientWithTimeout,
Expand Down
4 changes: 2 additions & 2 deletions handlers/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package handlers
import (
engineCli "github.com/docker/docker/client"
"github.com/pkg/errors"
"github.com/rancher/agent/core/hostInfo"
"github.com/rancher/agent/core/hostinfo"
"github.com/rancher/agent/core/marshaller"
"github.com/rancher/agent/core/ping"
"github.com/rancher/agent/model"
Expand All @@ -15,7 +15,7 @@ import (

type PingHandler struct {
dockerClient *engineCli.Client
collectors []hostInfo.Collector
collectors []hostinfo.Collector
}

func (h *PingHandler) Ping(event *revents.Event, cli *client.RancherClient) error {
Expand Down

0 comments on commit 836226a

Please sign in to comment.