Skip to content

Commit

Permalink
Merge pull request #806 from mackerelio/remove-unused-code
Browse files Browse the repository at this point in the history
remove unused codes
  • Loading branch information
yseto committed Sep 2, 2022
2 parents 213146f + 2972f35 commit 6ebc41b
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 93 deletions.
3 changes: 0 additions & 3 deletions spec/darwin/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ import (
"strconv"
"strings"

"github.com/mackerelio/golib/logging"
"github.com/mackerelio/mackerel-client-go"
)

// MemoryGenerator collects the host's memory specs.
type MemoryGenerator struct {
}

var memoryLogger = logging.GetLogger("spec.memory")

const bytesInKibibytes = 1024

// Generate returns memory specs.
Expand Down
15 changes: 0 additions & 15 deletions spec/freebsd/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,9 @@ type CPUGenerator struct {

var cpuLogger = logging.GetLogger("spec.cpu")

type cpuSpec map[string]interface{}

// MEMO: sysctl -a machdep.cpu.brand_string

// Generate collects CPU specs.
// Returns an array of cpuSpec.
// Each spec is expected to have keys below:
// - model_name (used in Web)
// - vendor_id
// - family
// - model
// - stepping
// - physical_id
// - core_id
// - cores
// - mhz
// - cache_size
// - flags
func (g *CPUGenerator) Generate() (interface{}, error) {
brandBytes, err := exec.Command("sysctl", "-n", "hw.model").Output()
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions spec/freebsd/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ import (
"strconv"
"strings"

"github.com/mackerelio/golib/logging"
"github.com/mackerelio/mackerel-client-go"
)

// MemoryGenerator collects the host's memory specs.
type MemoryGenerator struct {
}

var memoryLogger = logging.GetLogger("spec.memory")

const bytesInKibibytes = 1024

// Generate returns memory specs.
Expand Down
12 changes: 0 additions & 12 deletions spec/linux/cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ func TestCPUGenerate(t *testing.T) {
if _, ok := cpu1["stepping"]; !ok {
t.Error("cpu should have stepping")
}
if _, ok := cpu1["physical_id"]; !ok {
// fails on some environments
// t.Error("cpu should have physical_id")
}
if _, ok := cpu1["core_id"]; !ok {
// fails on some environments
// t.Error("cpu should have core_id")
}
if _, ok := cpu1["cores"]; !ok {
// fails on some environments
// t.Error("cpu should have cores")
}
if _, ok := cpu1["model_name"]; !ok {
t.Error("cpu should have model_name")
}
Expand Down
15 changes: 0 additions & 15 deletions spec/netbsd/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,9 @@ type CPUGenerator struct {

var cpuLogger = logging.GetLogger("spec.cpu")

type cpuSpec map[string]interface{}

// MEMO: sysctl -a machdep.cpu.brand_string

// Generate collects CPU specs.
// Returns an array of cpuSpec.
// Each spec is expected to have keys below:
// - model_name (used in Web)
// - vendor_id
// - family
// - model
// - stepping
// - physical_id
// - core_id
// - cores
// - mhz
// - cache_size
// - flags
func (g *CPUGenerator) Generate() (interface{}, error) {
brandBytes, err := exec.Command("sysctl", "-n", "hw.model").Output()
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions spec/windows/block_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"syscall"
"unsafe"

"github.com/mackerelio/golib/logging"
"github.com/mackerelio/mackerel-client-go"

"github.com/mackerelio/mackerel-agent/util/windows"
Expand All @@ -17,8 +16,6 @@ import (
type BlockDeviceGenerator struct {
}

var blockDeviceLogger = logging.GetLogger("spec.block_device")

// Generate XXX
func (g *BlockDeviceGenerator) Generate() (interface{}, error) {
results := make(mackerel.BlockDevice)
Expand Down
3 changes: 0 additions & 3 deletions spec/windows/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"
"unsafe"

"github.com/mackerelio/golib/logging"
"github.com/mackerelio/mackerel-client-go"

"github.com/mackerelio/mackerel-agent/util/windows"
Expand All @@ -17,8 +16,6 @@ import (
type CPUGenerator struct {
}

var cpuLogger = logging.GetLogger("spec.cpu")

// Generate collects CPU specs.
func (g *CPUGenerator) Generate() (interface{}, error) {
var results mackerel.CPU
Expand Down
27 changes: 0 additions & 27 deletions spec/windows/cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,40 +29,13 @@ func TestCPUGenerate(t *testing.T) {
if _, ok := cpu1["vendor_id"]; !ok {
t.Error("cpu should have vendor_id")
}
if _, ok := cpu1["family"]; !ok {
//t.Error("cpu should have family")
}
if _, ok := cpu1["model"]; !ok {
t.Error("cpu should have model")
}
if _, ok := cpu1["stepping"]; !ok {
//t.Error("cpu should have stepping")
}
if _, ok := cpu1["physical_id"]; !ok {
// fails on some environments
// t.Error("cpu should have physical_id")
}
if _, ok := cpu1["core_id"]; !ok {
// fails on some environments
// t.Error("cpu should have core_id")
}
if _, ok := cpu1["cores"]; !ok {
// fails on some environments
// t.Error("cpu should have cores")
}
if _, ok := cpu1["model_name"]; !ok {
t.Error("cpu should have model_name")
}
if _, ok := cpu1["mhz"]; !ok {
t.Error("cpu should have mhz")
}
if _, ok := cpu1["cache_size"]; !ok {
//t.Error("cpu should have cache_size")
}
if _, ok := cpu1["flags"]; !ok {
//t.Error("cpu should have flags")
}
if _, ok := cpu1["flags"].([]string); !ok {
//t.Error("cpu.flags should be slice of string")
}
}
3 changes: 0 additions & 3 deletions spec/windows/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package windows

import (
"github.com/mackerelio/golib/logging"
"github.com/mackerelio/mackerel-client-go"

"github.com/mackerelio/mackerel-agent/util/windows"
Expand All @@ -14,8 +13,6 @@ import (
type FilesystemGenerator struct {
}

var filesystemLogger = logging.GetLogger("spec.filesystem")

// Generate specs of filesystems.
func (g *FilesystemGenerator) Generate() (interface{}, error) {

Expand Down
3 changes: 0 additions & 3 deletions spec/windows/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package windows
import (
"net"

"github.com/mackerelio/golib/logging"
"github.com/mackerelio/mackerel-agent/util/windows"
mkr "github.com/mackerelio/mackerel-client-go"
)
Expand All @@ -15,8 +14,6 @@ import (
type InterfaceGenerator struct {
}

var interfaceLogger = logging.GetLogger("spec.interface")

// Generate XXX
func (g *InterfaceGenerator) Generate() ([]mkr.Interface, error) {
var results []mkr.Interface
Expand Down
3 changes: 0 additions & 3 deletions spec/windows/kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"strings"
"unsafe"

"github.com/mackerelio/golib/logging"
"github.com/mackerelio/mackerel-client-go"

"github.com/mackerelio/mackerel-agent/util/windows"
Expand All @@ -19,8 +18,6 @@ const registryKey = `Software\Microsoft\Windows NT\CurrentVersion`
type KernelGenerator struct {
}

var kernelLogger = logging.GetLogger("spec.kernel")

// Generate XXX
func (g *KernelGenerator) Generate() (interface{}, error) {
results := make(mackerel.Kernel)
Expand Down
3 changes: 0 additions & 3 deletions spec/windows/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"
"unsafe"

"github.com/mackerelio/golib/logging"
"github.com/mackerelio/mackerel-client-go"

"github.com/mackerelio/mackerel-agent/util/windows"
Expand All @@ -17,8 +16,6 @@ import (
type MemoryGenerator struct {
}

var memoryLogger = logging.GetLogger("spec.memory")

// Generate XXX
func (g *MemoryGenerator) Generate() (interface{}, error) {
result := make(mackerel.Memory)
Expand Down

0 comments on commit 6ebc41b

Please sign in to comment.