code
stringlengths
10
1.34M
language
stringclasses
1 value
// 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 bcrypt implements Provos and Mazières's bcrypt adaptive hashing // algorithm. See http://www.usenix.org/event/usenix99/provos/provos.pdf package bcry...
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 bcrypt import "encoding/base64" const alphabet = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" var bcEncoding = base64.NewEncodi...
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 pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0. A key derivation function is useful when encrypting data...
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 twofish implements Bruce Schneier's Twofish encryption algorithm. package twofish // Twofish is defined in http://www.schneier.com/paper-twofish-pap...
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 ssh import ( "crypto/dsa" "crypto/ecdsa" "crypto/rsa" "errors" "fmt" "math/big" "sync" ) // These are string constants in the SSH protocol. con...
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 ssh import ( "errors" "fmt" "io" "math/rand" "net" "strconv" "strings" "sync" "time" ) // Listen requests the remote peer open a listening so...
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 ssh import ( "io" "sync" ) // buffer provides a linked list buffer for data exchange // between producer and consumer. Theoretically the buffer is /...
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 ssh import ( "crypto/dsa" "crypto/ecdsa" "crypto/rsa" "time" ) // These constants from [PROTOCOL.certkeys] represent the algorithm names // for ce...
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. // This package contains integration tests for the // code.google.com/p/go.crypto/ssh package. package test
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. // +build linux,!appengine darwin // Package terminal provides support functions for dealing with terminals, as // commonly found on UNIX systems. // // Puttin...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin package terminal import "syscall" const ioctlReadTermios = syscall.TIOCGETA const ioctlWriteTermios = syscall.TIOCSETA
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 terminal import ( "io" "sync" ) // EscapeCodes contains escape sequences that can be written to the terminal in // order to achieve different styles...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build linux package terminal import "syscall" const ioctlReadTermios = syscall.TCGETS const ioctlWriteTermios = syscall.TCSETS
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 ssh import ( "errors" "fmt" "io" "net" ) // authenticate authenticates with the remote server. See RFC 4252. func (c *ClientConn) authenticate(ses...
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 ssh // Session implements an interactive session described in // "RFC 4254, section 6". import ( "bytes" "errors" "fmt" "io" "io/ioutil" "sync" ...
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 ssh // Message authentication support import ( "crypto/hmac" "crypto/sha1" "hash" ) type macMode struct { keySize int new func(key []byte) h...
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 ssh import ( "bytes" "encoding/binary" "io" "math/big" "reflect" ) // These are SSH message type numbers. They are scattered around several // do...
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 ssh import ( "bytes" "crypto/dsa" "crypto/ecdsa" "crypto/elliptic" "crypto/rsa" "encoding/base64" "math/big" ) // These constants represent the...
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 ssh // A Terminal is capable of parsing and generating virtual terminal // data from an SSH client. type Terminal interface { ReadLine() (line string,...
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 ssh import ( "bufio" "crypto" "crypto/cipher" "crypto/subtle" "encoding/binary" "errors" "hash" "io" "net" "sync" ) const ( packetSizeMulti...
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 ssh import ( "crypto/aes" "crypto/cipher" "crypto/rc4" ) // streamDump is used to dump the initial keystream for stream ciphers. It is a // a write...
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 ssh import ( "errors" "fmt" "io" "sync" "sync/atomic" ) // extendedDataTypeCode identifies an OpenSSL extended data type. See RFC 4254, // sectio...
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 ssh import ( "bytes" "crypto" "crypto/rand" "crypto/rsa" "crypto/x509" "encoding/binary" "encoding/pem" "errors" "io" "math/big" "net" "syn...
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 ssh import ( "encoding/base64" "errors" "io" "sync" ) // See [PROTOCOL.agent], section 3. const ( // 3.2 Requests from client to agent for protoc...
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 ssh implements an SSH client and server. SSH is a transport security protocol, an authentication protocol and a family of application protocols. The...
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 ssh import ( "crypto" "crypto/rand" "encoding/binary" "errors" "fmt" "io" "math/big" "net" "sync" ) // clientVersion is the fixed identificat...
Go
// Copyright 2013 The Go 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 ocsp parses OCSP responses as specified in RFC 2560. OCSP responses // are signed messages attesting to the validity of a certificate for a small // ...
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. // Test unsafe.Sizeof, unsafe.Alignof, and unsafe.Offsetof all return uintptr. package main import "unsafe" type T struct { X int } var t T f...
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. // 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
// 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 variadic functions and calls (dot-dot-dot). package main func sum(args ...int) int { s := 0 for _, v := range args { s += v } return s ...
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
// 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. // Test rune constants, expressions and types. // Compiles but does not run. package rune var ( r0 = 'a' r1 = 'a'+1 r2 = 1+'a' r3 = 'a'*2 r4...
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
// 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 composite literals are detected. // Does not compile. package main var m map[int][3]int func f() [3]int func fp() *[3...
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 typed integer constants. package main import "fmt" type T int func (t T) String() string { return fmt.Sprintf("T%d", int(t)) } const ( A 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 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
// 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 when import gives multiple names // to a single type, they still all refer to the same type. package main import _os_ "os" import "os...
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. package main var calledf int func f() int { calledf++ return 0 } func g() int { return calledf } var xy string func ...
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 illegal uses of ... are detected. // Does not compile. package main import "unsafe" func sum(args ...int) int { return 0 } 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. // Verify that large integer constant expressions cause overflow. // Does not compile. package main const ( A int = 1 B byte; // ERROR "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 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
// $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
// 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 a source file does not need a final newline. // Compiles but does not run. // No newline at the end of this file. package main
Go
// $G $F.go && $L $F.$A && ./$A.out arg1 arg2 // Copyright 2009 The Go 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 os.Args. package main import "os" func main() { if len(os.Args) != 3 { panic("argc") } if os.Args...
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 dynamic interface checks treat byte=uint8 // and rune=int or rune=int32. package main func main() { var x interface{} x = byte(1) sw...
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 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
// 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 closures in if conditions. package main func main() { if func() bool { return true }() {} // 6g used to say this was a syntax error if (fu...
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. // Test legal shifts. // Issue 1708, legal cases. // Compiles but does not run. package p func f(x int) int { return 0 } func g(x interfa...
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 switch statements. package main import "os" func assert(cond bool, msg string) { if !cond { print("assertion fail: ", msg, "\n") panic(1...
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 nil. package main import ( "fmt" "time" ) type T struct { i int } type IN interface{} func main() { var i *int var f *float32 var s *...
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 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
// 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 returning &T{} from a function causes an allocation. package main type T struct { int } func f() *T { return &T{1} } 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. // Test that incorrect short declarations and redeclarations are detected. // Does not compile. package main func f1() int {...
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 zero length structs. // Used to not be evaluated. // Issue 2232. package main func recv(c chan interface{}) struct{} { return (<-c).(struct{...
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
// 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 len non-constants are not constants, http://golang.org/issue/3244. package p var b struct { a[10]int } var m map[string][20]int ...
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
// 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 use of init is detected. // Does not compile. package main import "runtime" func init() { } func main() { init() ...
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 initialization of package-level variables. package main import "fmt" import "reflect" type S struct { A, B, C, X, Y, Z int } type T struct ...
Go
// $G $D/ddd2.go && $G $D/$F.go && $L $F.$A && ./$A.out // 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 variadic functions work across package boundaries. package main import "./ddd2" func 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 that predeclared names can be redeclared by the user. package main import "fmt" func main() { n := append + bool + byte + comple...
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 heavy recursion works. Simple torture test for // segmented stacks: do math in unary by recursion. package main type Number *Number // -...
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 simple assignment errors are caught by the compiler. // Does not compile. package main import "sync" type T struct { int sync.Mute...
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. // A simple test of the garbage collector. package main func main() { for i := 0; i < 1e5; i++ { x := new([100]byte) _ = 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. // Verify that various erroneous type switches are caught be the compiler. // Does not compile. package main import "io" func whatis(x interfa...
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 trailing commas. DO NOT gofmt THIS FILE. package main var a = []int{1, 2, } var b = [5]int{1, 2, 3, } var c = []int{1, } var d = [...]int{1, 2...
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 switch statements are detected by the compiler. // Does not compile. package main type I interface { M() } func bad(...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out >tmp.go && // $G tmp.go && $L tmp.$A && ./$A.out // rm -f tmp.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 source files and strings containing \r and \r\n...
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 pointers and interface types cannot be method receivers. // Does not compile. package main type T struct { a int } type P *T ty...
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
// 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 it is illegal to take the address of a function. // Does not compile. package main var notmain func() func main() { var x = &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 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
// 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" "runtime" "time" ) type Number struct { next *Number } // ------------------------------------- // Peano primitives ...
Go
/* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form ...
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 ( "flag" "fmt" "log" "os" "runtime" "runtime/pprof" "time" "unsafe" ) const BranchingFactor = 4 type Object struct { child [Bra...
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. // Garbage collection benchmark: parse Go packages repeatedly. package main import ( "flag" "fmt" "go/ast" "go/parser" "go/token" "log" "net/http" _ ...
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. package main import ( "fmt" "runtime" "sort" "time" ) func gcstats(name string, n int, t time.Duration) { st := new(runtime.MemStats) runtime.ReadMemSt...
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 types can be parenthesized. package main func f(interface{}) func g() {} func main() { f(map[string]string{"a":"b","c":"d"}) f([......
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 goroutines and garbage collection run during init. package main import "runtime" var x []byte func init() { c := make(chan int) go s...
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 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 incorrect comparisons are detected. // Does not compile. package main func use(bool) {} type T1 *int type T2 *int type T3 stru...
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
// 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 overflow is detected when using numeric constants. // Does not compile. package main type I interface{} const ( // assume all types...
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 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 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 func f() (_ int, err error) { return } func g() (x int, _ error) { return } func h() (_ int, _ error) { return } func i() (int,...
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 func f() { var x struct { T }; var y struct { T T }; x = y; // ERROR "cannot|incompatible" _ = x; } type T1 struct...
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
// 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 1757. // gccgo failed to compile this. package main func main() { (_) = 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. 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
// 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 ddd func Sum() int for i := range []int{} { return i } // ERROR "statement outside function|expected"
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 gen = 'a' func f(n int) string { s := string(gen) + string(n+'A'-1) gen++ return s } func g(x, y string) string { return 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. package main type I interface { m(a, b, c, d, e, f, g, h byte) } type Int8 int8 func (x Int8) m(a, b, c, d, e, f, g, h byte) { check("Int8", int64...
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