code stringlengths 10 1.34M | language stringclasses 1
value |
|---|---|
package imap
import (
"bufio"
"bytes"
"fmt"
"io"
"log"
"runtime"
"strings"
"time"
)
type sxKind int
const (
sxNone sxKind = iota
sxAtom
sxString
sxNumber
sxList
)
type sx struct {
kind sxKind
data []byte
number int64
sx []*sx
}
func rdsx(b *bufio.Reader) (*sx, error) {
x := &sx{kind: sxLi... | Go |
package imap
import (
"bytes"
"encoding/base64"
"strings"
"unicode"
)
func decode2047chunk(s string) (conv []byte, rest string, ok bool) {
// s is =?...
// and should be =?charset?e?text?=
j := strings.Index(s[2:], "?")
if j < 0 {
return
}
j += 2
if j+2 >= len(s) || s[j+2] != '?' {
return
}
k := stri... | 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 issue provides access to the Google Code Issue Tracker API.
package issue
import (
"encoding/xml"
"fmt"
"html"
"io"
"net/http"
"net/url"
"os... | 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 ignore
package main
import (
"log"
"net/http"
"code.google.com/p/rsc/appfs/fs"
"code.google.com/p/rsc/issue/dashboard"
)
func main() {
log.S... | 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 dashboard implements the issue dashboard for an
// upcoming Go release.
package dashboard
import (
"bytes"
"encoding/json"
"fmt"
"html/template... | 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 webdriver implements a client for the Selenium WebDriver wire protocol.
// It can be used with the ChromeDriver server and perhaps with the Selenium... | 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 webdriver
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"strings"
"time"
)
type Conn struct {
prefix string
}
type Ses... | Go |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Editpcln displays and edits the file names stored in a Go object file or archive.
//
// Usage:
//
// editpcln [-v] [-r from->to] old.a new.a
//
// Editpcln ... | Go |
// Uploadbot uploads tgz snapshots of Mercurial repositories to the download
// section of a Google Code project.
//
// Usage
//
// Synopsis:
//
// uploadbot [-f] [-pw=pwfile] [-root=rootdir] [project...]
//
// Uploadbot reads from pwfile (default $HOME/codebot.pw) an email address
// and code.google.com-generated pass... | Go |
// Copyright 2014 The Go 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 (
"debug/goobj"
"encoding/json"
"log"
"os"
)
func main() {
f, err := os.Open(os.Args[1])
if err != nil {
log.Fatal(err)
}
pkg, ... | 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.
// Googlecsv prints a spreadsheet from Google Drive in CSV format.
//
// The first time googlecsv is run, it starts a web browser and asks
// the user to authe... | Go |
// Asmlint looks for errors in and sometimes rewrites assembly source files.
package main
import (
"bytes"
"flag"
"fmt"
"go/ast"
"go/build"
"go/parser"
"go/printer"
"go/token"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
)
var (
warnCall = flag.Bool("warncall", false... | 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.
// jfmt reads JSON from standard input, formats it, and writes it to standard output.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"lo... | Go |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Bundle combines all source files for a given package into a single source file,
// optionally adding a prefix to all top-level names.
//
// Usage:
// bundle... | 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.
// Dump Github top languages.
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"net/http"
"regexp"
"sort"
"strconv"
)
var (
langRE = regexp.Mu... | Go |
package main
import (
"flag"
"log"
"os"
"os/exec"
"strings"
"sync"
"syscall"
"time"
"code.google.com/p/goplan9/plan9/acme"
)
var args []string
var win *acme.Win
var needrun = make(chan bool, 1)
var kq struct {
fd int
dir *os.File
m map[string]*os.File
name map[int]string
}
func kadd(fd int) {
k... | 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.
// Crypt is a simple password-based encryption program,
// demonstrating how to use code.google.com/p/rsc/crypt.
//
// Encrypt input to output using password:
... | 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.
// pprof_mac_fix applies a binary patch to the OS X kernel in order to make
// pprof profiling report accurate values.
//
// Warning Warning Warning
//
// This... | 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.
// This program analyzes pprof_mac_fix -dump output to generate the
// "before" assembly listing and a suggested pattern template.
// +build ignore
package m... | 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.
// Labels converts comma-separated-value records to PostScript mailing labels.
// The output is formatted for 8½"×11" sheets containing thirty 2⅝"x1" labels ea... | Go |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Mkzip creates a zip file from a 'proto' file describing the contents.
package main
import (
"archive/zip"
"bufio"
"flag"
"fmt"
"io"
"io/ioutil"
"log... | 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 main
import (
"log"
"os"
"os/exec"
"fmt"
"time"
"path"
"strings"
"strconv"
"syscall"
"code.google.com/p/goplan9/plan9/acme"
)
var _ = fmt.... | 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 main
import (
"bytes"
"flag"
"fmt"
"log"
"os"
"regexp"
"strconv"
"strings"
"sync"
"time"
"code.google.com/p/goplan9/draw"
"code.google.co... | 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 main
import (
"bytes"
"encoding/json"
"encoding/xml"
"flag"
"fmt"
"html"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
"strings"
"co... | 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.
// Dateseq prints a sequence of dates.
//
// dateseq start end
//
// Dateseq prints dates from start to end, in the same format as the arguments.
// Accepted f... | Go |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Acmego watches acme for .go files being written.
// Each time a .go file is written, acmego checks whether the
// import block needs adjustment. If so, it m... | 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 (
"bufio"
"errors"
"io"
)
type importReader struct {
b *bufio.Reader
buf []byte
peek byte
err error
eof bool
nerr int
}
f... | Go |
//line numbers.y:2
package main
import __yyfmt__ "fmt"
//line numbers.y:2
//line numbers.y:5
type yySymType struct {
yys int
expr *Expr
exprlist []*Expr
stmt *Stmt
stmtlist []*Stmt
tok int
op Op
line Line
}
const _LE = 57346
const _GE = 57347
const _EQ = 57348
const _NE = 57349
co... | Go |
// Numbers is a text-based calculator language.
//
// numbers [file...]
//
// Numbers executes the input files given on the command line, or else
// standard input.
//
// The input is a sequence of value definitions, such as:
//
// Tax = Income * Tax Rate
// Tax Rate = 5.3%
// Income = $10,000
//
// The output shows al... | Go |
package main
import (
"io/ioutil"
"log"
"os"
"code.google.com/p/goprotobuf/proto"
"code.google.com/p/rsc/gtfs"
)
func main() {
log.SetFlags(0)
if len(os.Args) != 2 {
log.Fatal("usage: mbta file.pb")
}
pb, err := ioutil.ReadFile(os.Args[1])
if err != nil {
log.Fatal(err)
}
var feed gtfs.FeedMessage
... | 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 main
import (
"bytes"
"crypto/sha1"
"encoding/json"
"flag"
"fmt"
"go/build"
"html/template"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"os/ex... | 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 database implements the database for the scanning cabinet.
package database
import (
"bytes"
"database/sql"
"errors"
"fmt"
"os"
"os/exec"
"p... | 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.
// Scancab is an implementation of a document scanning cabinet.
// A scanning cabinet is like a file cabinet but stores digital scans of documents
// instead o... | 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 plist implements parsing of Apple plist files.
package plist
import (
"bytes"
"fmt"
"reflect"
"strconv"
)
func next(data []byte) (skip, tag, r... | Go |
// +build ignore
package main
import "fmt"
// tables from qrencode-3.1.1/qrspec.c
var capacity = [41]struct {
width int
words int
remainder int
ec [4]int
}{
{0, 0, 0, [4]int{0, 0, 0, 0}},
{21, 26, 0, [4]int{7, 10, 13, 17}}, // 1
{25, 44, 7, [4]int{10, 16, 22, 28}},
{29, 70, 7, [4]int{15, 26, ... | 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 coding implements low-level QR coding details.
package coding
import (
"fmt"
"strconv"
"strings"
"code.google.com/p/rsc/gf256"
)
// Field is ... | 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 qr
// PNG writer for QR codes.
import (
"bytes"
"encoding/binary"
"hash"
"hash/crc32"
)
// PNG returns a PNG image displaying the code.
//
// PN... | 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 qr encodes QR codes.
*/
package qr
import (
"errors"
"image"
"image/color"
"code.google.com/p/rsc/qr/coding"
)
// A Level denotes a QR error ... | 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 libqrencode wraps the C libqrencode library.
// The qr package (in this package's parent directory)
// does not use any C wrapping. This code is he... | 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 resize
import (
"image"
"image/color"
)
// average convert the sums to averages and returns the result.
func average(sum []uint64, w, h int, n uint6... | Go |
package web
import (
"bytes"
"fmt"
"image"
"image/color"
"image/draw"
"image/png"
"net/http"
"strconv"
"strings"
"code.google.com/p/freetype-go/freetype"
"code.google.com/p/rsc/appfs/fs"
"code.google.com/p/rsc/qr"
"code.google.com/p/rsc/qr/coding"
)
func makeImage(req *http.Request, caption, font string... | 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.
/*
QR data layout
qr/
upload/
id.png
id.fix
flag/
id
*/
// TODO: Random seed taken from GET for caching, repeatability.
// TODO: Flag for abuse butto... | 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 websrv provides a stylized way to write HTTP handlers and run an HTTP server.
//
// Overview
//
// An HTTP server using package websrv registers han... | 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.
// S3get fetches a single object from or lists the objects in an S3 bucket.
package main
import (
"flag"
"fmt"
"log"
"os"
"code.google.com/p/rsc/keychai... | 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 cloudprint
import (
"bytes"
"crypto/rand"
"encoding/json"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"net/http/httptest"
"os/exec"
"strin... | 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 cloudprint implements sending and receiving print jobs
// using Google Cloud Print (https://developers.google.com/cloud-print/).
package cloudprint
... | 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 cloudprint
// defaultPPD is the default PPD (capabilities) for a new printer.
var defaultPPD = `*PPD-Adobe: "4.3"
*FormatVersion: "4.3"
*FileVersion: ... | 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.
// XMPP support for talking to Google Cloud Print (only).
package cloudprint
import (
"bufio"
"bytes"
"crypto/tls"
"encoding/base64"
"encoding/xml"
"er... | 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.
// Simple demonstration of a graph interface and
// Dijkstra's algorithm built on top of that interface,
// without using inheritance.
package graph
import "... | 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.
// Rosetta Code-inspired maze generator and solver.
// Demonstrates use of interfaces to separate algorithm
// implementations (graph.ShortestPath, heap.*) fro... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.