code
stringlengths
10
1.34M
language
stringclasses
1 value
// 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 main import ( "bytes"; "ebnf"; "flag"; "fmt"; "go/scanner"; "io"; "os"; "path"; "strings"; ) var start = flag.String("start", "Start", "name...
Go
// 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. /* Ebnflint verifies that EBNF productions are consistent and gramatically correct. It reads them from an HTML document such as the Go specification. Grammar ...
Go
/* Derived from Inferno's utils/iyacc/yacc.c http://code.google.com/p/inferno-os/source/browse/utils/iyacc/yacc.c This copyright NOTICE applies to all files in this directory and subdirectories, unless another copyright notice appears in a given file or subdirectory. If you take substantial code from this software to...
Go
// 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. /* Goyacc is a version of yacc for Go. It is written in Go and generates parsers written in Go. It is largely transliterated from the Inferno version written ...
Go
// 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. /* This directory contains the portable section of the Plan 9 C compilers. See ../6c, ../8c, and ../5c for more information. */ package documentation
Go
// 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. /* 6c is a version of the Plan 9 C compiler. The original is documented at http://plan9.bell-labs.com/magic/man2html/1/2c Its target architecture is the x8...
Go
// 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 type Pointer *any func Offsetof(any) int func Sizeof(any) int func Alignof(any) int func Typeof(i interface{}) (typ interface{}) func Reflect(...
Go
// 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 // emitted by compiler, not referred to by go programs func mal(int32) *any func throwindex() func throwreturn() func throwinit() func panicl(...
Go
// 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. /* Gc is the generic label for the family of Go compilers that function as part of the (modified) Plan 9 tool chain. The C compiler documentation at http://...
Go
// 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. /* 5c is a version of the Plan 9 C compiler. The original is documented at http://plan9.bell-labs.com/magic/man2html/1/2c Its target architecture is the AR...
Go
// 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. /* Gotest is an automated testing tool for Go packages. Normally a Go package is compiled without its test files. Gotest is a simple script that recompiles t...
Go
// 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. /* 8c is a version of the Plan 9 C compiler. The original is documented at http://plan9.bell-labs.com/magic/man2html/1/2c Its target architecture is the x8...
Go
// 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 main import ( "bytes"; "flag"; "fmt"; "go/parser"; "go/printer"; "go/scanner"; "io"; "os"; pathutil "path"; "strings"; ) var ( // main ope...
Go
// 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. /* Gofmt formats Go programs. Without an explicit path, it processes the standard input. Given a file, it operates on that file; given a directory, it operat...
Go
// 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. /* 8a is a version of the Plan 9 assembler. The original is documented at http://plan9.bell-labs.com/magic/man2html/1/2a Its target architecture is the x86...
Go
// 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. /* Prof is a rudimentary real-time profiler. Given a command to run or the process id (pid) of a command already running, it samples the program's state at re...
Go
// 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. /* Cov is a rudimentary code coverage tool. Given a command to run, it runs the command while tracking which sections of code have been executed. When the co...
Go
// 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. /* 5g is the version of the gc compiler for the ARM. The $GOARCH for these tools is arm. It reads .go files and outputs .5 files. The flags are documented in ...
Go
// 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. /* Nm is a version of the Plan 9 nm command. The original is documented at http://plan9.bell-labs.com/magic/man2html/1/nm It prints the name list (symbol t...
Go
// 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. /* 6g is the version of the gc compiler for the x86-64. The $GOARCH for these tools is amd64. It reads .go files and outputs .6 files. The flags are documente...
Go
// 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. // Process plain text into HTML. // - h2's are made from lines followed by a line "----\n" // - tab-indented blocks become <pre> blocks // - blank lines become ...
Go
// 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 main import "fmt" // Send the sequence 2, 3, 4, ... to returned channel func generate() chan int { ch := make(chan int); go func(){ for i := 2; ;...
Go
// 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 main import ( "./file"; "flag"; "fmt"; "os"; ) func cat(f *file.File) { const NBUF = 512; var buf [NBUF]byte; for { switch nr, er := f.Read(&...
Go
// 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 main import "fmt" func main() { var u64 uint64 = 1<<64-1; fmt.Printf("%d %d\n", u64, int64(u64)); // harder stuff type T struct { a int; b string...
Go
// 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 main import "fmt" type testType struct { a int; b string } func (t *testType) String() string { return fmt.Sprint(t.a) + " " + t.b } func main() { ...
Go
// 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 main import "fmt" import "os" func main() { s := "hello"; if s[1] != 'e' { os.Exit(1) } s = "good bye"; var p *string = &s; *p = "ciao"; }
Go
// 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 main import "fmt" // Send the sequence 2, 3, 4, ... to channel 'ch'. func generate(ch chan int) { for i := 2; ; i++ { ch <- i // Send 'i' to chann...
Go
// 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 main import ( "./file"; "fmt"; "os"; ) func main() { hello := []byte{'h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '\n'}; file.Stdo...
Go
// 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 file import ( "os"; "syscall"; ) type File struct { fd int; // file descriptor number name string; // file name at Open time } func ne...
Go
// 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 main import ( "os"; "flag"; // command line option parser ) var omitNewline = flag.Bool("n", false, "don't print final newline") const ( Space = ...
Go
// 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 main import "fmt" type request struct { a, b int; replyc chan int; } type binOp func(a, b int) int func run(op binOp, req *request) { reply :...
Go
// 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 main import ( "./file"; "flag"; "fmt"; "os"; ) var rot13Flag = flag.Bool("rot13", false, "rot13 the input") func rot13(b byte) byte { if 'a' <= ...
Go
// 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 main import ( "fmt"; "sort"; ) func ints() { data := []int{74, 59, 238, -784, 9845, 959, 905, 0, 0, 42, 7586, -5467984, 7586}; a := sort.IntArray(...
Go
// 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 main import "fmt" type request struct { a, b int; replyc chan int; } type binOp func(a, b int) int func run(op binOp, req *request) { reply := op...
Go
// 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 main import "fmt" func sum(a []int) int { // returns an int s := 0; for i := 0; i < len(a); i++ { s += a[i] } return s } func main() { s :=...
Go
// 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 main import fmt "fmt" // Package implementing formatted I/O. func main() { fmt.Printf("Hello, world; or Καλημέρα κόσμε; or こんにちは 世界\n"); }
Go
// 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 sort type Interface interface { Len() int; Less(i, j int) bool; Swap(i, j int); } func Sort(data Interface) { for i := 1; i < data.Len(); i++ { ...
Go
// $G $D/$F.go // 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 P import ( ) const ( ) var ( ) type ( )
Go
// $G $F.go && $L $F.$A && ./$A.out // 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 main import ( "fmt"; "os"; "utf8"; ) func main() { s := "\000\123\x00\xca\xFE\u0123\ubabe\U0000babe\U0010FFFF...
Go
// errchk $G $D/$F.go // 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 main type T struct { } func (t *T) M(int, string); // GCCGO_ERROR "previous" func (t *T) M(int, float) { } // ERROR "redeclare...
Go
// $G $F.go && $L $F.$A && ./$A.out // 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 main func assertequal(is, shouldbe int, msg string) { if is != shouldbe { print("assertion fail", msg, "\n"); ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: compos // 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 main type T struct { int; } func f() *T { return &T{1} } func main() { x := f(); y :...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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. // Check that static interface conversion of // interface value nil succeeds. package main type R interface { R(); } t...
Go
// $G $D/$F.go || echo BUG: should compile // 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. // Check mutually recursive interfaces package main type I1 interface { foo() I2 } type I2 interface { bar() I1...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG interface6 // 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. // Interface values containing structures. package main import "os" var fail int func check(b...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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. // Interface comparisons using types hidden // inside reflected-on structs. package main import "reflect" type T stru...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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. // Check uses of all the different interface // conversion runtime functions. package main type Stringer interface { S...
Go
// errchk $G $D/$F.go // 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. // Check that interface{M()} = *interface{M()} produces a compiler error. package main type Inst interface { Next() *Inst; } type Reg...
Go
// errchk $G $D/$F.go // 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. // Static error messages about interface conversions. package main type T struct { a int } var t *T type I interface { M() } var i I ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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. // Check methods derived from embedded interface and *interface values. package main import "os" const Value = 1e12 ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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. // Check that static interface conversion of // interface value nil succeeds. package main type R interface { R(); } t...
Go
// errchk $G $D/$F.go // 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. // Error messages about missing implicit methods. package main type T int func (t T) V() func (t *T) P() type V interface { V() } type...
Go
// $G $D/$F.go && $L $F.$A && ! ./$A.out // 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. // Check that interface conversion fails when method is missing. package main type I interface { Foo() } func main...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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. // Implicit methods for embedded types. // Mixed pointer and non-pointer receivers. package main type T int var nv, np...
Go
// $G $D/embed0.go && $G $D/$F.go && $L $F.$A && ./$A.out // 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. // Check that embedded interface types can have local methods. package main import "./embed0" type...
Go
// $G $D/$F.go && $L $F.$A && (! ./$A.out || echo BUG: should not succeed) // 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. // Check methods with different return types. package main type S struct { a int }...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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. // check that big vs small, pointer vs not // interface methods work. package main type I interface { M() int64 } typ...
Go
// true # used by embed1.go // 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. // Check that embedded interface types can have local methods. package p type T int func (t T) m() {} type I interface { m() } t...
Go
// errchk $G -e $D/$F.go // 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 main func main() { var n byte; // ERROR "not a type|expected type" var y = float(0); // ERROR "cannot call|expected functi...
Go
// $G $F.go && $L $F.$A && ./$A.out // 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 main import "malloc" func mk2() { b := new([10000]byte); _ = b; // println(b, "stored at", &b); } func mk1() {...
Go
// $G $F.go && $L $F.$A && ./$A.out // 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 main type T chan uint64; func M(f uint64) (in, out T) { in = make(T, 100); out = make(T, 100); go func(in, out...
Go
// $G $F.go && $L $F.$A && ./$A.out // 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 main import "os" var ecode int; func assert(a, b, c string) { if a != b { ecode = 1; print("FAIL: ", c, ": ...
Go
// $G $D/$F.go && $L $F.$A && ! ./$A.out // 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 main func use(bool) { } func main() { var a []int; var ia interface{} = a; use(ia == ia); }
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main // check for correct heap-moving of escaped variables. // it is hard to check for the allocations, but it ...
Go
// $G $F.go && $L $F.$A && ./$A.out // 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 main import "container/vector" type S struct { val int } func (p *S) Init(val int) *S { p.val = val; return...
Go
// errchk $G -e $F.go // 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. // Incorrect short declarations and redeclarations. package main func f1() int { return 1 } func f2() (float, int) { return 1, 2 } func...
Go
// $G $D/$F.go // 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 main func f(interface{}) func g() {} func main() { f(map[string]string{"a":"b","c":"d"}); f([...]int{1,2,3}); f(([...]int){1,2,3}); ...
Go
// $G $D/$F.go // 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 main type T struct { s string; } func main() { s := ""; l1 := len(s); var t T; l2 := len(t.s); // BUG: cannot take len() of a st...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main type T struct { i int } func main() { var ta []*T; ta = new([1]*T); ta[0] = nil; } /* bug045.go:13: ...
Go
// $G $D/$F.go && $L $F.$A || echo BUG: bug155 // 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 main const big uint64 = 1<<63 func f(a uint64) uint64 { return a << big } func main() { f(1) } /* ...
Go
// ! $G $D/$F.go // 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 main func main() { var i int = 100; i = i << -3; // BUG: should not compile (negative shift) } /* ixedbugs/bug016.go:7: overflow ...
Go
// errchk $G $D/$F.go // 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 main import "fmt" // GCCGO_ERROR "previous" var fmt int // ERROR "redecl|redefinition"
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main func main() { type T struct { s string; f float; }; var s string = "hello"; var f float = 0.2; t...
Go
// $G $D/$F.go || echo BUG: fails incorrectly // 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 main const s string = "foo"; func main() { i := len(s); // should be legal to take len() of a constan...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main type Type interface { TypeName() string; } type TInt struct { } // TInt func (i *TInt) TypeName() strin...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main func main() { var len int; // len should not be a keyword - this doesn't compile _ = len; }
Go
// $G $D/$F.go // 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 main const c = 0 ^ 0
Go
// errchk $G $D/$F.go // 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 main type T struct { f int; } var _ = T{f: 1} // 6g used to get confused by the f:1 above // and allow uses of f that would b...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main type T1 struct { x, y int; } type T2 struct { z, w byte; } type T3 T1 type MyInt int func (MyInt) m(*T1) ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main func Alloc(i int) int { switch i { default: return 5; case 1: return 1; case 10: return 10; } ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: should run // 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 main import "os" type S struct { i int } func (p *S) Get() int { return p.i } type Em...
Go
// $G $D/$F.go || echo BUG: bug156 // 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 main func f(a int64) int64 { const b int64 = 0; n := a &^ b; return n; } func main() { f(1) } /* bug156.go:7:...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main func g() { } func f1() (a, b int) { a, b = 2, 1; g(); // defeat optimizer return a, b; } func f2() (a...
Go
// $G $D/$F.go || echo BUG: bug150 // 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 main type T int func (t T) M() type M interface { M() } func g() (T, T) func f() (a, b M) { a, b = g(); retu...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main func f() { exit: } func main() { exit: // this should be legal (labels not properly scoped?) } /* uetl...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main func main() { L: for i := 0; i < 1; i++ { L1: for { break L; } panic("BUG: not reached - break")...
Go
// errchk $G $D/$F.go // 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. // RESOLUTION: This program is illegal. We should reject all unnecessary backslashes. package main const c = '\''; // this works cons...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main func frexp() (a int, b float64) { return 1, 2.0 } func main() { a, b := frexp(); _, _ = a, b; } /* bu...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG should run // 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 main func f() { v := [...]string{"a", "b"}; _ = v; } func main() { f(); }
Go
// 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 bug0 const A = -1
Go
// 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 bug1 import _ "./bug0"
Go
// $G $D/$F.go || echo BUG: should compile // 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 main type S struct { p *S; s []S; m map[int] S; c chan S; i interface { f(S); }; f func(S) S; } func...
Go
// $G $D/$F.go || echo BUG: fails incorrectly // 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 main func f1() (x int, y float) { return; } func f2 (x int, y float) { return; } func main() { ...
Go
// $G $D/$F.dir/bug0.go && $G $D/$F.dir/bug1.go || echo BUG: fails incorrectly // 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. ignored
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main var s [8]string func init() { s = [...]string{ "now", "is", "the", "time", "to", "fix", "this", "...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: should not fail // 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 main func foo(a []int) int { return a[0] // this seems to do the wrong thing } ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG should not crash // 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 main // Interface type I interface { F() int } // Implements interface type S str...
Go
// errchk $G $D/$F.go // 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 main func f() /* no return type */ {} func main() { x := f(); // ERROR "mismatch|as value|no type" }
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 main func main() { c := 10; d := 7; var x [10]int; i := 0; /* this works: q := c/d; x[i] = q; */ // th...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: fails incorrectly // 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 main type S struct { } func (p *S) M() { print("M\n"); } type I interface { ...
Go