Skip to content

Commit e074eb7

Browse files
committed
doc: remove unnecessary examples
1 parent d06ca03 commit e074eb7

File tree

7 files changed

+39
-239
lines changed

7 files changed

+39
-239
lines changed

class_test.go

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

devcon.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ func (dc *DevCon) run(command command, args ...string) ([]string, error) {
125125
dc.RemotePath = ""
126126

127127
if dc.ExeFilePath == "" {
128-
return readTestDataFile(command)
129-
// return nil, errors.New("invalid devcon.exe path specified")
128+
return nil, errors.New("invalid devcon.exe path specified")
130129
}
131130

132131
if _, err := os.Stat(dc.ExeFilePath); os.IsNotExist(err) {
@@ -174,16 +173,3 @@ func (dc *DevCon) logResults(lines []string) {
174173
fmt.Println(line)
175174
}
176175
}
177-
178-
func readTestDataFile(command command) ([]string, error) {
179-
fileName := fmt.Sprintf("%s.txt", command.String())
180-
181-
path := filepath.Join("testdata", fileName)
182-
183-
bytes, err := ioutil.ReadFile(path)
184-
if err != nil {
185-
return nil, fmt.Errorf("error reading test data file: %w", err)
186-
}
187-
188-
return splitLines(string(bytes)), nil
189-
}

devcon_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package devcon_test
2+
3+
import (
4+
"fmt"
5+
"strings"
6+
7+
"github.com/mikerourke/go-devcon"
8+
)
9+
10+
func Example_install() {
11+
dc := devcon.New(`C:\windows\devcon.exe`)
12+
13+
devs, err := dc.Find("*VEN_8086*")
14+
if err != nil {
15+
fmt.Println(err)
16+
17+
return
18+
}
19+
20+
var matchingDev devcon.Device
21+
22+
for _, dev := range devs {
23+
if strings.Contains(dev.Name, "PRO") {
24+
matchingDev = dev
25+
break
26+
}
27+
}
28+
29+
if matchingDev.ID != "" {
30+
err = dc.Install(`C:\drivers\PRO1000\WIN32\E1000325.INF`, matchingDev.ID)
31+
if err != nil {
32+
fmt.Printf("error installing: %s", err)
33+
} else {
34+
fmt.Println("Successfully installed")
35+
36+
}
37+
}
38+
}

device_test.go

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

driver_test.go

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

hwids_test.go

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

oem_test.go

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

0 commit comments

Comments
 (0)