Skip to content

Commit c3d044b

Browse files
authored
Merge pull request #193 from jaypipes/pkg-cleanup
move supporting code into separate packages
2 parents 2452c9a + e67b230 commit c3d044b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1822
-2309
lines changed

.travis.yml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: go
2+
go: "1.13"
23
# Using sudo triggers a real virtual machine as opposed to a container, which
34
# allows ghw to actually determine things like host memory or block storage...
45
sudo: required
@@ -8,36 +9,17 @@ script:
89
- go run cmd/ghwc/main.go
910
env:
1011
- GHW_TESTING_SKIP_GPU=1
12+
- GO111MODULE="on"
1113
matrix:
1214
include:
13-
# On Go 1.10 and Go 1.11, use dep to ensure dependencies before running go
14-
# test.
15-
- os: linux
16-
go: "1.10"
17-
install:
18-
- go get -u github.com/golang/dep/cmd/dep
19-
- dep ensure -v
20-
- os: linux
21-
go: "1.11"
22-
install:
23-
- go get -u github.com/golang/dep/cmd/dep
24-
- dep ensure -v
25-
# On Go >=1.12, use go modules to ensure dependencies instead of dep
26-
- os: linux
27-
go: "1.12"
28-
env: GO111MODULE=on
2915
- os: linux
3016
go: "1.13"
31-
env: GO111MODULE=on
3217
- os: linux
3318
go: "1.14.x"
34-
env: GO111MODULE=on
3519

3620
# Tests that ghw builds on MacOSX (even though there is currently only
3721
# support for block devices)
3822
#- os: osx
39-
# go: "1.12"
40-
# env: GO111MODULE=on
41-
#- os: osx
4223
# go: "1.13"
43-
# env: GO111MODULE=on
24+
#- os: osx
25+
# go: "1.14.x"

Gopkg.lock

Lines changed: 0 additions & 87 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 28 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@ VENDOR := vendor
22
PKGS := $(shell go list ./... | grep -v /$(VENDOR)/)
33
SRC = $(shell find . -type f -name '*.go' -not -path "*/$(VENDOR)/*")
44
BIN_DIR := $(GOPATH)/bin
5-
DEP := $(BIN_DIR)/dep
65
GOMETALINTER := $(BIN_DIR)/gometalinter
76

87
.PHONY: test
98
test: vet
109
go test $(PKGS)
1110

12-
$(DEP):
13-
go get -u github.com/golang/dep/cmd/dep
14-
15-
.PHONY: dep
16-
dep: $(DEP)
17-
$(DEP) ensure
18-
1911
$(GOMETALINTER):
2012
go get -u github.com/alecthomas/gometalinter
2113
$(GOMETALINTER) --install &> /dev/null

alias.go

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
//
2+
// Use and distribution licensed under the Apache license version 2.
3+
//
4+
// See the COPYING file in the root project directory for full text.
5+
//
6+
7+
package ghw
8+
9+
import (
10+
"github.com/jaypipes/ghw/pkg/baseboard"
11+
"github.com/jaypipes/ghw/pkg/bios"
12+
"github.com/jaypipes/ghw/pkg/block"
13+
"github.com/jaypipes/ghw/pkg/chassis"
14+
"github.com/jaypipes/ghw/pkg/cpu"
15+
"github.com/jaypipes/ghw/pkg/gpu"
16+
"github.com/jaypipes/ghw/pkg/memory"
17+
"github.com/jaypipes/ghw/pkg/net"
18+
"github.com/jaypipes/ghw/pkg/option"
19+
"github.com/jaypipes/ghw/pkg/pci"
20+
"github.com/jaypipes/ghw/pkg/product"
21+
"github.com/jaypipes/ghw/pkg/topology"
22+
)
23+
24+
type WithOption = option.Option
25+
26+
var (
27+
WithChroot = option.WithChroot
28+
)
29+
30+
type CPUInfo = cpu.Info
31+
32+
var (
33+
CPU = cpu.New
34+
)
35+
36+
type MemoryInfo = memory.Info
37+
type MemoryCacheType = memory.CacheType
38+
type MemoryModule = memory.Module
39+
40+
const (
41+
MEMORY_CACHE_TYPE_UNIFIED = memory.CACHE_TYPE_UNIFIED
42+
MEMORY_CACHE_TYPE_INSTRUCTION = memory.CACHE_TYPE_INSTRUCTION
43+
MEMORY_CACHE_TYPE_DATA = memory.CACHE_TYPE_DATA
44+
)
45+
46+
var (
47+
Memory = memory.New
48+
)
49+
50+
type BlockInfo = block.Info
51+
type Disk = block.Disk
52+
type Partition = block.Partition
53+
54+
var (
55+
Block = block.New
56+
)
57+
58+
type DriveType = block.DriveType
59+
60+
const (
61+
DRIVE_TYPE_UNKNOWN = block.DRIVE_TYPE_UNKNOWN
62+
DRIVE_TYPE_HDD = block.DRIVE_TYPE_HDD
63+
DRIVE_TYPE_FDD = block.DRIVE_TYPE_FDD
64+
DRIVE_TYPE_ODD = block.DRIVE_TYPE_ODD
65+
DRIVE_TYPE_SSD = block.DRIVE_TYPE_SSD
66+
)
67+
68+
type StorageController = block.StorageController
69+
70+
const (
71+
STORAGE_CONTROLLER_UNKNOWN = block.STORAGE_CONTROLLER_UNKNOWN
72+
STORAGE_CONTROLLER_IDE = block.STORAGE_CONTROLLER_IDE
73+
STORAGE_CONTROLLER_SCSI = block.STORAGE_CONTROLLER_SCSI
74+
STORAGE_CONTROLLER_NVME = block.STORAGE_CONTROLLER_NVME
75+
STORAGE_CONTROLLER_VIRTIO = block.STORAGE_CONTROLLER_VIRTIO
76+
STORAGE_CONTROLLER_MMC = block.STORAGE_CONTROLLER_MMC
77+
)
78+
79+
type NetworkInfo = net.Info
80+
type NIC = net.NIC
81+
type NICCapability = net.NICCapability
82+
83+
var (
84+
Network = net.New
85+
)
86+
87+
type BIOSInfo = bios.Info
88+
89+
var (
90+
BIOS = bios.New
91+
)
92+
93+
type ChassisInfo = chassis.Info
94+
95+
var (
96+
Chassis = chassis.New
97+
)
98+
99+
type BaseboardInfo = baseboard.Info
100+
101+
var (
102+
Baseboard = baseboard.New
103+
)
104+
105+
type TopologyInfo = topology.Info
106+
type TopologyNode = topology.Node
107+
108+
var (
109+
Topology = topology.New
110+
)
111+
112+
type Architecture = topology.Architecture
113+
114+
const (
115+
ARCHITECTURE_SMP = topology.ARCHITECTURE_SMP
116+
ARCHITECTURE_NUMA = topology.ARCHITECTURE_NUMA
117+
)
118+
119+
type PCIInfo = pci.Info
120+
type PCIAddress = pci.Address
121+
type PCIDevice = pci.Device
122+
123+
var (
124+
PCI = pci.New
125+
PCIAddressFromString = pci.AddressFromString
126+
)
127+
128+
type ProductInfo = product.Info
129+
130+
var (
131+
Product = product.New
132+
)
133+
134+
type GPUInfo = gpu.Info
135+
type GraphicsCard = gpu.GraphicsCard
136+
137+
var (
138+
GPU = gpu.New
139+
)

architecture.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

baseboard_linux.go

Lines changed: 0 additions & 15 deletions
This file was deleted.

bios_linux.go

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)