Skip to content

Commit 474c3e3

Browse files
Moved init for logging to main
1 parent 5e84081 commit 474c3e3

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎chapter2/sample/main.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
package main
22

33
import (
4+
"log"
5+
"os"
6+
47
_ "github.com/goinaction/code/chapter2/sample/matchers"
58
"github.com/goinaction/code/chapter2/sample/search"
69
)
710

11+
// init is called prior to main.
12+
func init() {
13+
// Change the device for logging to stdout.
14+
log.SetOutput(os.Stdout)
15+
}
16+
817
// main is the entry point for the program.
918
func main() {
1019
// Perform the search for the specified term.

‎chapter2/sample/search/search.go‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,12 @@ package search
22

33
import (
44
"log"
5-
"os"
65
"sync"
76
)
87

98
// A map of registered matchers for searching.
109
var matchers map[string]Matcher = make(map[string]Matcher)
1110

12-
// initis called prior to main.
13-
func init() {
14-
// Change the device for logging to stdout.
15-
log.SetOutput(os.Stdout)
16-
}
17-
1811
// Run performs the search logic.
1912
func Run(searchTerm string) {
2013
// Retrieve the list of feeds to search through.

0 commit comments

Comments
 (0)