code stringlengths 10 1.34M | language stringclasses 1
value |
|---|---|
// Copyright 2013 Tumblr, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | Go |
// Copyright 2013 Tumblr, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | Go |
// Copyright 2013 Tumblr, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | Go |
// Copyright 2013 Tumblr, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | Go |
// Copyright 2013 Petar Maymounkov
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... | Go |
// Copyright 2013 Petar Maymounkov
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... | Go |
// Program gps, short for "go path setter", is a utility for managing GOPATH variables, useful when working with multiple copies of the same source repo.
package main
import (
"bytes"
"flag"
"fmt"
"os"
"path"
"path/filepath"
//"strconv"
"strings"
)
func usage() {
fatal("gps +|-|. {index of jail, if multiple ... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package appengine_internal
import (
"bytes"
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"strings"
"sync"
"sync/atomic"
"ti... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Package appengine_internal provides support for package appengine.
//
// Programs should not use this package directly. Its API is not stable.
// Use packages... | Go |
package appengine_internal
// This file implements hooks for applying datastore transactions.
import (
"reflect"
pb "appengine_internal/datastore"
)
var transactionSetters = make(map[reflect.Type]reflect.Value)
// RegisterTransactionSetter registers a function that sets transaction information
// in a protocol b... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package appengine_internal
import (
"log"
"net/http"
"strconv"
"strings"
"github.com/golang/protobuf/proto"
pb "appengine_internal/modules"
)
// These ... | Go |
// Copyright 2013 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package init provides initialization that must happen before any App Engine
user code runs. It is imported in apps built by go-appengine-builder.
*/
package i... | Go |
// Copyright 2013 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package init
import "os"
func init() {
os.DisableWritesForAppEngine = true
}
| Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package appengine_internal
// These functions are implementations of the wrapper functions
// in ../appengine/identity.go. See that file for commentary.
func A... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package appengine_internal
import (
"strings"
)
func parseFullAppID(appid string) (partition, domain, displayID string) {
if i := strings.Index(appid, "~"); ... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package main
import (
"go/ast"
)
var datastoreKeyFix = fix{
"datastore_key",
"2011-09-15",
datastoreKey,
`Add an appengine.Context argument to datastore.N... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package main
import (
"go/ast"
)
var blobstoreUploadOptionsFix = fix{
"blobstore_upload_options",
"2011-09-15",
blobstoreUploadOptions,
"Add an options ar... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package main
import (
"go/ast"
)
var datastoreTransactionOptionsFix = fix{
"datastore_transaction_options",
"2011-09-22",
datastoreTransactionOptions,
"Ad... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package main
import (
"go/ast"
)
var taskqueueFix = fix{
"taskqueue",
"2011-09-15",
taskqueue,
`Update the names of appengine/taskqueue functions.`,
}
fu... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"text/template"
)
// MakeMain creates the synthetic main package for a Go App Engine app.
func MakeMain(app *App) (string, erro... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package main
import (
"strings"
)
func parseToolFlags(s string) []string {
// Manual split to handle backslash escaped commas.
// This doesn't need to be pa... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"errors"
"fmt"
"go/ast"
"go/build"
"go/parser"
"go/scanner"
"go/token"
"io/ioutil"
"log"
"math/rand"
"os"
"path/filep... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
go-app-builder is a program that builds Go App Engine apps.
It takes a list of source file names, loads and parses them,
deduces their package structure, cre... | Go |
// To be placed in the output Go repo at cmd/go.
package main
import (
"path/filepath"
)
var cmdDeploy = &Command{
UsageLine: "deploy [deploy flags] [ application_dir | package | yaml_files...]",
Short: "deploys your application to App Engine",
Long: `
Deploy uploads your application files to Google App Engi... | Go |
// To be placed in the output Go repo at cmd/go.
package main
import (
"errors"
"fmt"
"go/build"
"os"
"os/exec"
"os/signal"
"path/filepath"
"strconv"
"strings"
)
var cmdServe = &Command{
UsageLine: "serve [serve flags] [application_dir | package | yaml_files...]",
Short: "starts a local development Ap... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Package urlfetch provides an http.RoundTripper implementation
// for fetching URLs via App Engine's urlfetch service.
package urlfetch
import (
"errors"
"f... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package datastore
import (
"fmt"
"reflect"
"time"
"appengine"
pb "appengine_internal/datastore"
)
var (
typeOfBlobKey = reflect.TypeOf(appengine.Blo... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package datastore
import (
"errors"
"appengine"
"appengine_internal"
"github.com/golang/protobuf/proto"
pb "appengine_internal/datastore"
)
func init() ... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package datastore
import (
"fmt"
"reflect"
"strings"
"sync"
"unicode"
)
// Entities with more than this many indexed properties will not be saved.
const m... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package datastore
import (
"errors"
"fmt"
"math"
"reflect"
"time"
"appengine"
"github.com/golang/protobuf/proto"
pb "appengine_internal/datastore"
)
... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package datastore
import (
"encoding/base64"
"errors"
"fmt"
"math"
"reflect"
"strings"
"appengine"
"github.com/golang/protobuf/proto"
pb "appengine_i... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package datastore
import (
"bytes"
"encoding/base64"
"encoding/gob"
"errors"
"fmt"
"strconv"
"strings"
"appengine"
basepb "appengine_internal/base"
"... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package datastore provides a client for App Engine's datastore service.
Basic Operations
Entities are the unit of storage and are associated with a key. A ... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package datastore
import (
"errors"
"fmt"
"reflect"
"appengine"
"appengine_internal"
"github.com/golang/protobuf/proto"
pb "appengine_internal/datastor... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// This file provides error functions for common API failure modes.
package appengine
import (
"fmt"
"appengine_internal"
)
// IsOverQuota reports whether ... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package capability exposes information about outages and scheduled downtime
for specific API capabilities.
Example:
if !capability.Enabled(c, "datastore_v3"... | Go |
package remote_api
// This file provides the client for connecting remotely to a user's production
// application.
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"math/rand"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"time"
"appengine"
"appengine_internal"
pb "appengine_internal/remote_api"
"github.c... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package remote_api implements the /_ah/remote_api endpoint.
This endpoint is used by offline tools such as the bulk loader.
*/
package remote_api
import (
"... | Go |
package aetest
import (
"bufio"
"crypto/rand"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
"path/filepath"
"regexp"
"time"
"appengine_internal"
)
// Instance represents a running instance of the development API Server.
type Instance interface {
// Close kills the child api_server.py proces... | Go |
// Copyright 2013 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package aetest provides an appengine.Context for use in tests.
An example test file:
package foo_test
import (
"testing"
"appengine/memcache"
"app... | Go |
package aetest
import (
"hash/crc32"
"net/http"
"strconv"
"appengine/user"
)
// Login causes the provided Request to act as though issued by the given user.
func Login(u *user.User, req *http.Request) {
req.Header.Set("X-AppEngine-User-Email", u.Email)
id := u.ID
if id == "" {
id = strconv.Itoa(int(crc32.Ch... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package mail provides the means of sending email from an
App Engine application.
Example:
msg := &mail.Message{
Sender: "romeo@montague.com",
To: ... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package user
import (
"net/http"
"appengine"
)
const (
hEmail = "X-AppEngine-User-Email"
hFederatedIdentity = "X-AppEngine-User-Federated-Iden... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Package user provides a client for App Engine's user authentication service.
package user
import (
"strings"
"appengine"
"appengine_internal"
"github.co... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package user
import (
"appengine"
pb "appengine_internal/user"
)
// CurrentOAuth returns the user associated with the OAuth consumer making this
// request.... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package socket provides outbound network sockets.
*/
package socket
import (
"fmt"
"io"
"net"
"strconv"
"time"
"appengine"
"appengine_internal"
pb "... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package taskqueue provides a client for App Engine's taskqueue service.
Using this service, applications may perform work outside a user's request.
A Task ma... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Package memcache provides a client for App Engine's distributed in-memory
// key-value store for small chunks of arbitrary data.
//
// The fundamental operati... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package runtime exposes information about the resource usage of the application.
It also provides a way to run code in a new background context of a module.
*... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package file
import (
"bufio"
"errors"
"fmt"
"io"
"strings"
"appengine"
pb "appengine_internal/files"
"github.com/golang/protobuf/proto"
)
const write... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Package file provides a client for Google Cloud Storage.
//
// NOTE: The Files API was deprecated on June 11, 2013 (v1.8.1) and will
// be shut down soon, at ... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package file
import (
"errors"
"fmt"
"io"
"os"
"sync"
"appengine"
blobpb "appengine_internal/blobstore"
filepb "appengine_internal/files"
"github.com/... | Go |
// Copyright 2013 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package appengine
import (
"time"
"appengine_internal"
)
// IsTimeoutError reports whether err is a timeout error.
func IsTimeoutError(err error) bool {
if... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Package image provides image services.
package image
import (
"fmt"
"net/url"
"appengine"
"appengine_internal"
pb "appengine_internal/image"
)
type Se... | Go |
// Copyright 2014 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package search
import (
"fmt"
"reflect"
)
// Field is a name/value pair. A search index's document can be loaded and
// saved as a sequence of Fields.
type F... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package search provides a client for App Engine's search service.
Indexes contains documents, and a document's contents are a mapping from case-
sensitive fi... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package channel implements the server side of App Engine's Channel API.
Create creates a new channel associated with the given clientID,
which must be unique... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package delay provides a way to execute code outside the scope of a
user request by using the taskqueue API.
To declare a function that may be executed later... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Package blobstore provides a client for App Engine's persistent blob
// storage service.
//
// NOTE: The Files API was deprecated on June 11, 2013 (v1.8.1) an... | Go |
// Copyright 2013 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package cloudsql
import (
"errors"
"net"
)
func connect(instance string) (net.Conn, error) {
return nil, errors.New("cloudsql: not supported in dev yet")
}
| Go |
// Copyright 2013 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package cloudsql exposes access to Google Cloud SQL databases.
This package is intended for MySQL drivers to make App Engine-specific connections.
Applicati... | Go |
/*
Package module provides functions for interacting with modules.
The appengine package contains functions that report the identity of the app,
including the module name.
*/
package module
import (
"appengine"
pb "appengine_internal/modules"
"github.com/golang/protobuf/proto"
)
// List returns the names of modul... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package log provides the means of querying an application's logs from
within an App Engine application.
Example:
c := appengine.NewContext(r)
query := &log... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package appengine
import (
"fmt"
"regexp"
"appengine_internal"
basepb "appengine_internal/base"
"github.com/golang/protobuf/proto"
)
// Namespace returns... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Package appengine provides basic functionality for Google App Engine.
//
// For more information on how to write Go apps for Google App Engine, see:
// https:... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
/*
Package xmpp provides the means to send and receive instant messages
to and from users of XMPP-compatible services.
To send a message,
m := &xmpp.Message{
... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package appengine
import (
"strings"
"time"
"appengine_internal"
pb "appengine_internal/app_identity"
modpb "appengine_internal/modules"
)
// AppID retur... | Go |
package main
// Simple tool which lists the entity kinds, and a sample for each, for an
// app engine app.
//
// This tool can be invoked using the goapp tool bundled with the SDK.
// $ goapp run demos/remote_api/datastore_info.go \
// -email admin@example.com \
// -host my-app.appspot.com \
// -password_file ~/... | 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 moustachio
import (
"image"
"image/color"
"image/draw"
"code.google.com/p/freetype-go/freetype/raster"
)
// moustache draws a moustache of the sp... | 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.
// On App Engine, the framework sets up main; we should be a different package.
package moustachio
import (
"bytes"
"crypto/sha1"
"fmt"
"html/template"
"i... | 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"
)
// Resize returns a scaled copy of the image slice r of m.
// The returned image has width w and height h.
f... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package mandelbrot
import (
"bytes"
"encoding/json"
"fmt"
"html/template"
"image"
"image/color"
"image/png"
"net/http"
"strconv"
"time"
"appengine"
... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package counter
import (
"fmt"
"io"
"net/http"
"strconv"
"appengine"
"appengine/memcache"
)
func serveError(c appengine.Context, w http.ResponseWriter, ... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package later
import (
"fmt"
"net/http"
"appengine"
"appengine/delay"
)
func init() {
http.HandleFunc("/", handle)
}
func handle(w http.ResponseWriter, ... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Package frontend implements a frontend to the example memcache module.
// TODO: Demonstrate sharding across multiple instances.
package frontend
import (
"f... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Package memcache implements a simple memcache-alike.
package memcache
import (
"io"
"net/http"
"strconv"
"sync"
"appengine"
)
func init() {
http.Hand... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package id
import (
"fmt"
"net/http"
"os"
"appengine"
)
func init() {
http.HandleFunc("/id", handleID)
}
func handleID(w http.ResponseWriter, r *http.Re... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package transaction
// This app demonstrates the datastore transaction API.
//
// A bank account is initialized with 4 million dollars, and 10 concurrent
// wit... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package guestbook
import (
"html/template"
"net/http"
"time"
"appengine"
"appengine/datastore"
"appengine/user"
)
type Greeting struct {
Author string... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package helloworld
import (
"fmt"
"net/http"
)
func init() {
http.HandleFunc("/", handle)
}
func handle(w http.ResponseWriter, r *http.Request) {
fmt.Fpri... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package logviewer
import (
"encoding/base64"
"errors"
"html/template"
"net/http"
"strconv"
"strings"
"appengine"
"appengine/log"
)
// appLevel holds d... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"io"
"os"
"fmt"
)
var stdout io.Writer = os.Stdout
// This is the standard writer that prints to standard output.
type ConsoleLogWriter chan *LogRecord
// This creates a new ConsoleLogWriter
func NewConsoleLo... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"fmt"
"bytes"
"io"
)
const (
FORMAT_DEFAULT = "[%D %T] [%L] (%S) %M"
FORMAT_SHORT = "[%t %d] [%L] %M"
FORMAT_ABBREV = "[%L] %M"
)
type formatCacheType struct {
LastUpdateSeconds int64
shortTime, sho... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"errors"
"os"
"fmt"
"strings"
)
var (
Global Logger
)
func init() {
Global = NewDefaultLogger(DEBUG)
}
// Wrapper for (*Logger).LoadConfiguration
func LoadConfiguration(filename string) {
Global.LoadConfi... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"os"
"fmt"
"time"
)
// This log writer sends output to a file
type FileLogWriter struct {
rec chan *LogRecord
rot chan bool
// The opened file
filename string
file *os.File
// The logging format
fo... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"encoding/xml"
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"
)
type xmlProperty struct {
Name string `xml:"name,attr"`
Value string `xml:",chardata"`
}
type xmlFilter struct {
Enabled string `xml:"... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
// Package log4go provides level-based and highly configurable logging.
//
// Enhanced Logging
//
// This is inspired by the logging functionality in Java. Essentially, you create a Logger
// object and create output filters for it. You ... | Go |
package main
import (
"flag"
"fmt"
"net"
"os"
)
var (
port = flag.String("p", "12124", "Port number to listen on")
)
func e(err error) {
if err != nil {
fmt.Printf("Erroring out: %s\n", err)
os.Exit(1)
}
}
func main() {
flag.Parse()
// Bind to the port
bind, err := net.ResolveUDPAddr("0.0.0.0:" + *po... | Go |
package main
import (
"time"
)
import l4g "code.google.com/p/log4go"
func main() {
log := l4g.NewLogger()
log.AddFilter("stdout", l4g.DEBUG, l4g.NewConsoleLogWriter())
log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
}
| Go |
package main
import (
"time"
)
import l4g "code.google.com/p/log4go"
func main() {
log := l4g.NewLogger()
log.AddFilter("network", l4g.FINEST, l4g.NewSocketLogWriter("udp", "192.168.1.255:12124"))
// Run `nc -u -l -p 12124` or similar before you run this to see the following message
log.Info("The time is now: ... | Go |
package main
import (
"bufio"
"fmt"
"io"
"os"
"time"
)
import l4g "code.google.com/p/log4go"
const (
filename = "flw.log"
)
func main() {
// Get a new logger instance
log := l4g.NewLogger()
// Create a default logger that is logging messages of FINE or higher
log.AddFilter("file", l4g.FINE, l4g.NewFileLo... | Go |
package main
import l4g "code.google.com/p/log4go"
func main() {
// Load the configuration (isn't this easy?)
l4g.LoadConfiguration("example.xml")
// And now we're ready!
l4g.Finest("This will only go to those of you really cool UDP kids! If you change enabled=true.")
l4g.Debug("Oh no! %d + %d = %d!", 2, 2, 2... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"encoding/json"
"fmt"
"net"
"os"
)
// This log writer sends output to a socket
type SocketLogWriter chan *LogRecord
// This is the SocketLogWriter's output method
func (w SocketLogWriter) LogWrite(rec *LogRec... | Go |
// Copyright 2010 The Govt 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 vt
import (
"fmt"
)
func (s Score) String() string {
ret := ""
for i := 0; i < Scoresize; i++ {
ret = fmt.Sprintf("%s%02x", ret, s[i])
}
re... | Go |
// Copyright 2010 The Govt 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 vtsrv
import (
"code.google.com/p/govt/vt"
"fmt"
"io"
"net/http"
"sync"
)
var mux sync.RWMutex
var stat map[string]http.Handler
func register(... | Go |
// Copyright 2010 The Govt 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 vtsrv
import (
"code.google.com/p/govt/vt"
"fmt"
"log"
"net"
"strings"
"sync"
)
const (
Cnew = iota
Chello
)
const (
DbgPrintCalls = 1 <<... | Go |
// Copyright 2010 The Govt Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// Based on Eric van Hensbergen's C implementation
// http://bitbucket.org/ericvh/vdiskfs/src/tip/src/cmd/venti/grande.c
package main
import (
"code.goo... | Go |
// Copyright 2010 The Govt 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 (
"code.google.com/p/govt/vt"
"code.google.com/p/govt/vt/vtsrv"
"crypto/sha1"
"flag"
"hash"
"sync"
)
type Vtram struct {
vtsrv.S... | Go |
// Copyright 2010 The Govt Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// Based on Ron Minnich's idea.
package main
import (
"code.google.com/p/govt/vt"
"code.google.com/p/govt/vt/vtsrv"
"crypto/sha1"
"errors"
"flag"
"... | Go |
// Copyright 2010 The Govt 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 vt
import "strings"
// Venti messages
const (
Rerror = 1
Tping = 2
Rping = 3
Thello = 4
Rhello = 5
Tgoodbye = 6
Tread = 12
Rread = 1... | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.