code stringlengths 10 1.34M | language stringclasses 1
value |
|---|---|
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Power series package
// A power series is a channel, along which flow rational
// coefficients. A denominator of zer... | Go |
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify channel operations that test for blocking
// Use several sizes and types of operands
package main
import "ru... | Go |
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This version generates up to 100 and checks the results.
// With a channel, of course.
package main
// Send the seq... | Go |
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
var counter uint
var shift uint
func GetValue() uint {
counter++;
return 1 << shift
}
func Send(a, b c... | Go |
// errchk $G -e $D/$F.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
var (
cr <-chan int;
cs chan<- int;
c chan int;
)
func main() {
cr = c; // ok
cs = c; // ok
c = cr; // ERROR "... | Go |
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Power series package
// A power series is a channel, along which flow rational
// coefficients. A denominator of zer... | Go |
// $G $F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func assertequal(is, shouldbe int, msg string) {
if is != shouldbe {
print("assertion fail", msg, "\n");
... | Go |
// $G $F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
type T struct { i int; f float; s string; next *T }
type R struct { num int }
func itor(a int) *R {
r := n... | Go |
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// trivial malloc test
package main
import (
"flag";
"fmt";
"malloc";
)
var chatty = flag.Bool("v", false, "chatty... | Go |
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG wrong result
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
var x int = 1;
if x != 1 { panic("found ", x, ", expected 1\n"); ... | Go |
// $G $D/$F.go && $L $F.$A && ! ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main()
{
var b []int;
var ib interface{} = b;
var m = make(map[interface{}] int);
m[ib] = 1;
}
| Go |
// $G $F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "os"
const (
Bool = iota;
Int;
Float;
String;
Struct;
Chan;
Array;
Map;
Func;
Last;
)
type... | Go |
// $G $F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
print("hello, world\n");
}
| Go |
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "fmt"
type T int
func (t T) String() string {
return fmt.Sprintf("T%d", t);
}
const (
A T = 1<<... | Go |
// errchk $G $D/$F.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
type T struct {a int}
type P *T
type P1 *T
func (p P) val() int { return 1 } // ERROR "receiver"
func (p *P1) val() int {... | Go |
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that basic operations on named types are valid
// and preserve the type.
package main
type Array [10]byte
typ... | Go |
// $G $F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
var a = []int { 1,2, }
var b = [5]int { 1,2,3 }
var c = []int { 1 }
var d = [...]int { 1,2,3 }
func main() {... | Go |
// errchk $G $D/$F.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
var notmain func()
func main() {
var x = &main; // ERROR "address of|invalid"
main = notmain; // ERROR "assign to|inval... | Go |
// errchk $G $F.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
type t1 int;
type t2 int;
type t3 int;
func f1(*t2, x t3); // ERROR "named"
func f2(t1, *t2, x t3); // ERROR "named"
func f3(... | Go |
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This used to crash because the scheduler
// tried to kick off a new scheduling thread for f
// when time.Nanoseconds ... | Go |
// $G $F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
type T struct {
i int
}
type IN interface {
}
func main() {
var i *int;
var f *float;
var s *string;
v... | 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.
package main
import "os"
func main() {
if len(os.Args) != 3 {
panic("argc")
}
if os.Args[1] != "arg1" {
... | Go |
// Copyright 2011 The Snappy-Go 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 snappy implements the snappy block-based compression format.
// It aims for very high speeds and reasonable compression.
//
// The C++ snappy ... | Go |
// Copyright 2011 The Snappy-Go 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 snappy
import (
"encoding/binary"
"errors"
"io"
)
var (
// ErrCorrupt reports that the input is invalid.
ErrCorrupt = errors.New("snappy: ... | Go |
// Copyright 2011 The Snappy-Go 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 snappy
import (
"encoding/binary"
"io"
)
// We limit how far copy back-references can go, the same as the C++ code.
const maxOffset = 1 << 15... | Go |
package foo
/*
#cgo LDFLAGS: -lmy-c-lib
#include "my-c-lib.h"
#include <stdlib.h>
*/
import "C"
import "unsafe"
func MyBye(msg string) {
c_msg := C.CString(msg)
defer C.free(unsafe.Pointer(c_msg))
C.my_c_bye(c_msg)
}
| Go |
// By: Tom Wambold <tom5760@gmail.com>
package main
import "other"
func main() {
a := other.Vector3 {1, 2, 3};
a.Size();
return;
}
| Go |
package main
import "foo"
func main() {
foo.MyHello("hello from my-c-lib\n")
foo.MyBye("bye from my-c-lib\n")
}
// EOF
| 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 |
package other
type Foo interface {
Get(i int, j int) float64;
Set(i int, j int, v float64);
}
| Go |
// By: Tom Wambold <tom5760@gmail.com>
package other
import "math"
// A three-value vector (i, j, k)
type Vector3 [3]float64
func (a *Vector3) Size() float64 {
return math.Sqrt(float64(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]));
}
| Go |
package foo
/*
#cgo LDFLAGS: -lmy-c-lib
#include "my-c-lib.h"
#include <stdlib.h>
*/
import "C"
import "unsafe"
func MyHello(msg string) {
c_msg := C.CString(msg)
defer C.free(unsafe.Pointer(c_msg))
C.my_c_hello(c_msg)
}
| 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 gmp
// #include <gmp.h>
// #include <stdlib.h>
// #cgo LDFLAGS: -lgmp
import "C"
import (
"os"
"unsafe"
)
/*
* one of a kind
*/
// An Int repre... | 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.
// Compute Fibonacci numbers with two goroutines
// that pass integers back and forth. No actual
// concurrency, just threads and synchronization
// and forei... | 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.
/*
A trivial example of wrapping a C library in Go.
For a more complex example and explanation,
see ../gmp/gmp.go.
*/
package stdio
/*
#include <stdio.h>
#in... | 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 "cgo/stdio"
func main() {
stdio.Stdout.WriteString(stdio.Greeting + "\n")
}
| 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.
// Pass numbers along a chain of threads.
package main
import (
"runtime"
"cgo/stdio"
"strconv"
)
const N = 10
const R = 5
func link(left chan<- int, ri... | Go |
package gmp
/*
#include <stdio.h>
*/
import "C"
// EOF
| Go |
// Copyright 2012, Google Inc. 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"
"math/rand"
"os"
"sync"
"time"
"code.google.com/p/vitess/go/vt/client2/tablet"
)
func main() {
goroutines := flag.Int... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgzip
/*
#cgo pkg-config: zlib
#include "zlib.h"
*/
import "C"
import (
"hash"
"unsafe"
)
type crc32Hash struct {
crc C.uLong
}
// an empty buffer ... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgzip
// See http://www.zlib.net/zlib_how.html for more information on this
/*
#cgo pkg-config: zlib
#include "zlib.h"
// deflateInit2 is a macro, so u... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgzip
/*
#cgo pkg-config: zlib
#include "zlib.h"
*/
import "C"
import (
"hash"
"unsafe"
)
type adler32Hash struct {
adler C.uLong
}
// an empty buf... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgzip
/*
#cgo pkg-config: zlib
#include "zlib.h"
// inflateInit2 is a macro, so using a wrapper function
int cgzipInflateInit(z_stream *strm) {
strm... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package bytes2 gives you alternate implementations of functionality
// similar to go's bytes package
package bytes2
import (
"code.google.com/p/vitess/go/hac... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package proto
import (
"bytes"
"code.google.com/p/vitess/go/bson"
"code.google.com/p/vitess/go/bytes2"
"code.google.com/p/vitess/go/sqltypes"
)
func Marshal... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package proto
import (
"code.google.com/p/vitess/go/sqltypes"
)
type Field struct {
Name string
Type int64
}
type QueryResult struct {
Fields []Field
... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package mysql
/*
#cgo pkg-config: gomysql
#include <stdlib.h>
#include "vtmysql.h"
*/
import "C"
import (
"fmt"
"unsafe"
"code.google.com/p/vitess/go/mysql/p... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package snitch
import (
"code.google.com/p/vitess/go/relog"
"fmt"
"net/http"
"runtime"
)
const (
BaseUrl = "/debug/snitch"
)
type SnitchCmd struct {
url ... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package stats
import (
"encoding/json"
"expvar"
"sync"
"time"
)
type CountTracker interface {
Counts() map[string]int64
}
type Rates struct {
mu ... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package stats
// Ring of int64 values
// Not thread safe
type RingInt64 struct {
position int
values []int64
}
func NewRingInt64(capacity int) *RingInt64 {
... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package stats
import (
"encoding/json"
"expvar"
"fmt"
"sync"
"time"
)
type Timings struct {
mu sync.Mutex
TotalCount int64
TotalTime int64
Hist... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package stats
import (
"bytes"
"expvar"
"fmt"
"sync"
"time"
)
// The States structure keeps historical data about a state machine
// state, and exports them... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package stats
import (
"bytes"
"expvar"
"fmt"
"sync"
)
type Counters struct {
mu sync.Mutex
counts map[string]int64
}
func NewCounters(name string) *C... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package stats
import (
"bytes"
"expvar"
"fmt"
"sync"
)
type Histogram struct {
cutoffs []int64
labels []string
countLabel string
totalLabel string... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package stats
// StrFunc converts any function that returns a JSON string into
// an expvar.Var compatible object.
type StrFunc func() string
func (f StrFunc) St... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package bson
import (
"io"
"math"
"reflect"
"strconv"
"time"
"code.google.com/p/vitess/go/bytes2"
)
var (
TimeType = reflect.TypeOf(time.Time{})
BytesT... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package bson
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"math"
"reflect"
"strconv"
"time"
)
// BSON documents are lttle endian
var Pack = b... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Utility functions for custom encoders
package bson
import (
"code.google.com/p/vitess/go/bytes2"
)
func EncodeStringArray(buf *bytes2.ChunkedWriter, name st... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Utility functions for custom decoders
package bson
import (
"bytes"
"math"
"strconv"
"time"
)
var (
emptybytes = []byte{}
)
func DecodeString(buf *byte... | Go |
// Copyright 2012, Google Inc. 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 (
"syscall"
"unsafe"
)
// IsTerminal returns true if the given file descriptor is a terminal.
func IsTerminal(fd uintptr) bool {
var t... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package timer provides timer functionality that can be controlled
by the user. You start the timer by providing it a callback function,
which it will call at... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package logfile
import (
"fmt"
"io"
"os"
"path"
"path/filepath"
"sync"
"time"
)
type Logfile struct {
sync.Mutex
baseName string
frequency int64
maxS... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package memcache
import (
"bufio"
"fmt"
"io"
"net"
"strconv"
"strings"
)
type Connection struct {
conn net.Conn
buffered bufio.ReadWriter
}
func Con... | Go |
// Copyright 2013, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sync2
import (
"sync/atomic"
)
type AtomicInt32 int32
func (i *AtomicInt32) Add(n int32) int32 {
return atomic.AddInt32((*int32)(i), n)
}
func (i *At... | Go |
package sync2
// What's in a name? Channels have all you need to emulate a counting
// semaphore with a boatload of extra functionality. However, in some
// cases, you just want a familiar API.
import ()
type Semaphore interface {
Acquire()
Release()
}
type semaphore struct {
slots chan bool
}
func NewSemaphore... | Go |
package streamlog
import (
"expvar"
"io"
"net/http"
"net/url"
"sync"
"sync/atomic"
"code.google.com/p/vitess/go/relog"
)
var droppedMessages = expvar.NewMap("streamlog-dropped-messages")
// A StreamLogger makes messages sent to it available through HTTP.
type StreamLogger struct {
dataQueue chan Formatter
... | 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 rpcplus
/*
Some HTML presented at http://machine:port/debug/rpc
Lists services, their methods, and some statistics, still rudimentary.
*/
import (
... | 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 jsonrpc
import (
"encoding/json"
"errors"
"io"
"sync"
rpc "code.google.com/p/vitess/go/rpcplus"
)
type serverCodec struct {
dec *json.Decoder ... | 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 jsonrpc implements a JSON-RPC ClientCodec and ServerCodec
// for the rpc package.
package jsonrpc
import (
"encoding/json"
"fmt"
"io"
"net"
"s... | 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 rpc provides access to the exported methods of an object across a
network or other I/O connection. A server registers an object, making it visible... | 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 rpcplus
import (
"bufio"
"encoding/gob"
"errors"
"io"
"log"
"net"
"net/http"
"reflect"
"sync"
)
// ServerError represents an error that has b... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package hack gives you some efficient functionality at the cost
// breaking some go rules
package hack
import (
"reflect"
"unsafe"
)
// StringArena lets yo... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package umgmt
import (
"fmt"
"net"
"os"
"syscall"
)
func SendFd(conn *net.UnixConn, file *os.File) error {
rights := syscall.UnixRights(int(file.Fd()))
dum... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package umgmt
import (
"code.google.com/p/vitess/go/relog"
"expvar"
"net"
"net/http"
"strings"
"sync"
)
var connectionCount = expvar.NewInt("connection-cou... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The micromanagment module provides a tiny server running on a unix
// domain socket.
//
// It is meant as an alternative to signals for handling graceful
// ser... | Go |
package main
import (
"code.google.com/p/vitess/go/umgmt"
"flag"
)
var sockPath = flag.String("sock-path", "", "")
func main() {
flag.Parse()
println("sock path: ", *sockPath)
uc, err := umgmt.Dial(*sockPath)
if err != nil {
panic(err)
}
msg, err := uc.Ping()
if err != nil {
panic(err)
}
println("msg:... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package umgmt
import (
"io"
"net"
"net/rpc"
"code.google.com/p/vitess/go/relog"
)
type Client struct {
*rpc.Client
conn io.ReadWriteCloser
}
func Dial(ad... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package pools provides functionality to manage and reuse resources
like connections.
*/
package pools
import (
"fmt"
"sync"
"time"
)
// Factory is a func... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package pools
import (
"errors"
"fmt"
"sync"
"time"
)
// Numbered allows you to manage resources by tracking them with numbers.
// There are no interface res... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ioutil2
import (
"io"
"io/ioutil"
"os"
"path"
)
// Write file to temp and atomically move when everything else succeeds.
func WriteFileAtomic(filenam... | Go |
// Copyright 2012, Google Inc. 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"
_ "net/http/pprof"
"os"
"code.google.com/p/vitess/go/relog"
rpc "code.google.com/p/vitess/go/rpcplus"
"code.google.com/... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// vt binlog server: Serves binlog for out of band replication.
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"io"
"os"
"os/signal"
"path"
"strconv"... | Go |
// Copyright 2012, Google Inc. 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"
"net/url"
"os"
"strings"
"code.google.com/p/vitess/go/relog"
"code.google.com/p/vitess/go/vt/dbconfigs"
"code.g... | Go |
// Copyright 2012, Google Inc. 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"
"flag"
"fmt"
"log"
"os"
"strings"
"code.google.com/p/vitess/go/relog"
"code.google.com/p/vitess/go/zk/zkctl"
)
var usage =... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// vt tablet server: Serves queries and performs housekeeping jobs.
package main
import (
"expvar"
"flag"
"fmt"
"io"
"log"
"net/http"
_ "net/http/pprof"
"... | Go |
// Copyright 2012, Google Inc. 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"
"database/sql/driver"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"log/syslog"
"os"
"os/signal"
"path"
"sort"
"strconv"
"strin... | Go |
// Copyright 2012, Google Inc. 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 (
"expvar"
"flag"
"fmt"
"log"
"net/http"
_ "net/http/pprof"
"os"
"code.google.com/p/vitess/go/jscfg"
"code.google.com/p/vitess/go/re... | Go |
// Copyright 2012, Google Inc. 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"
"sync/atomic"
"time"
"code.google.com/p/vitess/go/rpcplus"
"code.google.com/p/vitess/go/rpcwrap/bsonrpc"
"... | Go |
// Copyright 2012, Google Inc. 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 (
"database/sql"
"flag"
"fmt"
"log"
"os"
"strings"
"time"
_ "code.google.com/p/vitess/go/vt/client2"
_ "code.google.com/p/vitess/go/... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// normalizer takes a file of sql statements as input and converts the
// statements into normalized sql statements with bind variables.
package main
import (
"b... | Go |
package main
import (
"archive/zip"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"os/signal"
"path"
"sort"
"strings"
"sync"
"syscall"
"time"
opts "code.google.com/p/opts-go"
"code.google.com/p/vitess/go/terminal"
"code.google.com/p/vitess/go/zk"
"launchpad.net/gozk/zookeeper"
)
var zkAddrs = opts.LongSin... | Go |
// Copyright 2012, Google Inc. 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 (
"encoding/json"
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
_ "net/http/pprof"
"os"
"os/signal"
"syscall"
"code.google.com/p/vitess/... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package sqltypes implements interfaces and types that represent SQL values.
package sqltypes
import (
"encoding/base64"
"encoding/gob"
"encoding/json"
"fmt... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package bsonrpc
import (
"bytes"
"code.google.com/p/vitess/go/bson"
"code.google.com/p/vitess/go/bytes2"
rpc "code.google.com/p/vitess/go/rpcplus"
)
type Req... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package bsonrpc
import (
"io"
"time"
"code.google.com/p/vitess/go/bson"
"code.google.com/p/vitess/go/bytes2"
rpc "code.google.com/p/vitess/go/rpcplus"
"cod... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rpcwrap
import (
"bufio"
"errors"
"io"
"net"
"net/http"
"time"
"code.google.com/p/vitess/go/relog"
rpc "code.google.com/p/vitess/go/rpcplus"
"co... | Go |
package proto
type Context struct {
RemoteAddr string
Username string
}
| Go |
package auth
import (
"crypto/hmac"
"crypto/md5"
"crypto/rand"
"encoding/binary"
"encoding/hex"
"fmt"
"os"
"time"
)
func CRAMMD5GetChallenge() (string, error) {
var randDigits uint32
err := binary.Read(rand.Reader, binary.LittleEndian, &randDigits)
if err != nil {
return "", err
}
timestamp := time.No... | Go |
package auth
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"strings"
"code.google.com/p/vitess/go/relog"
rpc "code.google.com/p/vitess/go/rpcplus"
"code.google.com/p/vitess/go/rpcwrap/proto"
)
// UnusedArgument is a type used to indicate an argument that is
// necessary because of net/rpc requirements.... | Go |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package jsonrpc
import (
"time"
rpc "code.google.com/p/vitess/go/rpcplus"
oldjson "code.google.com/p/vitess/go/rpcplus/jsonrpc"
"code.google.com/p/vitess/go/... | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.