code stringlengths 10 1.34M | language stringclasses 1
value |
|---|---|
// 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.
// Test integer modulus by contstants.
package main
import "math/rand"
const Count = 1e5
func i64rand() int64 {
for {
a := int64(rand.Uint32())
... | Go |
// 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.
// Test slicing and re-slicing.
package main
var bx []byte
var by []byte
var fx []float64
var fy []float64
var lb, hb int
var t int
func main() {
/... | Go |
// 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.
// Test arrays and slices.
package main
func setpd(a []int) {
// print("setpd a=", a, " len=", len(a), " cap=", cap(a), "\n");
for i := 0; i < len(a... | Go |
// 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.
// Test simple operations on arrays.
package main
var b[10] float32;
func
main() {
var a[10] float32;
for i:=int16(5); i<10; i=i+1 {
a[i] = floa... | Go |
// 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.
// Test basic operations of slices and arrays.
package main
var bx [10]byte
var by []byte
var fx [10]float64
var fy []float64
var lb, hb int
var t int... | Go |
// 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.
// Test scoping of variables.
package main
var x,y int;
func
main() {
x = 15;
y = 20;
{
var x int;
x = 25;
y = 25;
_ = x;
}
x = x+y;
... | Go |
// 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.
// Test simple for loop.
package main
func
main() {
var t,i int;
for i=0; i<100; i=i+1 {
t = t+i;
}
if t != 50*99 { panic(t); }
}
| Go |
// 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.
// Test 'for range' on arrays, slices, and maps.
package main
const size = 16
var a [size]byte
var p []byte
var m map[int]byte
func f(k int) byte {
... | Go |
// 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.
// Test shift.
package main
var ians [18]int;
var uans [18]uint;
var pass string;
func
testi(i int, t1,t2,t3 int) {
n := ((t1*3) + t2)*2 + t3;
if i... | Go |
// run
// Copyright 2010 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.
// Test arithmetic on complex numbers, including multiplication and division.
package main
const (
R = 5
I = 6i
C1 = R + I // ADD(5,6)
C2 = R ... | Go |
// 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.
// Test integer division by constants.
package main
import "math/rand"
const Count = 1e5
func i64rand() int64 {
for {
a := int64(rand.Uint32())
... | Go |
// cmpout
// Copyright 2010 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.
// Test trivial, bootstrap-level complex numbers, including printing.
package main
const (
R = 5
I = 6i
C1 = R + I // ADD(5,6)
)
func doprint(... | Go |
// 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.
// Test simple switch.
package main
func main() {
r := ""
a := 3
for i := 0; i < 10; i = i + 1 {
switch i {
case 5:
r += "five"
case a, 7:... | Go |
// 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.
// Test pointers and the . (selector) operator on structs.
package main
type x2 struct { a,b,c int; d int; };
var g1 x2;
var g2 struct { a,b,c int; d ... | Go |
// 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.
// Test functions of many signatures.
package main
func assertequal(is, shouldbe int, msg string) {
if is != shouldbe {
print("assertion fail" + ms... | Go |
// run
// Copyright 2010 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.
// Test, near-exhaustive, of converting numbers between types.
// No complex numbers though.
package main
var i8 int8;
var u8 uint8;
var i16 int16;
va... | Go |
// 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.
// Test embedded fields of structs, including methods.
package main
type I interface {
test1() int
test2() int
test3() int
test4() int
test5() i... | Go |
// run
// Copyright 2010 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.
// Test compound types made of complex numbers.
package main
var a [12]complex128
var s []complex128
var c chan complex128
var f struct {
c complex12... | Go |
// 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.
// Test communication with multiple simultaneous goroutines.
package main
import "runtime"
const N = 1000 // sent messages
const M = 10 // receivin... | Go |
// run
// Copyright 2010 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.
// Test complex numbers,including fmt support.
// Used to crash.
package main
import "fmt"
const (
R = 5
I = 6i
C1 = R + I // ADD(5,6)
)
func wa... | Go |
// 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.
// Test communication operations including select.
package main
import "os"
import "runtime"
import "sync"
var randx int
func nrand(n int) int {
ra... | Go |
// 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.
// Test simple functions.
package main
func
main() {
var x int;
x = fun(10,20,30);
if x != 60 { panic(x); }
}
func
fun(ia,ib,ic int)int {
var o ... | Go |
// 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.
// Test goto and labels.
package main
func main() {
i := 0
if false {
goto gogoloop
}
if false {
goto gogoloop
}
if false {
goto gogoloop
... | Go |
// run
// Copyright 2010 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.
// Test simple arithmetic and assignment for complex numbers.
package main
const (
R = 5
I = 6i
C1 = R + I // ADD(5,6)
)
func main() {
var b boo... | Go |
// 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.
// Test basic operations on bool.
package main
type s struct {
a bool;
b bool;
}
func
main() {
var a,b bool;
a = true;
b = false;
if !a { pan... | Go |
// 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.
// Test general operation using a list implementation.
package main
type Item interface {
Print() string
}
type ListItem struct {
item Item
next *... | Go |
// 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.
// Test struct-valued variables (not pointers).
package main
type x2 struct { a,b,c int; d int; };
var g1 x2;
var g2 struct { a,b,c int; d x2; };
fun... | Go |
// 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.
// Test composite literals.
package main
type M map[int]int
type S struct{ a,b,c int };
type SS struct{ aa,bb,cc S };
type SA struct{ a,b,c [3]int };
... | Go |
// run
// Copyright 2010 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.
// Test composition, decomposition, and reflection on complex numbers.
package main
import "unsafe"
import "reflect"
const (
R = 5
I = 6i
C1 = R ... | Go |
// 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.
// Test interfaces and methods.
package main
type S struct {
a,b int;
}
type I1 interface {
f ()int;
}
type I2 interface {
g() int;
f() int;
}
... | Go |
// 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.
// Test simple function literals.
package main
func
main() {
x := func(a int)int {
x := func(a int)int {
x := func(a int)int {
return a+5;
... | Go |
// 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.
// Test interfaces on basic types.
package main
type myint int
type mystring string
type I0 interface{}
func f() {
var ia, ib I0
var i myint
var s... | Go |
// 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.
// Test simple arithmetic conversion.
package main
type vlong int64
type short int16
func main() {
s1 := vlong(0)
for i := short(0); i < 10; i = i ... | Go |
// 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.
// Test method invocation with pointer receivers and function-valued fields.
package main
type C struct {
a int;
x func(p *C)int;
}
func (this *C) ... | Go |
// cmpout
// 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.
// Test string operations including printing.
package main
func main() {
var c string
a := `abc`
b := `xyz`
/* print a literal */
print(`abc... | Go |
// 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.
// Test interface assignment.
package main
type Iputs interface {
puts (s string) string;
}
// ---------
type Print struct {
whoami int;
put Iput... | Go |
// 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.
// Test for loops of many forms.
package main
func assertequal(is, shouldbe int, msg string) {
if is != shouldbe {
print("assertion fail" + msg + "... | Go |
// skip
// Copyright 2012 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.
// Test method expressions with arguments.
// This file is not tested by itself; it is imported by method4.go.
package method4a
type T1 int
type T2 ... | Go |
// 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.
// Test simultaneous assignment.
package main
var a, b, c, d, e, f, g, h, i int
func printit() {
println(a, b, c, d, e, f, g, h, i)
}
func testit(p... | Go |
// run
// Copyright 2011 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.
// Test evaluation order in if condition.
package main
var calledf = false
func f() int {
calledf = true
return 1
}
func g() int {
if !calledf {... | Go |
// 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.
// Test the cap predeclared function applied to channels.
package main
func main() {
c := make(chan int, 10)
if len(c) != 0 || cap(c) != 10 {
prin... | Go |
// errorcheck
// 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.
// Verify that erroneous initialization expressions are caught by the compiler
// Does not compile.
package main
type S struct {
A, B, C, X, Y... | Go |
// errchk -0 $G -m -l $D/$F.go
// Copyright 2012 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.
// Test, using compiler diagnostic flags, that bounds check elimination
// is eliminating the correct checks.
package foo
var... | Go |
// cmpout
// Copyright 2010 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.
// Test that we can defer the predeclared functions print and println.
package main
func main() {
defer println(42, true, false, true, 1.5, "worl... | Go |
// errchk -0 $G -m -l $D/$F.go
// Copyright 2010 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.
// Test, using compiler diagnostic flags, that the escape analysis is working.
// Compiles but does not run. Inlining is disab... | Go |
// 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.
// Test implicit and explicit conversions of constants.
package main
const (
ci8 = -1 << 7
ci16 = -1<<15 + 100
ci32 = -1<<31 + 100000
ci64 = -1<<... | Go |
// errorcheck
// Copyright 2011 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.
// Verify that illegal conversions involving strings are detected.
// Does not compile.
package main
type Tbyte []byte
type Trune []rune
type ... | Go |
// errorcheck
// Copyright 2011 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.
// Test map declarations of many types, including erroneous ones.
// Does not compile.
package main
func main() {}
type v bool
var (
// val... | Go |
// [ "$GOOS" == windows ] ||
// ($G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.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.
// Test that a program can survive SIGCHLD.
package main
import ... | Go |
// 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.
// Test various safe uses of indirection.
package main
var m0 map[string]int
var m1 *map[string]int
var m2 *map[string]int = &m0
var m3 map[string]int... | Go |
// cmpout
// Copyright 2011 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.
// Test that println can be the target of a go statement.
package main
import "time"
func main() {
go println(42, true, false, true, 1.5, "world... | Go |
// errorcheck
// Copyright 2011 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.
// Verify that erroneous labels are caught by the compiler.
// This set is caught by pass 1.
// Does not compile.
package main
var x int
func... | Go |
// run
// Copyright 2010 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.
// Test of recover during recursive panics.
// Here be dragons.
package main
import "runtime"
func main() {
test1()
test2()
test3()
test4()
tes... | Go |
// 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.
// Test defer.
package main
import "fmt"
var result string
func addInt(i int) { result += fmt.Sprint(i) }
func test1helper() {
for i := 0; i < 10;... | Go |
// 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.
// Test simple type switches on basic types.
package main
import "fmt"
const (
a = iota
b
c
d
e
)
var x = []int{1, 2, 3}
func f(x int, len *by... | Go |
// 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.
// Test simple boolean and numeric constants.
package main
const (
c0 = 0
cm1 = -1
chuge = 1 << 100
chuge_1 = chuge - 1
c1 = chuge >> 100
c3div2... | Go |
// 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.
// Test iota.
package main
func assert(cond bool, msg string) {
if !cond {
print("assertion fail: ", msg, "\n")
panic(1)
}
}
const (
x int = i... | Go |
// 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.
// Test stack splitting code.
// Try to tickle stack splitting bugs by doing
// go, defer, and closure calls at different stack depths.
package main
t... | Go |
// errorcheck
// Copyright 2010 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.
// Verify that a couple of illegal variable declarations are caught by the compiler.
// Does not compile.
package main
func main() {
_ = asdf... | Go |
// $G -S $D/$F.go | egrep initdone >/dev/null && echo BUG sinit || true
// Copyright 2010 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.
// Test that many initializations can be done at link time and
// generate no executab... | Go |
// run
// Copyright 2011 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.
// Test divide corner cases.
package main
import "fmt"
func f8(x, y, q, r int8) {
if t := x / y; t != q {
fmt.Printf("%d/%d = %d, want %d\n", x, ... | Go |
// $G $D/$F.go && $L $F.$A &&
// ./$A.out >tmp.go && $G tmp.go && $L -o $A.out1 tmp.$A && ./$A.out1
// rm -f tmp.go $A.out1
// Copyright 2012 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.
// Generate test of shift and rota... | Go |
// run
// Copyright 2011 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.
// Test reordering of assignments.
package main
import "fmt"
func main() {
p1()
p2()
p3()
p4()
p5()
p6()
p7()
p8()
p9()
}
var gx []int
fu... | Go |
// skip
// Copyright 2010 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 file is compiled and then imported by ddd3.go.
package ddd
func Sum(args ...int) int {
s := 0
for _, v := range args {
s += v
}
return... | Go |
// run cmplxdivide1.go
// Copyright 2010 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.
// Driver for complex division table defined in cmplxdivide1.go
package main
import (
"fmt"
"math"
"math/cmplx"
)
type Test struc... | Go |
// 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.
// Test floating-point literal syntax.
package main
var bad bool
func pow10(pow int) float64 {
if pow < 0 {
return 1 / pow10(-pow)
}
if pow > 0 ... | Go |
// errorcheck
// Copyright 2010 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() {
for var x = 0; x < 10; x++ { // ERROR "var declaration not allowed in for initializer"
| Go |
// errorcheck
// Copyright 2011 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 x() {
}
func main() {
if { // ERROR "missing condition"
}
if x(); { // ERROR "missing condition"
}
}
| Go |
// errorcheck
// Copyright 2010 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
fmt.Printf("hello") // ERROR "non-declaration statement outside function body|expected declaration"
func main() {
}
x++ // ERROR... | Go |
// errorcheck
// Copyright 2010 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 x map[string]string{"a":"b"} // ERROR "unexpected { at end of statement|expected ';' or newline after top level declaration"
... | Go |
// errorcheck
// Copyright 2012 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 a = []int{
3 // ERROR "need trailing comma before newline in composite literal"
}
| Go |
// errorcheck
// Copyright 2010 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 x map[string]string{"a":"b"} // ERROR "unexpected { at end of statement|expected ';' or '}' or newline"
| Go |
// errorcheck
// Copyright 2010 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 // ERROR "unexpected semicolon or newline in type declaration"
{
| Go |
// errorcheck
// Copyright 2010 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() {
for x // GCCGO_ERROR "undefined"
{ // ERROR "unexpected semicolon or newline before .?{.?"
z // GCCGO_ERROR "u... | Go |
// errorcheck
// Copyright 2010 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 (
"io", // ERROR "unexpected comma"
"os"
)
| Go |
// errorcheck
// Copyright 2010 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() {
if x; y // ERROR "unexpected semicolon or newline before .?{.?|undefined"
{
z // GCCGO_ERROR "undefined"
| Go |
// errorcheck
// Copyright 2010 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 c chan int
var v int
func main() {
if c <- v { // ERROR "send statement.*value.*select"
}
}
var _ = c <- v // ERROR "send ... | Go |
// errorcheck
// Copyright 2010 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()
{ // ERROR "unexpected semicolon or newline before .?{.?"
| Go |
// errorcheck
// Copyright 2010 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 xyz struct {
ch chan
} // ERROR "unexpected .*}.* in channel type"
func Foo(y chan) { // ERROR "unexpected .*\).* in cha... | Go |
// errorcheck
// Copyright 2010 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() {
for x; y; z // ERROR "unexpected semicolon or newline before .?{.?|undefined"
{
z // GCCGO_ERROR "undefined"
| Go |
// errorcheck
// Copyright 2011 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() {
if true {
} else ; // ERROR "else must be followed by if or statement block|expected .if. or .{."
}
| Go |
// errorcheck
// Copyright 2010 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 interface {
f, g () // ERROR "name list not allowed in interface type"
}
| Go |
// errorcheck
// Copyright 2011 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() {
switch main() := interface{}(nil).(type) { // ERROR "invalid variable name"
default:
}
}
| Go |
// errorcheck
// Copyright 2010 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() {
switch x; y // ERROR "unexpected semicolon or newline before .?{.?|undefined"
{
z
| Go |
// errorcheck
// Copyright 2010 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() {
if x { } // GCCGO_ERROR "undefined"
else { } // ERROR "unexpected semicolon or newline before .?else.?"
}
| Go |
// errorcheck
// 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.
// Test that result parameters are in the same scope as regular parameters.
// Does not compile.
package main
func f1(a int) (int, float32) {
... | Go |
// errchk -0 $G -m $D/$F.go
// Copyright 2010 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.
// Test, using compiler diagnostic flags, that the escape analysis is working.
// Compiles but does not run. Inlining is enabled.... | Go |
// errorcheck
// 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.
// Test that incorrect uses of the blank identifer are caught.
// Does not compile.
package _ // ERROR "invalid package name _"
func main() {
... | Go |
// 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.
// Semi-exhaustive test for the copy predeclared function.
package main
import (
"fmt"
"os"
)
const N = 40
var input8 = make([]uint8, N)
var outpu... | Go |
// errorcheck
// 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.
// Verify that illegal uses of composite literals are detected.
// Does not compile.
package main
var a = []int { "a" }; // ERROR "conver|incom... | Go |
// compile
// Copyright 2010 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.
// Test that a comment ending a source file does not need a final newline.
// Compiles but does not run.
package eof1
// No newline at the end of... | Go |
// errorcheck
// Copyright 2011 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.
// Verify that erroneous labels are caught by the compiler.
// This set is caught by pass 2. That's why this file is label1.go.
// Does not com... | Go |
// 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.
// Test maps, almost exhaustively.
package main
import (
"fmt"
"math"
"strconv"
"time"
)
const count = 100
func P(a []string) string {
s := "{"... | Go |
// 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.
// Test correct short declarations and redeclarations.
package main
func f1() int { return 1 }
func f2() (float32, int) { r... | Go |
// 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.
// Test concurrency primitives: classical inefficient concurrent prime sieve.
// Generate primes up to 100 using channels, checking the results.
// Thi... | Go |
// run
// Copyright 2011 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.
// Test for select: Issue 2075
// A bug in select corrupts channel queues of failed cases
// if there are multiple waiters on those channels and the
//... | Go |
// 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.
// Torture test for goroutines.
// Make a lot of goroutines, threaded together, and tear them down cleanly.
package main
import (
"os"
"strconv"
)
... | Go |
// 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.
// Test that unbuffered channels act as pure fifos.
package main
import "os"
const N = 10
func AsynchFifo() {
ch := make(chan int, N)
for i := 0; ... | Go |
// run
// Copyright 2010 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.
// Test the semantics of the select statement
// for basic empty/non-empty cases.
package main
import "time"
const always = "function did not"
const ... | Go |
// 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.
// Test concurrency primitives: power series.
// Power series package
// A power series is a channel, along which flow rational
// coefficients. A den... | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.