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 // Interface type I interface { F() int } // Implements interface type S struct { } func (s *S) F() int { return 1 } // Allocates S but ...
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. // Issue 1802 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. package main func f() /* no return type */ {} func main() { x := f(); // ERROR "mismatch|as value|no type" }
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 1787. package main import "unsafe" const x = unsafe.Sizeof([8]byte{}) func main() { var b [x]int _ = b } /* bug338.go:14: array bou...
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() { c := 10; d := 7; var x [10]int; i := 0; /* this works: q := c/d; x[i] = q; */ // this doesn't: x[i] = c/d; // BUG ...
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. // Test cases for revised conversion rules. package main func main() { type NewInt int i0 := 0 var i1 int = 1 var i2 NewInt = 1 i0 = i0 i...
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 "fmt" var s string func accum(args ...interface{}) { s += fmt.Sprintln(args...) } func f(){ v := 0.0 for i := 0; i < 3; 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. package main type S struct { } func (p *S) M() { } type I interface { M(); } func main() { var p *S = nil; var i I = p; // this should be possib...
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 type R interface { duplicate() } type S interface { duplicate() } type T interface { R; S } // ERROR "duplicate" func 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. // http://code.google.com/p/go/issues/detail?id=920 package main type X struct { x []X } func main() { type Y struct { x []Y } // used to get inval...
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. // http://code.google.com/p/go/issues/detail?id=915 package main type T struct { x int } var t = &T{42} var i interface{} = t var tt, ok = i.(*T) ...
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. // http://code.google.com/p/go/issues/detail?id=589 package main func main() { n := int64(100) x := make([]int, n) x[99] = 234; z := x[n-1] if...
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. // Used to crash; issue 961. package main type ByteSize float64 const ( _ = iota; // ignore first value by assigning to blank identifier K...
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. // http://code.google.com/p/go/issues/detail?id=589 package main import "unsafe" var bug = false var minus1 = -1 var big int64 = 10 | 1<<32 var g1...
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 U // bogus "invalid recursive type T" from 6g type U int const x T = 123 type V V // ERROR "invalid recursive 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. // Issue 2206. Incorrect sign extension of div arguments. package main func five(x int64) { if x != 5 { panic(x) } } func main() { // 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. package main import "reflect" type S1 struct{ i int } type S2 struct{ S1 } func main() { typ := reflect.TypeOf(S2{}) f := typ.Field(0) if f.Name !...
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() { k, l, m := 0,0,0; _, _, _ = k, l, 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. package main type T struct{} type P *T func (t *T) Meth() {} func (t T) Meth2() {} func main() { t := &T{} p := P(t) p.Meth() // ERROR "u...
Go
// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go && $G $D/$F.go && $L $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 converting a type defined in a different package to an // interfa...
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. // gc used to overflow a counter when a variable was // mentioned 256 times, and generate stack corruption. package main func main() { F(1) } func F...
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 1411. package main const ui uint = 0 const i int = ui // ERROR "type"
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 used to crash compiling this. package p type E int func (e E) P() *E { return &e } const ( C1 E = 0 C2 = C1 ) func F() *E { return ...
Go
// $G $D/$F.dir/bug0.go && errchk $G $D/$F.dir/bug1.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. 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. package P var x int func foo() { print(P.x); // ERROR "undefined" } /* uetli:~/Source/go1/test/bugs gri$ 6g bug085.go bug085.go:6: P: undefi...
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 var V0 func() int; var V1 func() (a int); var V2 func() (a, b 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 main import P "./bug0" func main() { a0 := P.V0(); // works a1 := P.V1(); // works a2, b2 := P.V2(); // doesn't work _, _, _, _ = a0, a1, a2, ...
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 that initializing struct fields out of order still runs // functions in the right order. This failed with gccgo. package main type S 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 case for http://code.google.com/p/go/issues/detail?id=692 package main var fooCount = 0 var barCount = 0 var balCount = 0 func foo() (int, in...
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 T struct{ *p.S } type I interface { get() } func main() { var t T p.F(t) var x interface{} = t _, ok := x.(I) if ok ...
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 T struct{ x int } type S struct{} func (p *S) get() { } type I interface { get() } func F(i I) { i.get() }
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 Bar import _ "chanbug"
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 chanbug var C chan<- (chan int) var D chan<- func() var E func() chan int var F func() (func())
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 type I int type S struct { f map[I]int } var v1 = S{ make(map[int]int) } // ERROR "cannot|illegal|incompatible|wrong" var v2 map[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. package main type S struct { a []int } var s = &S{make([]int, 10)} func main() { s.a[f()] = 1 // 6g used to call f twice here } var n int func 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 func main() { var b [0]byte s := string(b[0:]) // out of bounds trap if s != "" { panic("bad convert") } var b1 = [5]byte{'h', 'e',...
Go
// $G $D/$F.dir/lib.go && $G $D/$F.go && $L $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. // Tests that method calls through an interface always // call the locally defined method localT...
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 order of evaluation in tuple assignments. package main var i byte = 0 var a [30]byte func f() *byte { i++ return &a[i-1] } func gbyte() byt...
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 case for issue 849. package main type I interface { f() } var callee string var error_ bool type T int func (t *T) f() { callee = "f" } f...
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 func main() { var s string = nil; // ERROR "illegal|invalid|incompatible|cannot" }
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 func f() (int, bool) { return 0, true } func main() { x, y := f(), 2; // ERROR "multi" _, _ = x, y }
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. // http://code.google.com/p/go/issues/detail?id=807 package main type Point struct { X, Y int64 } type Rect struct { Min, Max Point } func (p Poi...
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 crashed compiling this. package p var v struct{ I } type I interface{}
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 const ( c3div2 = 3/2; f3div2 = 3./2.; ) func assert(t bool, s string) { if !t { panic(s) } } func main() { var i int; var...
Go
// build // 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() { type T struct { x int } } func f2() { type T struct { x float64 } } func main() { f1() f2() } /* 1606416576: co...
Go
// $G $D/bug160.dir/x.go && $G $D/bug160.dir/y.go && $L y.$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. nothing to see here
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 const B32 = 1<<32 - 1 const C32 = (-1) & ((1 << 32) - 1) const D32 = ^0 func main() { if B32 != 0xFFFFFFFF { println("1<<32 - 1 is", B...
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 2452. // Check that the error messages says // bug378.go:17: 1 + 2 not used // and not // bug378.go:17: 1 not used package main 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. package main func main() { Foo: { return; } goto Foo; } /* bug5.go:4: Foo undefined bug5.go:4: fatal error: walktype: switch 1 unknown op GOTO l(4...
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 func main() { var x int; x := 0; // ERROR "declar|:=" _ = x; }
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. // Used to crash // http://code.google.com/p/go/issues/detail?id=204 package main func () x() // ERROR "no receiver" func (a b, c d) x() // ER...
Go
// cmpout // 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. // Multiple inlined calls to a function that causes // redundant address loads. package main func F(v [2]float64) [2]float64 { return [2]float64{...
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 func main() { s := vlong(0); // ERROR "undef" }
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 type T *struct {} func (x T) M () {} // ERROR "pointer|receiver" /* bug046.go:7: illegal <this> pointer */
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 2086 // was calling makeclosure twice on the closure package bug354 type Inner struct { F func() error } type Outer struct { Inners [...
Go
// $G $D/$F.dir/chanbug.go && $G -I. $D/$F.dir/chanbug2.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. 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. // Issue 2500 package foo // Check that we only get root cause message, no further complaints about r undefined func (r *indexWriter) foo() {}...
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 x int var a = []int{ x: 1} // ERROR "constant" var b = [...]int{ x : 1} // ERROR "constant" var c = map[int]int{ x: 1}
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 type S struct { a, b int } func main() { s1 := S{a: 7}; // ok - field is named s3 := S{7, 11}; // ok - all fields have values ...
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
// 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. package main var a [10]int var b [1e1]int func main() { if len(a) != 10 || len(b) != 10 { println("len", len(a), len(b)) panic("fail") } }
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 crashed compiling this file. package p var V = "a" > "b"
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 type T int type U int var x int var t T = int(0) // ERROR "cannot use|incompatible" var t1 T = int(x) // ERROR "cannot use|incomp...
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 that when the compiler expands append inline it does not // overwrite a value before it needs it (issue 3369). package main func main() { s ...
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 type S struct { a int } type PS *S func (p *S) get() int { return p.a } func fn(p PS) int { // p has type PS, and PS has no me...
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. // Crashes 6g, 8g // http://code.google.com/p/go/issues/detail?id=238 package main func main() { bar := make(chan bool); select { case _ = <-ba...
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 func main() { x := 0; if x { // ERROR "x.*int|bool" } }
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 bug219 func f(func()) int { return 0 } // this doesn't work: // bug219.go:16: syntax error near if func g1() { if x := f(func() { if tr...
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
// 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 func main() { c := make(chan int); ok := false; var i int; i, ok = <-c; // works _, _ = i, ok; ca := new([2]chan int); i, ...
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 case for issue 471. This file shouldn't compile. package main const a *int = 1 // ERROR "convert|wrong|invalid" const b [2]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. // Issue 1871. package p type a interface { foo(x int) (x int) // ERROR "redeclared|redefinition" } var b interface { bar(y int) (y 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. package main func main() { prog := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ "xxxxxxxxxx"+ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ ...
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 crashed compiling this. package p type T *T func f(t T) { println(t, *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. package main func main() { var cu0 uint16 = '\u1234'; var cU1 uint32 = '\U00101234'; _, _ = cu0, cU1; } /* bug13.go:4: missing ' bug13.go:4: syntax ...
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 func main() { var buf [10]int; for ; len(buf); { // ERROR "bool" } } /* uetli:/home/gri/go/test/bugs gri$ 6g bug209.go bug209....
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 bug151 type S string type Empty interface {} func (v S) Less(e Empty) bool { return v < e.(S); } /* bugs/bug151.go:10: illegal types fo...
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 func main() { if true { } else { L1: goto L1 } if true { } else { goto L2 L2: main() } } /* These should be legal accor...
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. // https://code.google.com/p/gofrontend/issues/detail?id=1 package main func f1() { a, b := f() // ERROR "mismatch|does not match" _ = a _ ...
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. // Used to cause a typechecking loop error. package pkg type T map[int]string var q = &T{}
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. // http://code.google.com/p/go/issues/detail?id=749 package main func f() (ok bool) { return false } func main() { var i interface{} i = f _ = i....
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 type T struct { X int } func (t *T) X() {} // ERROR "type T has both field and method named X"
Go
// $G $D/$F.dir/b.go && $G $D/$F.dir/a.go // rm -f a.$A b.$A // 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 1705. unused (see script at top of file)
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. // http://code.google.com/p/go/issues/detail?id=846 package main func x() (a int, b bool) { defer func(){ a++ }() a, b = y() return } func x2(...
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 type T1 struct { Next *T2 } type T2 T1 type T3 struct { Next *T4 } type T4 T5 type T5 T6 type T6 T7 type T7 T8 type T8 T9 type T9 T3...
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 I interface{} func foo1(i int) int { return i } func foo2(i int32) int32 { return i } func main() { var i I i = 1 var v1 = i....
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 import os "os" type _ os.FileInfo func f() (os int) { // In the next line "os" should refer to the result variable, not // to th...
Go
// $G $D/$F.go && $L $F.$A && ! ./$A.out || echo BUG: bug429 // 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. // Should print deadlock message, not hang. package main func main() { select {} }
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. // This is a test case for issue 788. package main func main() { var a [1]complex64 t := a[0] _ = real(t) // this works _ = real(a[0]) // t...
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 2674 package main const dow = "\000\003" func main() { println(int(dow[1])) }
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() { c := make(chan bool, 1); select { case _ = <-c: panic("BUG: recv should not"); default: } c <- true; select { cas...
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 const ( F = 1 ) func fn(i int) int { if i == F() { // ERROR "func" return 0 } return 1 }
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 func f() int { } // ERROR "return|control" func g() (foo int) { } // ERROR "return|control"
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 func f() string { return 0 // ERROR "conversion|type" }
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 func main() { L: for { for { break L2 // ERROR "L2" continue L2 // ERROR "L2" } } L1: x := 1 _ = x for { break...
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 func f1() { exit: print("hi\n") goto exit } func f2() { const c = 1234 } func f3() { i := c // ERROR "undef" } func main() {...
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 type I1 interface { I2 } // ERROR "interface" type I2 int type I3 interface { int } // ERROR "interface" type S struct { x inter...
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 f(i int, f float64) { i = 8 f = 8.0 return } func main() { f(3, float64(5)) } /* bug10.go:5: i undefined bug10.go:6: illegal c...
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 Foo interface { } type T struct {} func (t *T) foo() {} func main() { t := new(T); var i interface {}; f, ok := i.(Foo); _,...
Go