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 main
import (
"fmt"
"go/build"
"os"
"os/exec"
"path/filepath"
"runtime"
"sort"
"strings"
)
var cmdTool = &Command{
Run: runTool,
Usag... | 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 (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
)
var cmdClean = &Command{
UsageLine: "clean [-i] [-r] [-n] [-x] [packages]",
S... | 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
func init() {
addBuildFlagsNX(cmdVet)
}
var cmdVet = &Command{
Run: runVet,
UsageLine: "vet [-n] [-x] [packages]",
Short: "run go ... | 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 (
"bytes"
"encoding/json"
"errors"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
)
// A vcsCmd describes how to... | 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 (
"bytes"
"fmt"
"go/ast"
"go/build"
"go/doc"
"go/parser"
"go/token"
"os"
"os/exec"
"path"
"path/filepath"
"runtime"
"sort"
"... | 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
func init() {
addBuildFlagsNX(cmdFmt)
addBuildFlagsNX(cmdDoc)
}
var cmdFmt = &Command{
Run: runFmt,
UsageLine: "fmt [-n] [-x] [package... | 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 (
"fmt"
"go/ast"
"go/parser"
"go/token"
"os"
"reflect"
"strings"
"unicode"
"unicode/utf8"
)
func initRewrite() {
if *rewriteRul... | 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.
/*
Gofmt formats Go programs.
Without an explicit path, it processes the standard input. Given a file,
it operates on that file; given a directory, it operate... | 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 (
"go/ast"
"go/token"
"reflect"
)
type simplifier struct{}
func (s *simplifier) Visit(node ast.Node) ast.Visitor {
switch n := node.(... | 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 (
"bytes"
"flag"
"fmt"
"go/ast"
"go/parser"
"go/printer"
"go/scanner"
"go/token"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepat... | 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.
/*
6a is a version of the Plan 9 assembler. The original is documented at
http://plan9.bell-labs.com/magic/man2html/1/2a
Its target architecture is the x86... | 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.
/*
Prof is a rudimentary real-time profiler.
Given a command to run or the process id (pid) of a command already
running, it samples the program's state at re... | 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.
/*
5l is the linker for the ARM.
The $GOARCH for these tools is arm.
The flags are documented in ../ld/doc.go.
*/
package documentation
| 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.
/*
Yacc is a version of yacc for Go.
It is written in Go and generates parsers written in Go.
Usage:
go tool yacc args...
It is largely transliterated from... | Go |
/*
Derived from Inferno's utils/iyacc/yacc.c
http://code.google.com/p/inferno-os/source/browse/utils/iyacc/yacc.c
This copyright NOTICE applies to all files in this directory and
subdirectories, unless another copyright notice appears in a given
file or subdirectory. If you take substantial code from this software to... | 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 "go/ast"
func init() {
register(mathFix)
}
var mathFix = fix{
"math",
"2011-09-29",
math,
`Remove the leading F from math functions... | 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 (
"go/ast"
)
func init() {
register(oserrorstringFix)
}
var oserrorstringFix = fix{
"oserrorstring",
"2011-06-22",
oserrorstring,
... | 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 (
"bytes"
"flag"
"fmt"
"go/ast"
"go/parser"
"go/printer"
"go/scanner"
"go/token"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"s... | 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
func init() {
register(go1renameFix)
}
var go1renameFix = fix{
"go1rename",
"2012-02-12",
renameFix(go1renameReplace),
`Rewrite package-lev... | 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 (
"go/ast"
)
func init() {
register(sorthelpersFix)
}
var sorthelpersFix = fix{
"sorthelpers",
"2011-07-08",
sorthelpers,
`Adapt 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 main
import (
"go/ast"
)
func init() {
register(xmlapiFix)
}
var xmlapiFix = fix{
"xmlapi",
"2012-01-23",
xmlapi,
`
Make encoding/xml's API l... | 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 (
"go/ast"
)
func init() {
register(imagenewFix)
}
var imagenewFix = fix{
"imagenew",
"2011-09-14",
imagenew,
`Adapt image.NewXxx ... | 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 (
"go/ast"
)
func init() {
register(httpHeadersFix)
}
var httpHeadersFix = fix{
"httpheaders",
"2011-06-16",
httpheaders,
`Rename ... | 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 (
"fmt"
"go/ast"
"go/parser"
"go/token"
"os"
"path"
"reflect"
"strconv"
"strings"
)
type fix struct {
name string
date 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 main
import (
"go/ast"
"go/token"
)
func init() {
register(procattrFix)
}
var procattrFix = fix{
"procattr",
"2011-03-15",
procattr,
`Adapt c... | 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 "go/ast"
func init() {
register(hmacNewFix)
}
var hmacNewFix = fix{
"hmacnew",
"2012-01-19",
hmacnew,
`Deprecate hmac.NewMD5, hmac.... | 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 (
"go/ast"
)
func init() {
register(imagecolorFix)
}
var imagecolorFix = fix{
"imagecolor",
"2011-10-04",
imagecolor,
`Adapt code ... | 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 (
"go/ast"
)
func init() {
register(netdialFix)
register(tlsdialFix)
register(netlookupFix)
}
var netdialFix = fix{
"netdial",
"20... | 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 (
"go/ast"
)
func init() {
register(netudpgroupFix)
}
var netudpgroupFix = fix{
"netudpgroup",
"2011-08-18",
netudpgroup,
`Adapt 1... | 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 (
"go/ast"
"go/token"
)
func init() {
register(stringssplitFix)
}
var stringssplitFix = fix{
"stringssplit",
"2011-06-28",
strings... | 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.
/*
Fix finds Go programs that use old APIs and rewrites them to use
newer ones. After you update to a new Go release, fix helps make
the necessary changes to y... | 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 (
"go/ast"
)
func init() {
register(httpFinalURLFix)
}
var httpFinalURLFix = fix{
"httpfinalurl",
"2011-05-13",
httpfinalurl,
`Ada... | 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 (
"go/ast"
)
func init() {
register(sortsliceFix)
}
var sortsliceFix = fix{
"sortslice",
"2011-06-26",
sortslice,
`Adapt code from... | 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 "go/ast"
func init() {
register(mapdeleteFix)
}
var mapdeleteFix = fix{
"mapdelete",
"2011-10-18",
mapdelete,
`Use delete(m, k) ins... | 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 (
"go/ast"
"regexp"
"strings"
)
func init() {
register(errorFix)
}
var errorFix = fix{
"error",
"2011-11-02",
errorFn,
`Use erro... | 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 (
"go/ast"
)
func init() {
register(filepathFix)
}
var filepathFix = fix{
"filepath",
"2011-06-26",
filepathFunc,
`Adapt code from... | 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 (
"go/ast"
)
func init() {
register(htmlerrFix)
}
var htmlerrFix = fix{
"htmlerr",
"2011-11-04",
htmlerr,
`Rename html's Tokenizer... | 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 "go/ast"
func init() {
register(url2Fix)
}
var url2Fix = fix{
"url2",
"2012-02-16",
url2,
`Rename some functions in net/url.
http:... | 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 (
"go/ast"
)
func init() {
register(newWriterFix)
}
var newWriterFix = fix{
"newWriter",
"2012-02-14",
newWriter,
`Adapt bufio, gz... | 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 (
"go/ast"
"regexp"
)
func init() {
register(googlecodeFix)
}
var googlecodeFix = fix{
"googlecode",
"2011-11-21",
googlecode,
`R... | 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 (
"go/ast"
)
func init() {
register(osopenFix)
}
var osopenFix = fix{
"osopen",
"2011-04-04",
osopen,
`Adapt os.Open calls to new,... | 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 (
"fmt"
"go/ast"
"go/token"
"os"
"reflect"
"strings"
)
// Partial type checker.
//
// The fact that it is partial is very important... | 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.
// TODO(rsc): Once there is better support for writing
// multi-package commands, this should really be in
// its own package, and then we can drop all the "re... | 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 (
"go/ast"
"go/token"
)
func init() {
register(httpFileSystemFix)
}
var httpFileSystemFix = fix{
"httpfs",
"2011-06-27",
httpfs,
... | 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 (
"go/ast"
"go/token"
)
func init() {
register(httpserverFix)
}
var httpserverFix = fix{
"httpserver",
"2011-03-15",
httpserver,
... | 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 (
"go/ast"
"go/token"
"strings"
)
func init() {
register(timefileinfoFix)
}
var timefileinfoFix = fix{
"time+fileinfo",
"2011-11-2... | 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 (
"go/ast"
)
func init() {
register(ioCopyNFix)
}
var ioCopyNFix = fix{
"iocopyn",
"2011-09-30",
ioCopyN,
`Rename io.Copyn to io.C... | 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 (
"go/ast"
"strings"
)
func init() {
register(go1pkgrenameFix)
}
var go1pkgrenameFix = fix{
"go1rename",
"2011-11-08",
go1pkgrenam... | 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 "go/ast"
func init() {
register(strconvFix)
}
var strconvFix = fix{
"strconv",
"2011-12-01",
strconvFn,
`Convert to new strconv API... | 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 "go/ast"
func init() {
register(urlFix)
}
var urlFix = fix{
"url",
"2011-08-17",
url,
`Move the URL pieces of package http into a n... | 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 (
"go/ast"
)
func init() {
register(imageycbcrFix)
}
var imageycbcrFix = fix{
"imageycbcr",
"2011-12-20",
imageycbcr,
`Adapt code ... | 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 (
"go/ast"
)
func init() {
register(templateFix)
}
var templateFix = fix{
"template",
"2011-11-22",
template,
`Rewrite calls to te... | 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 (
"go/ast"
"strings"
)
func init() {
register(signalFix)
}
var signalFix = fix{
"signal",
"2011-06-29",
signal,
`Adapt code to ty... | 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 (
"go/ast"
)
func init() {
register(hashSumFix)
}
var hashSumFix = fix{
"hashsum",
"2011-11-30",
hashSumFn,
`Pass a nil argument t... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
6g is the version of the gc compiler for the x86-64.
The $GOARCH for these tools is amd64.
It reads .go files and outputs .6 files. The flags are documente... | 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.
// Test basic operation of finalizers.
package main
import (
"runtime"
"time"
)
const N = 250
type A struct {
b *B
n int
}
type B struct {
n i... | 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 |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test the cap predeclared function applied to channels.
package main
func main() {
c := make(chan int, 10)
if len(c) != 0 || cap(c) != 10 {
prin... | Go |
// run
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test reordering of assignments.
package main
import "fmt"
func main() {
p1()
p2()
p3()
p4()
p5()
p6()
p7()
p8()
p9()
}
var gx []int
fu... | Go |
// $G $D/method4a.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 method expressions with arguments.
package main
import "./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 functions and goroutines.
package main
func caller(f func(int, int) int, a, b int, c chan int) {
c <- f(a, b)
}
func gocall(f func(int, int)... | 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 |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test composite literals.
package main
type T struct {
i int
f float64
s string
next *T
}
type R struct {
num int
}
func itor(a int)... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test simple type switches, including chans, maps etc.
package main
import "os"
const (
Bool = iota
Int
Float
String
Struct
Chan
Array
Map
... | 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 |
// true
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// a package that uses unsafe on the inside but not in it's api
package pkg
import "unsafe"
// this should be inlinable
func Float32bits(f float32) ... | Go |
// true
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
// can't use local path with -u, use -I. instead
import "pkg" // ERROR "import unsafe package"
func main() {
print(pkg.Float32bits(1.0... | Go |
// $G $D/pkg.go && pack grc pkg.a pkg.$A 2> /dev/null && rm pkg.$A && errchk $G -I. -u $D/main.go
// rm -f pkg.a
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ignored
| Go |
// $G $D/pkg.go && pack grcS pkg.a pkg.$A 2> /dev/null && rm pkg.$A && $G -I. -u $D/main.go
// rm -f pkg.a
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ignored
| Go |
// 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 on slices.
package main
type T []int
func (t T) Len() int { return len(t) }
type I interface {
Len() int
}
func main() {
var 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.
// Semi-exhaustive test for the copy predeclared function.
package main
import (
"fmt"
"os"
)
const N = 40
var input8 = make([]uint8, N)
var outpu... | 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 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify that erroneous type switches are caught be the compiler.
// Issue 2700, among other things.
// Does not compile.
package main
import ... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test stack splitting code.
// Try to tickle stack splitting bugs by doing
// go, defer, and closure calls at different stack depths.
package main
t... | Go |
// errorcheck
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify goto semantics.
// Does not compile.
//
// Each test is in a separate function just so that if the
// compiler stops processing after ... | Go |
// 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 |
// 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 illegal function signatures are detected.
// Does not compile.
package main
type t1 int
type t2 int
type t3 int
func f1(*t2, 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 literal syntax for basic types.
package main
var nbad int
func assert(cond bool, msg string) {
if !cond {
if nbad == 0 {
print("BUG")
... | 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 the run-time behavior of escape analysis-related optimizations.
package main
func main() {
test1()
}
func test1() {
check1(0)
check1(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 simple type switches on basic types.
package main
import "fmt"
const (
a = iota
b
c
d
e
)
var x = []int{1, 2, 3}
func f(x int, len *by... | Go |
// 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 assignment rules are enforced by the compiler.
// Does not compile.
package main
type (
A [10]int
B []int
C chan int
F func() int... | Go |
// run
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test 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 |
// 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 |
// $G -S $D/$F.go | egrep initdone >/dev/null && echo BUG sinit || true
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that many initializations can be done at link time and
// generate no executab... | Go |
// 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 |
// 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 iota.
package main
func assert(cond bool, msg string) {
if !cond {
print("assertion fail: ", msg, "\n")
panic(1)
}
}
const (
x int = i... | Go |
// run
// Copyright 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 |
// 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 |
// 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 for run-time errors.
// TODO(rsc):
// null pointer accesses
package main
import "strings"
var x = make([]byte, 10)
func main() ... | Go |
// errorcheck
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify that erroneous labels are caught by the compiler.
// This set is caught by pass 1.
// Does not compile.
package main
var x int
func... | Go |
// runoutput
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test source files and strings containing \r and \r\n.
package main
import (
"fmt"
"strings"
)
func main() {
prog = strings.Replace(prog, ... | Go |
// run
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test recovering from runtime errors.
package main
import (
"runtime"
"strings"
)
var didbug bool
func bug() {
if didbug {
return
}
printl... | Go |
// 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 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 reorderings; derived from fixedbugs/bug294.go.
package main
var log string
type TT int
func (t TT) a(s string) TT {
log += "a(" + s + ")"
... | 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 |
// 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 |
// skip # used by import3
// 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.
// Various declarations of exported variables and functions.
// Imported by import3.go.
package p
var C1 chan <- chan int = (chan<... | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.