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.
package main
var (
nf int
x, y, z = f(), f(), f()
m = map[string]string{"a": "A"}
a, aok = m["a"]
b, bok = m["b"]
)
func look(s str... | Go |
// $G $D/$F.dir/one.go && $G $D/$F.dir/two.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.
package ignored
| 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.
package main
func main() {
i5 := 5;
switch { // compiler crash fixable with 'switch true'
case i5 < 5: dummy := 0; _ = dummy;
case i5 == 5: dummy... | 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.
package lib
type I interface {
m() string
}
type T struct{}
// m is not accessible from outside this package.
func (t *T) m() string {
return "lib.T.m"
}
| 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.
// Issue 873, 2162
package foo
func f(x interface{}) {
switch t := x.(type) { // ERROR "declared and not used"
case int:
}
}
func g(x int... | 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.
// Test that a syntax error caused by an unexpected EOF
// gives an error message with the correct line number.
//
// https://code.google.com/p/... | Go |
// 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
import (
"./p"
)
type Exported interface {
private()
}
type Implementation struct{}
func (p *Implementation) private() {}
func main() {
//... | Go |
// 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 p
type Exported interface {
private()
}
type Implementation struct{}
func (p *Implementation) private() { println("p.Implementation.private()") }
v... | 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.
package one
// Issue 2877
type T struct {
f func(t *T, arg int)
g func(t T, arg int)
}
func (t *T) foo(arg int) {}
func (t T) goo(arg int) {}
func (t *T) ... | 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.
// Use the functions in one.go so that the inlined
// forms get type-checked.
package two
import "./one"
func use() {
var r one.T
r.F()
}
| 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.
package main
import "os"
type S struct { i int }
func (p *S) Get() int { return p.i }
type Empty interface {
}
type Getter interface {
Get() int;
}... | 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.
// http://code.google.com/p/go/issues/detail?id=990
package main
func main() {
defer func() {
if recover() != nil {
panic("non-nil recover"... | 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.
package main
func main() {
c := make(chan int, 1)
dummy := make(chan int)
v := 0x12345678
for i := 0; i < 10; i++ {
// 6g had a bug that caused ... | Go |
// compile
// 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.
// Issue 2576
package bug
type T struct { a int }
func f(t T) {
switch _, _ = t.a, t.a; {}
} | Go |
// compile
// 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.
// gccgo gave an invalid error ("floating point constant truncated to
// integer") compiling this.
package p
const C = 1<<63 - 1
func F(i int64) ... | Go |
// 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.
// these used to fail because the runtime
// functions that get called to implement them
// expected string, not T.
package main
type T string
fun... | Go |
// compile
// 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.
// Crashed gccgo.
package p
type S struct {
f interface{}
}
func F(p *S) bool {
v := p.f
switch a := v.(type) {
case nil:
_ = a
return t... | 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.
package main
var x [10][0]byte
var y = make([]struct{}, 10)
func main() {
if &x[1] != &x[2] {
println("BUG: bug352 [0]byte")
}
if &y[1] != &y[2]... | 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 p
func f(i int) int { return i }
var i = func() int {a := f(i); return a}() // ERROR "initialization loop" | 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
// Issue 2623
var m = map[string]int {
"abc":1,
1:2, // ERROR "cannot use 1.*as type string in map key|incompatible type"
}
| 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.
package main
import (
"runtime"
"strings"
)
func f() {
var x *string
for _, i := range *x { // THIS IS LINE 17
println(i)
}
}
func g() {
}... | Go |
// 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 P
const a = 0;
func f(a int) {
a = 0;
}
/*
bug161.go:8: operation LITERAL not allowed in assignment context
*/
| 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.
package main
type (
Point struct {
x, y float64
}
Polar Point
)
func main() {
}
/*
bug7.go:5: addtyp: renaming Point to Polar
main.go.c:14: erro... | 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.
// 6g accepts the program below even though it is syntactically incorrect:
// Each statement in the list of statements for each case clause must... | 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.
// This is a test case for issue 804.
package main
func f() [10]int {
return [10]int{}
}
var m map[int][10]int
func main() {
f()[1] = 2 //... | 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.
package one
type I1 interface {
f()
}
type S1 struct {
}
func (s S1) f() {
}
func F1(i1 I1) {
}
| 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.
package two
import "./one"
type S2 struct {
one.S1
}
| 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.
// Used to run out of registers on 8g. Issue 868.
package main
func main() {
var r uint32
var buf [4]byte
a := buf[0:4]
r = (((((uint32(a[3]... | 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.
package main
var v1 = ([10]int)(nil); // ERROR "illegal|nil|invalid"
var v2 [10]int = nil; // ERROR "illegal|nil|incompatible"
var v3 [10]int;
v... | Go |
// 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 I1 interface {}
type I2 interface { pr() }
func e() I1;
var i1 I1;
var i2 I2;
func
main() {
i2 = e().(I2); // bug089.go:16: ... | Go |
// compile
// 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
import "unsafe"
func main() {
var x int
a := uint64(uintptr(unsafe.Pointer(&x)))
b := uint32(uintptr(unsafe.Pointer(&x)))
c :=... | 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
type T struct { i int }
| 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"
type T struct { t bug0.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.
package bug2
import _ "./bug1"
import "./bug0"
type T2 struct { t bug0.T }
func fn(p *T2) int {
// This reference should be invalid, because bug0.T.i is lo... | Go |
// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go
// 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 ignored
| 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 assignments with both explicit and implicit conversions of literals are detected.
// Does not compile.
package main
// e... | Go |
// true
// 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
// can't use local path with -u, use -I. instead
import "pkg" // ERROR "import unsafe package"
func main() {
print(pkg.Float32bits(1.0... | Go |
// true
// 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.
// a package that uses unsafe on the inside but not in it's api
package pkg
import "unsafe"
// this should be inlinable
func Float32bits(f float32) ... | Go |
// $G $D/pkg.go && pack grc pkg.a pkg.$A 2> /dev/null && rm pkg.$A && errchk $G -I. -u $D/main.go
// rm -f pkg.a
// 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 ignored
| Go |
// $G $D/pkg.go && pack grcS pkg.a pkg.$A 2> /dev/null && rm pkg.$A && $G -I. -u $D/main.go
// rm -f pkg.a
// 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 ignored
| 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 that error messages say what the source file says
// (uint8 vs byte, int32 vs. rune).
// Does not compile.
package main
import (
"fmt... | 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 var x = x + 1 works.
package main
func main() {
var x int = 1
if x != 1 {
print("found ", x, ", expected 1\n")
panic("fail")
}
{
var... | Go |
// build
// 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 general operation by solving a peg solitaire game.
// A version of this is in the Go playground.
// Don't run it - produces too much output.
... | 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 behavior of closures.
package main
import "runtime"
var c = make(chan int)
func check(a []int) {
for i := 0; i < len(a); i++ {
n := <... | 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 channel operations that test for blocking.
// Use several sizes and types of operands.
package main
import "runtime"
import "time"
func i32re... | 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 making channels of a zero-sized type.
package main
func main() {
_ = make(chan [0]byte)
_ = make(chan [0]byte, 1)
_ = make(chan struct{})
... | 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 that a select statement proceeds when a value is ready.
package main
func f() *int {
println("BUG: called f")
return new(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 concurrency primitives: power series.
// Like powser1.go but uses channels of interfaces.
// Has not been cleaned up as much as powser1.go, to ... | 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 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 various parsing cases that are a little
// different now that send is a statement, not a expression.
package main
func main() {
chanchan()
... | 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 situation in which two cases of a select can
// both end up running. See http://codereview.appspot.com/180068.
package main
import (
"fla... | 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 various correct and incorrect permutations of send-only,
// receive-only, and bidirectional channels.
// Does not compile.
package main
... | 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 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 selects do not consume undue memory.
package main
import "runtime"
func sender(c chan int, n int) {
for i := 0; i < n; i++ {
c <- 1
... | 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 select when discarding a value.
package main
import "runtime"
func recv1(c <-chan int) {
<-c
}
func recv2(c <-chan int) {
select {
case ... | 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 concurrency primitives: prime sieve of Eratosthenes.
// Generate primes up to 100 using channels, checking the results.
// This sieve is Eratos... | Go |
// runoutput
// 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.
// Generate test of channel operations and simple selects.
// The output of this program is compiled and run to do the
// actual test.
// Each 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 concurrency primitives: classical inefficient concurrent prime sieve.
// Generate primes up to 100 using channels, checking the results.
// Thi... | 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 select.
package main
var counter uint
var shift uint
func GetValue() uint {
counter++
return 1 << shift
}
func Send(a, b chan uint)... | 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 |
// 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 recovering from runtime errors.
package main
import (
"runtime"
"strings"
)
var didbug bool
func bug() {
if didbug {
return
}
printl... | 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 literal syntax.
package main
import "os"
func main() {
s := 0 +
123 +
0123 +
0000 +
0x0 +
0x123 +
0X0 +
0X123
if s !... | 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 |
// 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 equality and inequality operations.
package main
import "unsafe"
var global bool
func use(b bool) { global = b }
func stringptr(s string) ui... | 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, including chans, maps etc.
package main
import "os"
const (
Bool = iota
Int
Float
String
Struct
Chan
Array
Map
... | 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 goto semantics.
// Does not compile.
//
// Each test is in a separate function just so that if the
// compiler stops processing after ... | Go |
// 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.
// Test that top-level parenthesized declarations can be empty.
// Compiles but does not run.
package P
import ( )
const ( )
var ( )
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.
// Verify that erroneous type switches are caught be the compiler.
// Issue 2700, among other things.
// Does not compile.
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 stack splitting code.
// Try to tickle stack splitting bugs by doing
// go, defer, and closure calls at different stack depths.
package main
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 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 |
// 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
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
import (
"io", // ERROR "unexpected comma"
"os"
)
| 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 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() {
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
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
type T interface {
f, g () // ERROR "name list not allowed in interface type"
}
| 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 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 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() {
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
func main() {
for x // GCCGO_ERROR "undefined"
{ // ERROR "unexpected semicolon or newline before .?{.?"
z // GCCGO_ERROR "u... | 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
var x map[string]string{"a":"b"} // ERROR "unexpected { at end of statement|expected ';' or newline after top level 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 var x = 0; x < 10; x++ { // ERROR "var declaration not allowed in for initializer"
| 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() {
switch x; y // ERROR "unexpected semicolon or newline before .?{.?|undefined"
{
z
| 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 |
// 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.
// Test function signatures.
// Compiled but not run.
package main
type t1 int
type t2 int
type t3 int
func f1(t1, t2, t3)
func f2(t1, t2, t3 boo... | 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 even if a file imports runtime,
// it cannot get at the low-level runtime definitions
// known to the compiler. For normal package... | Go |
// $G $D/$F.go && $L -X main.tbd hello $F.$A && ./$A.out
// 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 the -X facility of the gc linker (6l etc.).
package main
var tbd string
func main() {
if ... | Go |
// run
// 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 conversion from non-interface types to the empty interface.
package main
type J interface {
Method()
}
type (
U16 uint16
U32 uint32
U64... | 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.
// Semi-exhaustive test for the append predeclared function.
package main
import (
"fmt"
"reflect"
)
func verify(name string, result, expected int... | 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 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 len constants and non-constants, http://golang.org/issue/3244.
package main
var b struct {
a[10]int
}
var m map[string][20]int
var s [][30]... | 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 basic operations on named types are valid
// and preserve the type.
package main
type Array [10]byte
type Bool bool
type Chan chan int
t... | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.