You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
757 B
Go
36 lines
757 B
Go
10 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
var dataPath = "/projects/exo/expl.speck"
|
||
|
|
||
|
func log_error(template string, args ...interface{}) {
|
||
|
fmt.Fprint(os.Stderr, "ERROR ")
|
||
|
fmt.Fprintf(os.Stderr, template+"\n", args...)
|
||
|
}
|
||
|
|
||
|
func log_info(template string, args ...interface{}) {
|
||
|
fmt.Fprint(os.Stdout, "INFO ")
|
||
|
fmt.Fprintf(os.Stdout, template+"\n", args...)
|
||
|
}
|
||
|
|
||
|
func bail(status int, template string, args ...interface{}) {
|
||
|
if status == 0 {
|
||
|
fmt.Fprintf(os.Stdout, template, args...)
|
||
|
} else {
|
||
|
fmt.Fprintf(os.Stderr, template, args...)
|
||
|
}
|
||
|
os.Exit(status)
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
fi, err := os.Open(dataPath)
|
||
|
if err != nil {
|
||
|
bail(E_No_Data, "unable to open data path: %v", err)
|
||
|
}
|
||
|
speckStream(fi)
|
||
|
}
|