2008-06-26 18:08:39 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// $G $F.go && $L $F.$A && ./$A.out readfile.go
|
|
|
|
// # This is some data we can recognize
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
2008-06-27 15:15:06 -06:00
|
|
|
func main() {
|
2008-10-07 13:31:31 -06:00
|
|
|
var s string;
|
|
|
|
var ok bool;
|
2008-06-26 18:08:39 -06:00
|
|
|
|
|
|
|
s, ok = sys.readfile("readfile.go");
|
|
|
|
if !ok {
|
2008-08-11 23:07:49 -06:00
|
|
|
print("couldn't readfile\n");
|
2008-06-27 15:15:06 -06:00
|
|
|
sys.exit(1)
|
2008-06-26 18:08:39 -06:00
|
|
|
}
|
|
|
|
start_of_file :=
|
|
|
|
"// $G $F.go && $L $F.$A && ./$A.out readfile.go\n" +
|
|
|
|
"// # This is some data we can recognize\n" +
|
|
|
|
"\n" +
|
|
|
|
"package main\n";
|
|
|
|
if s[0:102] != start_of_file {
|
2008-08-11 23:07:49 -06:00
|
|
|
print("wrong data\n");
|
2008-06-27 15:15:06 -06:00
|
|
|
sys.exit(1)
|
2008-06-26 18:08:39 -06:00
|
|
|
}
|
|
|
|
}
|