code
stringlengths
10
1.34M
language
stringclasses
1 value
// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go || echo BUG:bug434 // 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
// 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 t one.T var u one.U var v one.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 3552 type T struct { int } func (t T) F() int { return t.int } type U struct { int int } func (u U) F() int { return u.int } type li...
Go
// echo bug395 is broken # takes 90+ seconds to break // # $G $D/$F.go || echo bug395 // 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 1909 // Would OOM due to exponential recursion on Foo's expand...
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
// 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. // Solve the 2,3,5 problem (print all numbers with 2, 3, or 5 as factor) using channels. // Test the solution, silently. package main type T chan uint...
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. // Test that the Go environment variables are present and accessible through // package os and package runtime. package main import ( "os" "runtime"...
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 simulating a Turing machine, sort of. package main // brainfuck var p, pc int var a [30000]byte const prog = "++++++++++[>+++++++>++++++++++...
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 methods of various types, with pointer and // value receivers. package main type S string type S1 string type I int type I1 int type 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 equality and inequality operations. package main import "unsafe" var global bool func use(b bool) { global = b } func stringptr(s string) ui...
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 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 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 buffered channels are garbage collected properly. // An interesting case because they have finalizers and used to // have self loops that ...
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. // Run runs tests in the test directory. // // TODO(bradfitz): docs of some sort, once we figure out how we're changing // headers of files package m...
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 internal "algorithms" for objects larger than a word: hashing, equality etc. package main type T struct { a float64 b int64 c string 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 character literal syntax. package main import "os" func main() { var i uint64 = ' ' + 'a' + 'ä' + '本' + '\a' + '\b' + '\f' + ...
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. // Test basic concurrency: the classic prime sieve. // Do not run - loops forever. package main // Send the sequence 2, 3, 4, ... to channel 'ch'. 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. // Verify that invalid imports are rejected by the compiler. // Does not compile. package main // Correct import paths. import _ "fmt" import _...
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 line numbers in error messages. // Does not compile. package main var ( _ = x // ERROR "undefined.*x" _ = x // ERROR "undefined.*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 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
// 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 // 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 methods derived from embedded interface values. package main import "os" const Value = 1e12 type Inter interface { M() int64 } type T 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. // Check mutually recursive interfaces package recursive type I1 interface { foo() I2 } type I2 interface { bar() I1 } type T int func (t T) f...
Go
// $G $D/${F}1.go && errchk $G $D/$F.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. // Test that unexported methods are not visible outside the package. // Does not compile. package main import "./priv...
Go
// skip # used by recursive2 // 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. // Mutually recursive type definitions imported and used by recursive1.go. package p type I1 interface { F() I2 } type I2 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 interface methods with different return types are distinct. package main type S struct { a int } type T struct { b string } func (s *S) Name(...
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 compiler messages about erroneous static interface conversions. // Does not compile. package main type T struct { a int } var t *T ...
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 compiler complains about missing implicit methods. // Does not compile. package main type T int func (t T) V() func (t *T) P() type...
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 comparisons using types hidden // inside reflected-on structs. package main import "reflect" type T struct { F float32 G float32 ...
Go
// skip # used by private.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. // Imported by private.go, which should not be able to see the private method. package p type Exported interface { private() } ...
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 values containing structures. package main import "os" var fail int func check(b bool, msg string) { if (!b) { println("failure...
Go
// skip # used by embed1.go // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test that embedded interface types can have local methods. package p type T int func (t T) m() {} type I interface { m() } ty...
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 static interface conversion of interface value nil. package main type R interface { R() } type RW interface { R(); W() } var e interface {} v...
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 methods for embedded types and // mixed pointer and non-pointer receivers. package main type T int var nv, np int func (t T) V() { ...
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 interface{M()} = *interface{M()} produces a compiler error. // Does not compile. package main type Inst interface { Next() *Inst ...
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 run-time error detection for interface values containing types // that cannot be compared for equality. package main func main() { cmp(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. // Test big vs. small, pointer vs. value interface methods. package main type I interface { M() int64 } type BigPtr struct { a, b, c, d int64 } func ...
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 static interface conversion of interface value nil. package main type R interface { R() } type RW interface { R(); W() } var e interface {} v...
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 all the different interface conversion runtime functions. package main type Stringer interface { String() string } type StringLengther interf...
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 methods derived from embedded interface and *interface values. package main import "os" const Value = 1e12 type Inter interface { M()...
Go
// $G $D/recursive1.go && $G $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 that the mutually recursive types in recursive1.go made it // intact and with the same meaning, by assigning to ...
Go
// $G $D/embed0.go && $G $D/$F.go && $L $F.$A && ./$A.out // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test that embedded interface types can have local methods. package main import "./embed0" type ...
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 interface conversion fails when method is missing. package main type I interface { Foo() } func main() { shouldPanic(p1) } func p1() ...
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 zero division causes a panic. package main import ( "fmt" "math" "runtime" "strings" ) type ErrorTest struct { name string fn fu...
Go
// $G $D/import2.go && $G $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 that all the types from import2.go made it // intact and with the same meaning, by assigning to or using them. pac...
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
// 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
// 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 that we can do page 1 of the C book. package main func main() { print("hello, world\n") }
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. // issue 1172 package main func main() { var i interface{} c := make(chan int, 1) c <- 1 select { case i = <-c: // error on this line } if 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 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 f1() { exit: print("hi\n") goto exit } func f2() { const c = 1234 } func f3() { i := c // ERROR "undef" } 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. package main var g byte = 123 var f *byte = &g var b = make([]byte, 5) func main() { b[0:1][0] = *f if b[0] != 123 { println("want 123 got", b[0])...
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 A []int func main() { var a [3]A for i := 0; i < 3; i++ { a[i] = A{i} } if a[0][0] != 0 { panic("fail a[0][0]") } if a[1][...
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 bug233 import p "fmt" var _ = p.Print var fmt = 10
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
// 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 a = []int { 1, 2, 3 } func main() { if len(a) != 3 { panic("array len") } // print(a[0], " ", a[1], " ", a[2], "\n") if a[0] != 1 ...
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 2549 /* Used to die with missing typecheck: [7f5bf07b4438] . AS l(45) . . NAME-main.autotmp_0017 u(1) a(1) l(45) x(0+0) class(PAU...
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() { type M map[int] int; m1 := M{7 : 8}; _ = m1; }
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
// 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. // http://code.google.com/p/go/issues/detail?id=3351 package main // struct with four fields of basic type type S struct {a, b, c, d int} // stru...
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 bug063 const c = 0 ^ 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. // http://code.google.com/p/go/issues/detail?id=808 package main type A [...]int // ERROR "outside of array literal"
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() { nchar := 0 a := []rune{'日', '本', '語', 0xFFFD} for _, char := range "日本語\xc0" { if nchar >= len(a) { println("BUG") ...
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
// 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
// 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 "fmt" func f0() string { const f = 3.141592; return fmt.Sprintf("%v", float64(f)); } func f1() string { const f = 3.141592; ...
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 int func main() {} // issue 1474 // important: no newline on end of next line. // 6g used to print <epoch> instead of...
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 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 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main type T struct { s string } var t = T{"hi"} func main() {} /* bug112.go:6: illegal conversion of constant to T */
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 var x int func main() { (x) := 0 // ERROR "non-name [(]x[)]|non-name on left side" }
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
// 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() { s1 := "hi"; s2 := "ho"; s1 += s2; }
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. // Issue 1811. // gccgo failed to compile this. package p type E interface{} type I interface { E E }
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 const big uint64 = 1<<63 func f(a uint64) uint64 { return a << big } func main() { f(1) } /* main·f: doasm: notfound from=75 to=13 ...
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 var c chan int func main() { c = make(chan int); go func() { c <- 0 } (); <-c }
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 p1 import "fmt" type Fer interface { f() string } type Object struct {} func (this *Object) f() string { return "Ob...
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 main import "./p1" type MyObject struct { p1.Fer } func main() { var b p1.Fer = &p1.Object{} p1.PrintFer(b) va...
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 (x int) { // GCCGO_ERROR "previous" var x int; // ERROR "redecl|redefinition" }
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
// 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 "fmt" var indent uint = 10 func main() { const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " + ". ...
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() { switch { // empty switch is allowed according to syntax // unclear why it shouldn't be allowed } switch tag := 0; tag ...
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. // Used to run 6g out of registers. Issue 2669. package p type y struct { num int } func zzz () { k := make([]byte, 10) arr := make ([]*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. package main import "os" func main() { ok := true; var a, b, c, x, y, z int; f := func() int { b--; return -b }; // this fails on 6g: apparently ...
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 A []int; func main() { a := &A{0}; b := &A{0, 1}; _, _ = a, b; } /* uetli:~/Source/go1/test/bugs gri$ 6g bug096.go && 6l bug...
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 Element interface { } type Vector struct { } func (v *Vector) Insert(i int, e Element) { } func main() { type I struct { val 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. // http://code.google.com/p/go/issues/detail?id=799 package main import "unsafe" func main() { n := unsafe.Sizeof(0) if n != 4 && n != 8 { print...
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 2520 package main func main() { if 2e9 { } // ERROR "2e.09|expected bool" if 3.14+1i { } // ERROR "3.14 . 1i|expected 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 main type myMap map[string] int; func f() myMap { m := make(map[string] int); return m } func main() { m := make(myMap); mp := &m; ...
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 int, 1) c <- 100 x, ok := <-c if x != 100 || !ok { println("x=", x, " ok=", ok, " want 100, true") p...
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 bug066 type Scope struct { entries map[string] *Object; } type Type struct { scope *Scope; } type Object struct { typ *Type; } fun...
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
// $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 main type T int func f() { var x struct { T }; var y struct { T T }; x = y; // ERROR "cannot|incompatible" _ = x; } type T1 struct...
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 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
// 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 2276. // Check that the error messages says // bug381.go:29: unsafe.Alignof(0) not used // and not // bug381.go:29: 4 not used // Is...
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 const s string = "foo"; func main() { i := len(s); // should be legal to take len() of a constant _ = i; } /* uetli:~/Source/go1/...
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