switch nr, er := f.Read(&buf); true {
case nr < 0:
fmt.Fprintf(os.Stderr, "error reading from %s: %s\n", f.String(), er.String());
- sys.Exit(1);
+ os.Exit(1);
case nr == 0: // EOF
return;
case nr > 0:
f, err := file.Open(flag.Arg(i), 0, 0);
if f == nil {
fmt.Fprintf(os.Stderr, "can't open %s: error %s\n", flag.Arg(i), err);
- sys.Exit(1);
+ os.Exit(1);
}
cat(f);
f.Close();
switch nr, er := r.Read(&buf); {
case nr < 0:
fmt.Fprintf(os.Stderr, "error reading from %s: %s\n", r.String(), er.String());
- sys.Exit(1);
+ os.Exit(1);
case nr == 0: // EOF
return;
case nr > 0:
f, err := file.Open(flag.Arg(i), 0, 0);
if f == nil {
fmt.Fprintf(os.Stderr, "can't open %s: error %s\n", flag.Arg(i), err);
- sys.Exit(1);
+ os.Exit(1);
}
cat(f);
f.Close();
import (
"file";
"fmt";
+ "os";
)
func main() {
file, err := file.Open("/does/not/exist", 0, 0);
if file == nil {
fmt.Printf("can't open file; err=%s\n", err.String());
- sys.Exit(1);
+ os.Exit(1);
}
}
package main
import "fmt"
+import "os"
func main() {
s := "hello";
- if s[1] != 'e' { sys.Exit(1) }
+ if s[1] != 'e' { os.Exit(1) }
s = "good bye";
var p *string = &s;
*p = "ciao";
y.tab.c: y.tab.h
test -f y.tab.c && touch y.tab.c
-builtin.c: sys.go unsafe.go mkbuiltin1.c mkbuiltin
+builtin.c: sys.go unsafe.go runtime.go mkbuiltin1.c mkbuiltin
./mkbuiltin >builtin.c || \
(echo 'mkbuiltin failed; using bootstrap copy of builtin.c'; cp builtin.c.boot builtin.c)
"func sys.arrayslices (old *any, nel int, lb int, hb int, width int) (ary []any)\n"
"func sys.arrays2d (old *any, nel int) (ary []any)\n"
"func sys.closure ()\n"
- "func sys.Breakpoint ()\n"
- "var sys.Args []string\n"
- "var sys.Envs []string\n"
- "func sys.Gosched ()\n"
- "func sys.Goexit ()\n"
- "func sys.Exit (? int)\n"
- "func sys.Caller (n int) (pc uint64, file string, line int, ok bool)\n"
"\n"
"$$\n";
char *unsafeimport =
"func unsafe.Unreflect (? uint64, ? string, ? bool) (ret interface { })\n"
"\n"
"$$\n";
+char *runtimeimport =
+ "package runtime\n"
+ "func runtime.Breakpoint ()\n"
+ "func runtime.Gosched ()\n"
+ "func runtime.Goexit ()\n"
+ "func runtime.Caller (n int) (pc uint64, file string, line int, ok bool)\n"
+ "\n"
+ "$$\n";
EXTERN int tptr; // either TPTR32 or TPTR64
extern char* sysimport;
extern char* unsafeimport;
+extern char* runtimeimport;
EXTERN char* filename; // name to uniqify names
EXTERN Idir* idirs;
cannedimports("unsafe.6", unsafeimport);
return;
}
+ if(strcmp(f->u.sval->s, "runtime") == 0) {
+ cannedimports("runtime.6", runtimeimport);
+ return;
+ }
if(!findpkg(f->u.sval))
fatal("can't find import: %Z", f->u.sval);
set -e
gcc -o mkbuiltin1 mkbuiltin1.c
-6g sys.go
-6g unsafe.go
rm -f _builtin.c
-./mkbuiltin1 sys >_builtin.c
-./mkbuiltin1 unsafe >>_builtin.c
+for i in sys unsafe runtime
+do
+ 6g $i.go
+ ./mkbuiltin1 $i >>_builtin.c
+done
# If _builtin.c has changed vs builtin.c.boot,
# check in the new change if being run by
--- /dev/null
+// 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.
+
+package PACKAGE
+func Breakpoint();
+func Gosched();
+func Goexit();
+func Caller(n int) (pc uint64, file string, line int, ok bool);
func arrays2d(old *any, nel int) (ary []any);
func closure(); // has args, but compiler fills in
-
-// used by go programs
-
-func Breakpoint();
-
-var Args []string;
-var Envs []string;
-
-func Gosched();
-func Goexit();
-
-func Exit(int);
-
-func Caller(n int) (pc uint64, file string, line int, ok bool);
// TODO(rsc): Build a binary from package main?
z := new(Info);
- z.Args = sys.Args;
+ z.Args = os.Args;
z.Dir = PkgDir();
z.Char = theChar; // for template
z.ObjDir = ObjDir; // for template
func fatal(args ...) {
fmt.Fprintf(os.Stderr, "gobuild: %s\n", fmt.Sprint(args));
- sys.Exit(1);
+ os.Exit(1);
}
func init() {
}
// Usage prints to standard error a default usage message documenting all defined flags and
-// then calls sys.Exit(1).
+// then calls os.Exit(1).
func Usage() {
- if len(sys.Args) > 0 {
- fmt.Fprintln(os.Stderr, "Usage of", sys.Args[0] + ":");
+ if len(os.Args) > 0 {
+ fmt.Fprintln(os.Stderr, "Usage of", os.Args[0] + ":");
} else {
fmt.Fprintln(os.Stderr, "Usage:");
}
PrintDefaults();
- sys.Exit(1);
+ os.Exit(1);
}
func NFlag() int {
// after flags have been processed.
func Arg(i int) string {
i += flags.first_arg;
- if i < 0 || i >= len(sys.Args) {
+ if i < 0 || i >= len(os.Args) {
return "";
}
- return sys.Args[i]
+ return os.Args[i]
}
// NArg is the number of arguments remaining after flags have been processed.
func NArg() int {
- return len(sys.Args) - flags.first_arg
+ return len(os.Args) - flags.first_arg
}
// Args returns the non-flag command-line arguments.
func Args() []string {
- return sys.Args[flags.first_arg:len(sys.Args)];
+ return os.Args[flags.first_arg:len(os.Args)];
}
func add(name string, value FlagValue, usage string) {
func (f *allFlags) parseOne(index int) (ok bool, next int)
{
- s := sys.Args[index];
+ s := os.Args[index];
f.first_arg = index; // until proven otherwise
if len(s) == 0 {
return false, -1
}
} else {
// It must have a value, which might be the next argument.
- if !has_value && index < len(sys.Args)-1 {
+ if !has_value && index < len(os.Args)-1 {
// value is the next arg
has_value = true;
index++;
- value = sys.Args[index];
+ value = os.Args[index];
}
if !has_value {
print("flag needs an argument: -", name, "\n");
// Parse parses the command-line flags. Must be called after all flags are defined
// and before any are accessed by the program.
func Parse() {
- for i := 1; i < len(sys.Args); {
+ for i := 1; i < len(os.Args); {
ok, next := flags.parseOne(i);
if next > 0 {
flags.first_arg = next;
// simple argument server
func ArgServer(c *http.Conn, req *http.Request) {
- for i, s := range sys.Args {
+ for i, s := range os.Args {
fmt.Fprint(c, s, " ");
}
}
import (
"fmt";
"io";
+ "runtime";
"os";
"time";
)
}
}
if l.flag & (Lshortfile | Llongfile) != 0 {
- pc, file, line, ok := sys.Caller(calldepth);
+ pc, file, line, ok := runtime.Caller(calldepth);
if ok {
if l.flag & Lshortfile != 0 {
short, ok := shortnames[file];
case Lcrash:
panic("log: fatal error");
case Lexit:
- sys.Exit(1);
+ os.Exit(1);
}
}
stderr.Output(2, fmt.Sprintf(format, v))
}
-// Exit is equivalent to Stderr() followed by a call to sys.Exit(1).
+// Exit is equivalent to Stderr() followed by a call to os.Exit(1).
func Exit(v ...) {
exit.Output(2, fmt.Sprintln(v))
}
-// Exitf is equivalent to Stderrf() followed by a call to sys.Exit(1).
+// Exitf is equivalent to Stderrf() followed by a call to os.Exit(1).
func Exitf(format string, v ...) {
exit.Output(2, fmt.Sprintf(format, v))
}
# license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild.
-# gobuild -m dir_${GOARCH}_${GOOS}.go env.go error.go file.go stat_${GOARCH}_${GOOS}.go time.go types.go exec.go >Makefile
+# gobuild -m dir_${GOARCH}_${GOOS}.go env.go error.go file.go proc.go stat_${GOARCH}_${GOOS}.go time.go types.go exec.go >Makefile
D=
O1=\
error.$O\
+ proc.$O\
types.$O\
O2=\
_obj$D/os.a: phases
a1: $(O1)
- $(AR) grc _obj$D/os.a error.$O types.$O
+ $(AR) grc _obj$D/os.a error.$O proc.$O types.$O
rm -f $(O1)
a2: $(O2)
func copyenv() {
env = make(map[string] string);
- for i, s := range sys.Envs {
+ for i, s := range os.Envs {
for j := 0; j < len(s); j++ {
if s[j] == '=' {
env[s[0:j]] = s[j+1:len(s)];
if e == syscall.EPIPE {
file.nepipe++;
if file.nepipe >= 10 {
- sys.Exit(syscall.EPIPE);
+ os.Exit(syscall.EPIPE);
}
} else {
file.nepipe = 0;
import (
"container/vector";
"os";
+ "runtime";
"utf8";
)
func (re *Regexp) setError(err os.Error) {
re.error = err;
re.ch <- re;
- sys.Goexit();
+ runtime.Goexit();
}
func (re *Regexp) add(i instr) instr {
first looked for in the cursor, as in .section and .repeated.
If it is not found, the search continues in outer sections
until the top level is reached.
-
+
If a formatter is specified, it must be named in the formatter
map passed to the template set up routines or in the default
set ("html","str","") and is used to process the data for
"io";
"os";
"reflect";
+ "runtime";
"strings";
"template";
"container/vector";
// Generic error handler, called only from execError or parseError.
func error(errors chan os.Error, line int, err string, args ...) {
errors <- ParseError{fmt.Sprintf("line %d: %s", line, fmt.Sprintf(err, args))};
- sys.Goexit();
+ runtime.Goexit();
}
// Report error and stop executing. The line number must be provided explicitly.
import (
"flag";
"fmt";
+ "os";
+ "runtime";
)
// Report as tests are run; default is silent for success.
func (t *T) FailNow() {
t.Fail();
t.ch <- t;
- sys.Goexit();
+ runtime.Goexit();
}
// Log formats its arguments using default formatting, analogous to Print(),
}
if !ok {
println("FAIL");
- sys.Exit(1);
+ os.Exit(1);
}
println("PASS");
}
CALL initdone(SB)
CALL main·main(SB)
PUSHL $0
- CALL sys·Exit(SB)
+ CALL exit(SB)
POPL AX
INT $3
RET
-TEXT sys·Breakpoint(SB),7,$0
+TEXT breakpoint(SB),7,$0
BYTE $0xcc
RET
// func caller(n int) (pc uint64, file string, line int, ok bool)
void
-sys·Caller(int32 n, uint64 retpc, string retfile, int32 retline, bool retbool)
+runtime·Caller(int32 n, uint64 retpc, string retfile, int32 retline, bool retbool)
{
uint64 pc;
byte *sp;
CALL initdone(SB)
CALL main·main(SB)
PUSHQ $0
- CALL sys·Exit(SB)
+ CALL exit(SB)
POPQ AX
CALL notok(SB)
RET
-TEXT sys·Breakpoint(SB),7,$0
+TEXT breakpoint(SB),7,$0
BYTE $0xcc
RET
// func caller(n int) (pc uint64, file string, line int, ok bool)
void
-sys·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbool)
+runtime·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbool)
{
uint64 pc;
byte *sp;
g->status = Gwaiting;
enqueue(&c->sendq, sg);
unlock(&chanlock);
- sys·Gosched();
+ gosched();
lock(&chanlock);
sg = g->param;
g->status = Gwaiting;
enqueue(&c->sendq, sg);
unlock(&chanlock);
- sys·Gosched();
+ gosched();
lock(&chanlock);
goto asynch;
g->status = Gwaiting;
enqueue(&c->recvq, sg);
unlock(&chanlock);
- sys·Gosched();
+ gosched();
lock(&chanlock);
sg = g->param;
g->status = Gwaiting;
enqueue(&c->recvq, sg);
unlock(&chanlock);
- sys·Gosched();
+ gosched();
lock(&chanlock);
goto asynch;
g->param = nil;
g->status = Gwaiting;
unlock(&chanlock);
- sys·Gosched();
+ gosched();
lock(&chanlock);
sg = g->param;
Regs *r;
if(panicking) // traceback already printed
- sys_Exit(2);
+ exit(2);
panicking = 1;
if(sig < 0 || sig >= NSIG){
dumpregs(r);
}
- sys·Breakpoint();
- sys_Exit(2);
+ breakpoint();
+ exit(2);
}
void
RET
// Exit the entire program (like C exit)
-TEXT sys·Exit(SB),7,$0
+TEXT exit(SB),7,$0
MOVL $1, AX
INT $0x80
CALL notok(SB)
Regs *r;
if(panicking) // traceback already printed
- sys_Exit(2);
+ exit(2);
panicking = 1;
if(sig < 0 || sig >= NSIG){
dumpregs(r);
}
- sys·Breakpoint();
- sys_Exit(2);
+ breakpoint();
+ exit(2);
}
void
//
// Exit the entire program (like C exit)
-TEXT sys·Exit(SB),7,$-8
+TEXT exit(SB),7,$-8
MOVL 8(SP), DI // arg 1 exit status
MOVL $(0x2000000+1), AX // syscall entry
SYSCALL
Sigcontext *sc;
if(panicking) // traceback already printed
- sys_Exit(2);
+ exit(2);
panicking = 1;
uc = context;
dumpregs(sc);
}
- sys·Breakpoint();
- sys_Exit(2);
+ breakpoint();
+ exit(2);
}
void
INT $3 // not reached
RET
-TEXT sys·Exit(SB),7,$0
+TEXT exit(SB),7,$0
MOVL $252, AX // syscall number
MOVL 4(SP), BX
INT $0x80
Sigcontext *sc;
if(panicking) // traceback already printed
- sys_Exit(2);
+ exit(2);
panicking = 1;
uc = context;
dumpregs(sc);
}
- sys·Breakpoint();
- sys_Exit(2);
+ breakpoint();
+ exit(2);
}
void
// System calls and other sys.stuff for AMD64, Linux
//
-TEXT sys·Exit(SB),7,$0-8
+TEXT exit(SB),7,$0-8
MOVL 8(SP), DI
MOVL $231, AX // exitgroup - force all os threads to exi
SYSCALL
}
void
-sys·Goexit(void)
+goexit(void)
{
if(debug > 1){
lock(&debuglock);
unlock(&debuglock);
}
g->status = Gmoribund;
- sys·Gosched();
+ gosched();
}
void
case Gmoribund:
gp->status = Gdead;
if(--sched.gcount == 0)
- sys_Exit(0);
+ exit(0);
break;
}
if(gp->readyonstop){
// before running g again. If g->status is Gmoribund,
// kills off g.
void
-sys·Gosched(void)
+gosched(void)
{
if(g == m->g0)
throw("gosched of g0");
// The scheduler will ready g and put this m to sleep.
// When the scheduler takes g awa from m,
// it will undo the sched.mcpu++ above.
- sys·Gosched();
+ gosched();
}
/*
mcpy(sp, (byte*)&arg0, siz);
sp -= sizeof(uintptr);
- *(byte**)sp = (byte*)sys·Goexit;
+ *(byte**)sp = (byte*)goexit;
sp -= sizeof(uintptr); // retpc used by gogo
newg->sched.SP = sp;
jmpdefer(sp);
}
+void
+runtime·Breakpoint(void)
+{
+ breakpoint();
+}
+
+void
+runtime·Goexit(void)
+{
+ goexit();
+}
+
+void
+runtime·Gosched(void)
+{
+ gosched();
+}
+
if(panicking) {
printf("double panic\n");
- sys_Exit(3);
+ exit(3);
}
panicking++;
traceback(sys·getcallerpc(&lno), sp, g);
tracebackothers(g);
}
- sys·Breakpoint(); // so we can grab it in a debugger
- sys_Exit(2);
+ breakpoint(); // so we can grab it in a debugger
+ exit(2);
}
void
printf("throw: %s\n", s);
sys·panicl(-1);
*(int32*)0 = 0; // not reached
- sys_Exit(1); // even more not reached
+ exit(1); // even more not reached
}
void
static int32 argc;
static uint8** argv;
-Array sys·Args;
-Array sys·Envs;
+Array os·Args;
+Array os·Envs;
void
args(int32 c, uint8 **v)
for(i=0; i<argc; i++)
gargv[i] = gostring(argv[i]);
- sys·Args.array = (byte*)gargv;
- sys·Args.nel = argc;
- sys·Args.cap = argc;
+ os·Args.array = (byte*)gargv;
+ os·Args.nel = argc;
+ os·Args.cap = argc;
for(i=0; i<envc; i++)
genvv[i] = gostring(argv[argc+1+i]);
- sys·Envs.array = (byte*)genvv;
- sys·Envs.nel = envc;
- sys·Envs.cap = envc;
+ os·Envs.array = (byte*)genvv;
+ os·Envs.nel = envc;
+ os·Envs.cap = envc;
}
byte*
bs = (byte*)s;
len = findnull(bs);
- envv = (String*)sys·Envs.array;
- envc = sys·Envs.nel;
+ envv = (String*)os·Envs.array;
+ envc = os·Envs.nel;
for(i=0; i<envc; i++){
if(envv[i].len <= len)
continue;
void* malloc(uintptr size);
void* mallocgc(uintptr size);
void free(void *v);
+void exit(int32);
+void breakpoint(void);
+void gosched(void);
+void goexit(void);
#pragma varargck argpos printf 1
* UTF-8 characters in identifiers.
*/
#ifndef __GNUC__
-#define sys_Exit sys·Exit
-#define sys_Gosched sys·Gosched
#define sys_memclr sys·memclr
#define sys_write sys·write
-#define sys_Breakpoint sys·Breakpoint
#define sys_catstring sys·catstring
#define sys_cmpstring sys·cmpstring
#define sys_getcallerpc sys·getcallerpc
-#define sys_Goexit sys·Goexit
#define sys_indexstring sys·indexstring
#define sys_intstring sys·intstring
#define sys_mal sys·mal
/*
* low level go-called
*/
-void sys_Goexit(void);
-void sys_Gosched(void);
-void sys_Exit(int32);
void sys_write(int32, void*, int32);
-void sys_Breakpoint(void);
uint8* sys_mmap(byte*, uint32, int32, int32, int32, uint32);
void sys_memclr(byte*, uint32);
void sys_setcallerpc(void*, void*);
{
USED(s);
g->status = Gwaiting;
- sys·Gosched();
+ gosched();
}
static int32
void
sys·stringiter2(String s, int32 k, int32 retk, int32 retv)
{
- int32 l;
-
if(k >= s.len) {
// retk=0 is end of iteration
retk = 0;
package main
+import "os"
+
type T chan uint64;
func M(f uint64) (in, out T) {
x = min(xs);
if x != OUT[i] { panic("bad: ", x, " should be ", OUT[i]); }
}
- sys.Exit(0);
+ os.Exit(0);
}
package main
+import "os"
+
func main() {
- if len(sys.Args) != 3 {
+ if len(os.Args) != 3 {
panic("argc")
}
- if sys.Args[1] != "arg1" {
+ if os.Args[1] != "arg1" {
panic("arg1")
}
- if sys.Args[2] != "arg2" {
+ if os.Args[2] != "arg2" {
panic("arg2")
}
}
package main
+import "os"
+
const N = 10
func AsynchFifo() {
for i := 0; i < N; i++ {
if <-ch != i {
print("bad receive\n");
- sys.Exit(1);
+ os.Exit(1);
}
}
}
func main() {
var n = 10000;
- if len(sys.Args) > 1 {
+ if len(os.Args) > 1 {
var err os.Error;
- n, err = strconv.Atoi(sys.Args[1]);
+ n, err = strconv.Atoi(os.Args[1]);
if err != nil {
print("bad arg\n");
- sys.Exit(1);
+ os.Exit(1);
}
}
leftmost := make(chan int);
package main
+import "runtime"
import "time"
func i32receiver(c chan int32, strobe chan bool) {
func sleep() {
<-ticker;
<-ticker;
- sys.Gosched();
- sys.Gosched();
- sys.Gosched();
+ runtime.Gosched();
+ runtime.Gosched();
+ runtime.Gosched();
}
func main() {
package main
+import "os"
+
type rat struct {
num, den int64; // numerator, denominator
}
func main() {
Init();
- if len(sys.Args) > 1 { // print
+ if len(os.Args) > 1 { // print
print("Ones: "); printn(Ones, 10);
print("Twos: "); printn(Twos, 10);
print("Add: "); printn(Add(Ones, Twos), 10);
package main
+import "os"
+
type rat struct {
num, den int64; // numerator, denominator
}
func main() {
Init();
- if len(sys.Args) > 1 { // print
+ if len(os.Args) > 1 { // print
print("Ones: "); Printn(Ones, 10);
print("Twos: "); Printn(Twos, 10);
print("Add: "); Printn(Add(Ones, Twos), 10);
package main
+import "os"
+
// Send the sequence 2, 3, 4, ... to channel 'ch'.
func Generate(ch chan<- int) {
for i := 2; ; i++ {
for i := 0; i < len(a); i++ {
if x := <-primes; x != a[i] { panic(x, " != ", a[i]) }
}
- sys.Exit(0);
+ os.Exit(0);
}
package main
+import "os"
+
func main() {
var i uint64 =
' ' +
;
if '\Ucafebabe' != 0xcafebabe {
print("cafebabe wrong\n");
- sys.Exit(1)
+ os.Exit(1)
}
if i != 0xcc238de1 {
print("number is ", i, " should be ", 0xcc238de1, "\n");
- sys.Exit(1)
+ os.Exit(1)
}
}
ga, e0 := os.Getenv("GOARCH");
if e0 != nil {
print("$GOARCH: ", e0.String(), "\n");
- sys.Exit(1);
+ os.Exit(1);
}
if ga != "amd64" {
print("$GOARCH=", ga, "\n");
- sys.Exit(1);
+ os.Exit(1);
}
xxx, e1 := os.Getenv("DOES_NOT_EXIST");
if e1 != os.ENOENV {
print("$DOES_NOT_EXIST=", xxx, "; err = ", e1.String(), "\n");
- sys.Exit(1);
+ os.Exit(1);
}
}
package main
+import "os"
+
const (
x float = iota;
g float = 4.5 * iota;
func main() {
if g == 0.0 { print("zero\n");}
- if g != 4.5 { print(" fail\n"); sys.Exit(1); }
+ if g != 4.5 { print(" fail\n"); os.Exit(1); }
}
package main
+import "os"
+
func P(a []string) string {
s := "{";
for i := 0; i < 2; i++ {
a[0] = "x";
m["0"][0] = "deleted";
if m["0"][0] != "deleted" {
- sys.Exit(1);
+ os.Exit(1);
}
}
package main
+import "os"
+
func main() {
m := make(map[int]int);
m[0] = 0;
m[0]++;
if m[0] != 1 {
print("map does not increment\n");
- sys.Exit(1)
+ os.Exit(1)
}
}
package main
+import "os"
import "strconv";
type Test struct {
}
}
if !ok {
- sys.Exit(1);
+ os.Exit(1);
}
}
package main
+import "os"
+
type I interface { send(chan <- int) }
type S struct { v int }
var i I = &s;
c := make(chan int);
go i.send(c);
- sys.Exit(<-c);
+ os.Exit(<-c);
}
package main
+import "os"
+
type S struct { i int }
func (p *S) Get() int { return p.i }
func f1(p Empty) {
switch x := p.(type) {
- default: println("failed to match interface"); sys.Exit(1);
+ default: println("failed to match interface"); os.Exit(1);
case Getter: break;
}
package main
+import "os"
+
func main() {
count := 7;
if one := 1; {
}
if count != 8 {
print(count, " should be 8\n");
- sys.Exit(1)
+ os.Exit(1)
}
}
package main
+import "os"
+
func main() {
s :=
0 +
0X123;
if s != 788 {
print("s is ", s, "; should be 788\n");
- sys.Exit(1);
+ os.Exit(1);
}
}
package main
+import "os"
+
const Value = 1e12
type Inter interface { M() int64 }
if !ok {
println("BUG: interface10");
- sys.Exit(1)
+ os.Exit(1)
}
}
package main
+import "os"
+
type I interface { M() int64 }
type BigPtr struct { a, b, c, d int64 }
nonptrs();
if bad {
- sys.Exit(1)
+ os.Exit(1)
}
}
package main
+import "os"
+
var fail int
func check(b bool, msg string) {
f11();
f12();
if fail > 0 {
- sys.Exit(1)
+ os.Exit(1)
}
}
package main
+import "os"
+import "runtime"
var randx int;
nproc++; // total goroutines running
for {
for r:=nrand(10); r>=0; r-- {
- sys.Gosched();
+ runtime.Gosched();
}
c.sc <- c.sv;
if c.send() {
nproc++; // total goroutines running
for {
for r:=nrand(10); r>=0; r-- {
- sys.Gosched();
+ runtime.Gosched();
}
v = <-c.rc;
if c.recv(v) {
for {
for r:=nrand(5); r>=0; r-- {
- sys.Gosched();
+ runtime.Gosched();
}
select {
func
wait()
{
- sys.Gosched();
+ runtime.Gosched();
for nproc != 0 {
- sys.Gosched();
+ runtime.Gosched();
}
}
if tots != t || totr != t {
print("tots=", tots, " totr=", totr, " sb=", t, "\n");
- sys.Exit(1);
+ os.Exit(1);
}
- sys.Exit(0);
+ os.Exit(0);
}
package main
+import "runtime"
+
const N = 1000; // sent messages
const M = 10; // receiving goroutines
const W = 2; // channel buffering
c := make(chan int, W);
for m:=0; m<M; m++ {
go r(c, m);
- sys.Gosched();
+ runtime.Gosched();
}
- sys.Gosched();
- sys.Gosched();
+ runtime.Gosched();
+ runtime.Gosched();
s(c);
}
package main
+import "os"
+
var ecode int;
func assert(a, b, c string) {
r = 0x10ffff + 1;
s = string(r);
assert(s, "\xef\xbf\xbd", "too-large rune");
- sys.Exit(ecode);
+ os.Exit(ecode);
}
import(
"fmt";
+ "os";
"utf8";
)
if !ok {
fmt.Println("BUG: stringrange");
- sys.Exit(1)
+ os.Exit(1)
}
}
package main
+import "os"
+
func main() {
i := 0;
switch x := 5; {
case i < x:
- sys.Exit(0);
+ os.Exit(0);
case i == x:
case i > x:
- sys.Exit(1);
+ os.Exit(1);
}
}
package main
+import "os"
+
const (
Bool = iota;
Int;
func assert(b bool, s string) {
if !b {
println(s);
- sys.Exit(1);
+ os.Exit(1);
}
}
return info;
}
}
-
+
info.Packages = paks;
if cname == "." {
info.Path = "";
" godoc -http=:6060\n"
);
flag.PrintDefaults();
- sys.Exit(1);
+ os.Exit(1);
}
if err != nil {
log.Stderrf("packagelistText.Execute: %s", err);
}
- sys.Exit(1);
+ os.Exit(1);
}
doc, errors := info.Package.Doc();
if err != nil {
log.Stderrf("parseerrorText.Execute: %s", err);
}
- sys.Exit(1);
+ os.Exit(1);
}
if flag.NArg() > 1 {
func usage() {
fmt.Fprintf(os.Stderr, "usage: pretty { flags } { files }\n");
flag.PrintDefaults();
- sys.Exit(1);
+ os.Exit(1);
}
src, err := readFile(ast_txt);
if err != nil {
fmt.Fprintf(os.Stderr, "%s: %v\n", ast_txt, err);
- sys.Exit(1);
+ os.Exit(1);
}
ast_format, err := format.Parse(src, format.FormatterMap{"isValidPos": isValidPos, "isSend": isSend, "isRecv": isRecv});
if err != nil {
fmt.Fprintf(os.Stderr, "%s: format errors:\n%s", ast_txt, err);
- sys.Exit(1);
+ os.Exit(1);
}
// process files
prog, ok := parser.Parse(src, &ErrorHandler{filename, 0}, mode);
if !ok {
exitcode = 1;
- continue; // proceed with next file
+ continue; // proceed with next file
}
if !*silent {
tw.Flush();
}
}
-
- sys.Exit(exitcode);
+
+ os.Exit(exitcode);
}
func error(format string, params ...) {
fmt.Printf(format, params);
- sys.Exit(1);
+ os.Exit(1);
}