CombinedText stringlengths 4 3.42M |
|---|
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package state
import (
"bytes"
"io"
"io/ioutil"
"github.com/juju/errors"
"github.com/juju/testing"
"github.com/juju/juju/resource"
)
type stubRawState struct {
stub *testing.Stub
ReturnPersistence Persistence
Ret... |
package main
import (
"encoding/json"
"flag"
"io/ioutil"
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/log"
)
const (
namespace = "resourcemanager"
)
var (
listenAddress = flag.String("web.listen-address", ":9088", "Address on which to expose metrics and web interfa... |
package config
import (
"errors"
"fmt"
"io/ioutil"
"github.com/BurntSushi/toml"
)
const (
DefaultPort = "29300"
DefaultLogLevel = "error"
DefaultTimeout = 5
DefaultMaxIdleConnsPerHost = 100
)
type Config struct {
Port string
LogLevel string
... |
/* Goiardi configuration. */
/*
* Copyright (c) 2013-2014, Jeremy Bingham (<jbingham@gmail.com>)
*
* 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... |
package config
import (
"io/ioutil"
"os"
"gopkg.in/yaml.v2"
)
// Match describes a comment substring match and the associated
// transformations if the transaction matches.
type Replace struct {
// Treat it as a match if we see this as a substring in a comment
Comment string
// Change the payee to this
Payee ... |
package config
var GlobalConfig SystemConfig
type SystemConfig struct {
HostName string `toml:"host_name"`
EndpointUser string `toml:"endpoint_user"`
EndpointName string `toml:"endpoint_name"`
EndpointURL string `toml:"endpoint_url"`
MaxCacheSize int `toml:"max_cache_size"`
EndpointP... |
// Package config implements chat service config.
package config
import (
"encoding/json"
"fmt"
"log"
"os"
)
// ServiceConfig is a chat service config.
type ServiceConfig struct {
Address string `json:"address"`
WorkDir string `json:"work_dir"`
AdminEmail string `json:"admin_email"`
SM... |
// Package config contains the configuration logic for CFSSL.
package config
import (
"crypto/x509"
"encoding/asn1"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"regexp"
"strconv"
"strings"
"time"
"github.com/cloudflare/cfssl/auth"
cferr "github.com/cloudflare/cfssl/errors"
"github.com/cloudflare/cfssl/hel... |
// Package config contains the configuration logic for CF-SSL.
package config
import (
"crypto/x509"
"encoding/json"
"io/ioutil"
"time"
"github.com/cloudflare/cfssl/api/client"
"github.com/cloudflare/cfssl/auth"
"github.com/cloudflare/cfssl/helpers"
"github.com/cloudflare/cfssl/log"
)
// A SigningProfile sto... |
//
package config
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"sync"
"github.com/ghodss/yaml"
"github.com/mitchellh/go-homedir"
"github.com/nanobox-io/nanobox-golang-stylish"
)
const (
OS = runtime.GOOS
ARCH = runtime.GOARCH
LOGTAP_PORT = ":6361"
MIST_PORT = ":1445"
SERV... |
// Copyright 2016 The goscope Authors
//
// 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... |
package xormrediscache
import (
"bytes"
"encoding/gob"
"fmt"
"github.com/garyburd/redigo/redis"
"github.com/go-xorm/core"
"hash/crc32"
"log"
"reflect"
// "strconv"
"time"
"unsafe"
)
const (
DEFAULT_EXPIRATION = time.Duration(0)
FOREVER_EXPIRATION = time.Duration(-1)
)
// Wraps the Redis client to meet t... |
package consul
import (
"crypto/tls"
"crypto/x509"
"fmt"
"github.com/hashicorp/memberlist"
"github.com/hashicorp/raft"
"github.com/hashicorp/serf/serf"
"io"
"io/ioutil"
"net"
"os"
"time"
)
const (
DefaultDC = "dc1"
DefaultLANSerfPort = 8301
DefaultWANSerfPort = 8302
)
var (
DefaultRPCAddr = &... |
package consul
import (
"github.com/armon/go-metrics"
"github.com/hashicorp/consul/consul/structs"
"github.com/hashicorp/raft"
"github.com/hashicorp/serf/serf"
"net"
"strconv"
"time"
)
const (
SerfCheckID = "serfHealth"
SerfCheckName = "Serf Health Status"
ConsulServiceID = "consul"
ConsulServi... |
// Copyright (c) 2017 Timo Savola. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package packet
import (
"encoding/binary"
"math"
)
// Code represents the source or destination of a packet. It is specific to a
// program instance.
type... |
package services
import (
"os"
"encoding/json"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/vito/cmdtest/matchers"
. "github.com/pivotal-cf-experimental/cf-test-helpers/generator"
. "github.com/pivotal-cf-experimental/cf-test-helpers/cf"
. "github.com/pivotal-cf-experimental/cf... |
/*
Package arrow provides C-style date formating and parsing, along with other date goodies.
See the github project page at http://github.com/bmuller/arrow for more info.
*/
package arrow
import (
"strconv"
"strings"
"time"
)
type Arrow struct {
time.Time
}
// Like time's constants, but with Day and Week
const ... |
package parser
import (
"../configuration"
"os/exec"
"strings"
"regexp"
"fmt"
"os"
)
type Tag struct {
Label string
Value string
}
var Tags []Tag
/**
* @brief Take the command string as input and return
* the list of commands to be executed, after
* having replaced the tags (like... |
package parser
import "fmt"
func ParseInput() {
fmt.Println("parsing some files")
}
changing the parsing method to take new files
package parser
import "fmt"
func ParseInput() {
fmt.Println("parsing some new files")
}
|
package parser
import (
"fmt"
"plaid/lexer"
"strconv"
"strings"
)
// SyntaxError combines a source code location with the resulting error message
type SyntaxError struct {
loc lexer.Loc
msg string
}
func (se SyntaxError) Error() string {
return fmt.Sprintf("%s %s", se.loc, se.msg)
}
func makeSyntaxError(tok ... |
package parser
import (
"errors"
"fmt"
"regexp"
"strings"
"github.com/gorilla/css/scanner"
"github.com/aymerick/douceur/css"
)
const (
importantSuffixRegexp = `(?i)\s*!important\s*$`
)
var (
importantRegexp *regexp.Regexp
)
// Parser represents a CSS parser
type Parser struct {
scan *scanner.Scanner // T... |
package parser
import "github.com/hansrodtang/semver"
type parser struct {
items chan item // channel of scanned items.
result node
ibuf []item
pos int
}
func (p *parser) run() (node, error) {
return handleRange(p), nil
}
func (p *parser) next() item {
if p.pos >= len(p.ibuf) {
i := <-p.items
p.ib... |
package parser
import (
"fmt"
"misc/calc/ast"
"misc/calc/scanner"
"misc/calc/token"
"strconv"
)
func ParseExpr(expr string) ast.Node {
f := token.NewFile("", expr)
return ParseFile(f, expr)
}
func ParseFile(f *token.File, str string) *ast.File {
if f.Size() != len(str) {
fmt.Println("File size does not mat... |
// Copyright (c) 2016, Daniel Martí <mvdan@mvdan.cc>
// See LICENSE for licensing information
package parser
import (
"bytes"
"fmt"
"io"
"strconv"
"strings"
"sync"
"github.com/mvdan/sh/ast"
"github.com/mvdan/sh/token"
)
// Mode controls the parser behaviour via a set of flags.
type Mode uint
const (
Parse... |
// Package Mode implements the Mode Client MQTT API
// The interface is through the MqttClient struct, which supports the MQTT
// subset that is required for our devices and configuration is through the
// MqttDelegate.
package mode
import (
"context"
"crypto/tls"
"errors"
"fmt"
"io"
"log"
"net"
"os"
"sync"
... |
package dsc
import (
"database/sql"
"fmt"
"github.com/viant/toolbox"
"path"
"strings"
)
const ansiTableListSQL = "SELECT table_name AS name FROM information_schema.tables WHERE table_schema = ?"
const ansiSequenceSQL = "SELECT auto_increment AS seq_value FROM information_schema.tables WHERE table_name = '%v' AN... |
package registry
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"github.com/dotcloud/docker/auth"
"github.com/dotcloud/docker/utils"
"github.com/shin-/cookiejar"
"io"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
var ErrAlreadyExists error = errors.New("Image already exists")
func doWithCookies(c *http.C... |
package registry
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
log "github.com/Sirupsen/logrus"
"github.com/Sirupsen/logrus/formatters/logstash"
"github.com/bugsnag/bugsnag-go"
"github.com/docker/distribution/configuration"
ctxu "github.com/docker/distribution/context"
"git... |
package aws
import (
"fmt"
"log"
"strings"
"time"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/aws/awserr"
"github.com/awslabs/aws-sdk-go/service/iam"
"github.com/awslabs/aws-sdk-go/service/rds"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/sc... |
package main
import (
"fmt"
"log"
"github.com/hashicorp/terraform/helper/schema"
"golang.org/x/net/context"
"github.com/vmware/govmomi/find"
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/property"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/mo"
"github.co... |
package memsearch
// #include "procMems_windows.h"
// #cgo CFLAGS: -std=c99
import "C"
import (
"fmt"
"reflect"
"unsafe"
)
func memoryGrep(pid uint, buf []byte) (bool, error) {
minfo := C.GetMemoryInformation(C.DWORD(pid))
defer C.MemoryInformation_Free(minfo)
if minfo.error != 0 {
return false, fmt.Errorf("... |
package main
const (
GOMIG_MAJ_VERSION = 0
GOMIG_MIN_VERSION = 4
GOMIG_MIC_VERSION = 2
)
version: 0.4.3
package main
const (
GOMIG_MAJ_VERSION = 0
GOMIG_MIN_VERSION = 4
GOMIG_MIC_VERSION = 3
)
|
package main
const VERSION = "0.5.1"
:+1: Bump up the version
package main
const VERSION = "0.5.2-alpha1"
|
// Evaluate opcodes
package vm
import (
"errors"
"fmt"
"github.com/ncw/gpython/py"
)
// Stack operations
func (vm *Vm) STACK_LEVEL() int { return len(vm.stack) }
func (vm *Vm) EMPTY() bool { return len(vm.stack) == 0 }
func (vm *Vm) TOP() py.Object { return vm.stack[len(v... |
package web
import (
"bytes"
"compress/gzip"
"encoding/json"
"fmt"
"html/template"
"io/ioutil"
"log"
"net/http"
"net/url"
"path/filepath"
"strconv"
"strings"
"text/template/parse"
"time"
"github.com/StackExchange/bosun/_third_party/github.com/MiniProfiler/go/miniprofiler"
"github.com/StackExchange/bos... |
package wfe
import (
"context"
"crypto"
"crypto/x509"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"math/rand"
"net"
"net/http"
"net/mail"
"net/url"
"os"
"path"
"sort"
"strconv"
"strings"
"time"
"unicode"
"gopkg.in/square/go-jose.v2"
"github.com/jmhodges/clock"
"github.c... |
package auth
import (
"context"
"fmt"
"net/http"
"strings"
"time"
"github.com/gempir/gempbot/pkg/api"
"github.com/gempir/gempbot/pkg/config"
"github.com/gempir/gempbot/pkg/helix"
"github.com/gempir/gempbot/pkg/log"
"github.com/gempir/gempbot/pkg/store"
"github.com/golang-jwt/jwt"
nickHelix "github.com/nic... |
package zk
import (
"strconv"
"github.com/funkygao/dbus/pkg/cluster"
log "github.com/funkygao/log4go"
"github.com/funkygao/zkclient"
)
type leader struct {
ctx *controller
lastDecision cluster.Decision
epoch int
epochZkVersion int32
pcl zkclient.ZkChildListener // leader watches live participant... |
/*
Copyright 2014 Google Inc. All rights reserved.
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 ... |
package sinmetalcraft
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strings"
"time"
"google.golang.org/appengine"
"google.golang.org/appengine/datastore"
"google.golang.org/appengine/log"
"google.golang.org/appengine/urlfetch"
"google.golang.org/appengine/user"
"googl... |
/*
Copyright 2019 The Jetstack cert-manager contributors.
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... |
package v3
import (
"encoding/json"
"fmt"
"github.com/cloudfoundry/cf-acceptance-tests/Godeps/_workspace/src/github.com/cloudfoundry-incubator/cf-test-helpers/cf"
"github.com/cloudfoundry/cf-acceptance-tests/Godeps/_workspace/src/github.com/cloudfoundry-incubator/cf-test-helpers/generator"
"github.com/cloudfound... |
//Copyright 2015 TF2Stadium. All rights reserved.
//Use of this source code is governed by the MIT
//that can be found in the LICENSE file.
//Package wsevent implements thread-safe event-driven communication similar to socket.IO,
//on the top of Gorilla's WebSocket implementation.
package wsevent
import (
"crypto/ra... |
package html
import (
"bytes"
"encoding/xml"
"fmt"
"io"
)
type Encoder struct {
RewriteID string
buf bytes.Buffer
w io.Writer
stack []string
invoid bool
}
func NewEncoder(out io.Writer) *Encoder {
return &Encoder{
buf: bytes.Buffer{},
w: out,
stack: []string{},
}
}
func (enc *Encoder) De... |
package main
import (
"fmt"
"github.com/Netflix-Skunkworks/go-jira/jira/cli"
"github.com/docopt/docopt-go"
"github.com/op/go-logging"
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
"strings"
)
var log = logging.MustGetLogger("jira")
var format = "%{color}%{time:2006-01-02T15:04:05.000Z07:00} %{level:-5s} [%{shortfile}]%... |
// Copyright 2018-2019 Authors of Cilium
//
// 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 ag... |
package paxos
import (
"fmt"
"strings"
"strconv"
"borg/assert"
"testing"
"container/vector"
)
const (
iFrom = iota
iTo
iCmd
iRnd
iNumParts
)
func accept(ins, outs chan string) {
var rnd, vrnd uint64
var vval string
ch, sent := make(chan int), 0
for in := ... |
package registry
import (
"context"
"reflect"
"sort"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
type Descriptor struct {
Name string
Instance Service
InitPriority Priority
}
var services []*Descriptor
func RegisterService(instance Service) {
services = append(services, &Descr... |
/*
Copyright 2019 The Kubernetes Authors.
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 writing, ... |
package main
import (
"crypto/sha256"
"fmt"
"io"
"net/http"
"strings"
"github.com/PuerkitoBio/goquery"
"github.com/gorilla/feeds"
"golang.org/x/text/encoding/japanese"
"golang.org/x/text/transform"
)
const (
MemoirsOfShibasakiSakiUrl = "http://shibasakisaki.web.fc2.com/"
)
func GetMemoirsOfShibasakiSaki()... |
// Copyright 2018 The Jadep Authors
//
// 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... |
package jirardeau
import (
"bytes"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"net/url"
"strings"
"github.com/pkg/errors"
)
// Jira holds Url like https://jira.tld
type Jira struct {
Log *log.Logger
Login string
Password string
Project string
ProjectID string
Url string
}
// FixVe... |
/*
Copyright 2014 The Kubernetes Authors.
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 writing, ... |
package main
import (
"context"
"log"
"os"
"github.com/nimona/go-nimona/blx"
"github.com/nimona/go-nimona/dht"
"github.com/nimona/go-nimona/mesh"
"github.com/nimona/go-nimona/net"
"github.com/nimona/go-nimona/net/protocol"
)
func main() {
peerID := os.Getenv("PEER_ID")
if peerID == "" {
log.Fatal("Missin... |
// Package broadcast implements a generic system where a user can generate
// content which can then be consumed by multiple other users. This package
// mostly handles whether or not a user is broadcasting, and what id they are
// broadcasting to
//
// - A user can only have a single broadcast at a time
//
// - It mus... |
// Copyright 2021 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package feed
import (
"fmt"
"html"
"net/http"
"net/url"
"strconv"
"strings"
activities_model "code.gitea.io/gitea/models/activities"
"code.gitea.io... |
package echo
import (
"encoding/xml"
"fmt"
"html/template"
"strconv"
"sync"
)
var (
mutex sync.RWMutex
emptyHTML = template.HTML(``)
emptyJS = template.JS(``)
emptyCSS = template.CSS(``)
emptyHTMLAttr = template.HTMLAttr(``)
emptyStore = Store{}
)
type Store map[string]interface{... |
// +build linux
// +build cgo
package shared
import (
"fmt"
"io"
"os"
"strings"
"github.com/gorilla/websocket"
"github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/logger"
)
/*
#include "../shared/netns_getifaddrs.c"
*/
// #cgo CFLAGS: -std=gnu11 -Wvla
import "C"
func NetnsGetifaddrs(initPID int32) (... |
package node
import (
"errors"
"github.com/MG-RAST/Shock/shock-server/conf"
"github.com/MG-RAST/Shock/shock-server/db"
"io/ioutil"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"path/filepath"
)
func Initialize() {
session := db.Connection.Session.Copy()
DB := session.DB(conf.Conf["mongodb-database"]).C("Nodes"... |
package uic
import (
"encoding/base64"
"encoding/json"
"github.com/Cepave/fe/g"
"github.com/Cepave/fe/http/base"
. "github.com/Cepave/fe/model/uic"
"github.com/Cepave/fe/utils"
"github.com/toolkits/str"
"io/ioutil"
"log"
"net/http"
"net/url"
"strings"
"time"
)
type AuthController struct {
base.BaseContr... |
package hoverfly
import (
"testing"
)
func TestSetMetadataKey(t *testing.T) {
metaBucket := GetRandomName(10)
md := NewBoltDBMetadata(TestDB, metaBucket)
md.Set("foo", "bar")
expect(t, md.Get("foo"), "bar")
}
more tests for metadata
package hoverfly
import (
"testing"
)
func TestSetMetadataKey(t *testing... |
// Copyright © 2016 Zenly <hello@zen.ly>.
//
// 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 agr... |
package translator
import (
"code.google.com/p/go.tools/go/exact"
"code.google.com/p/go.tools/go/types"
"fmt"
"go/ast"
"go/token"
"strings"
)
var ReservedKeywords = []string{"arguments", "class", "delete", "eval", "export", "false", "implements", "interface", "in", "let", "new", "package", "private", "protected... |
package transports
import (
"fmt"
"github.com/headzoo/surf"
"github.com/headzoo/surf/browser"
)
type FacebookTransport struct {
*Transport
Login string
Password string
Browser *browser.Browser
Authenticated bool
}
func (t *FacebookTransport) Prepare() {
fmt.Println("FacebookTransport, Pre... |
package simra
import (
"testing"
"time"
)
type c struct{}
type l struct{}
var onCollision = make(chan bool)
func (c *c) GetXYWH() (x, y, w, h float32) {
x, y, w, h = 0, 0, 0, 0
return
}
func (l *l) OnCollision(c1, c2 Collider) {
go func() {
//time.Sleep(time.Millisecond * 500)
onCollision <- true
}()
}
... |
// Package http provides the HTTP server for accessing the distributed database.
// It also provides the endpoint for other nodes to join an existing cluster.
package http
import (
"crypto/tls"
"crypto/x509"
"encoding/json"
"errors"
"expvar"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"net/http/pprof"
"... |
package colly
import (
"errors"
"io/ioutil"
"net/http"
"net/http/cookiejar"
"regexp"
"sync"
"time"
"github.com/gobwas/glob"
)
type httpBackend struct {
LimitRules []*LimitRule
Client *http.Client
lock *sync.Mutex
}
// LimitRule provides connection restrictions for domains.
// There can be two k... |
package spider
import "io"
type spinFunc func(*Context) error
type spiderFunc struct {
method string
url string
body io.Reader
fn spinFunc
}
func (s *spiderFunc) Setup(parent *Context) (*Context, error) {
return NewHTTPContext(s.method, s.url, s.body)
}
func (s *spiderFunc) Spin(ctx *Context) error { ... |
// Copyright 2017 The Hugo Authors. All rights reserved.
//
// 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 ... |
package notification
import (
"encoding/json"
"github.com/koding/logging"
"github.com/koding/rabbitmq"
"github.com/koding/worker"
"github.com/streadway/amqp"
"socialapi/models"
)
type Action func(*NotificationWorkerController, []byte) error
type NotificationWorkerController struct {
routes map[string]Action
... |
// Copyright 2019 The Hugo Authors. All rights reserved.
//
// 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 ... |
package broker
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"reflect"
"github.com/jinzhu/gorm"
"github.com/streadway/amqp"
"labix.org/v2/mgo"
)
var ErrHandlerNotFoundErr = errors.New("handler does not exist")
type Handler interface {
HandleEvent(string, []byte) error
ErrHandler
}
type ErrHandler inter... |
package mux
import (
"fmt"
"koding/artifact"
"net/http"
"socialapi/models"
"socialapi/workers/common/handler"
"github.com/koding/logging"
"github.com/koding/metrics"
"github.com/rcrowley/go-tigertonic"
)
type Config struct {
Name string
Host string
Port string
Debug bool
}
func NewConfig(name, host s... |
// Tool generates JSON document using monster productions.
// * productions are defined for `default`, `users` and `projects` bucket.
// * parallel load can be generated using `-par` switch.
// * `-count` switch specify no. of documents to be generated by each routine.
package main
import (
"flag"
"fmt"
"log"
"ma... |
package cassandra
import (
"fmt"
"github.com/Sirupsen/logrus"
"github.com/gocql/gocql"
"github.com/intelsdi-x/swan/pkg/cassandra"
. "github.com/smartystreets/goconvey/convey"
"math/rand"
"testing"
"time"
)
func insertDataIntoCassandra(session *gocql.Session, metrics *cassandra.Metrics) error {
// TODO(CD): C... |
Restore defer
|
// Copyright 2014 slowfei And The Contributors All rights reserved.
//
// 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
//
// Un... |
// Copyright 2014 slowfei And The Contributors All rights reserved.
//
// 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
//
// Un... |
package rpcclient
import (
"context"
"encoding/json"
"fmt"
"math"
"net"
"net/http"
"sync"
"time"
"github.com/gorilla/websocket"
"github.com/pkg/errors"
metrics "github.com/rcrowley/go-metrics"
types "github.com/tendermint/tendermint/rpc/lib/types"
cmn "github.com/tendermint/tmlibs/common"
)
const (
//... |
package phraseapp
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"os"
"path/filepath"
"strconv"
"time"
)
type AffectedCount struct {
RecordsAffected int64 `json:"records_affected"`
}
type AffectedResources struct {
RecordsAffected int64 `json:"records_affected"`
}
type Authoriz... |
package phraseapp
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"os"
"path/filepath"
"strconv"
"time"
)
type AffectedCount struct {
RecordsAffected int64 `json:"records_affected"`
}
type AffectedResources struct {
RecordsAffected int64 `json:"records_affected"`
}
type Authoriz... |
package physical
import (
"encoding/base64"
"errors"
"fmt"
"log"
"net/url"
"os"
"path/filepath"
"strings"
"sync"
"time"
"github.com/armon/go-metrics"
"github.com/coreos/etcd/client"
"github.com/coreos/etcd/pkg/transport"
"golang.org/x/net/context"
)
const (
// Ideally, this prefix would match the "_" ... |
Fixed missing endpoint.
|
package dropbox
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
"time"
"github.com/ayoisaiah/stellar-photos-server/config"
"github.com/ayoisaiah/stellar-photos-server/unsplash"
"github.com/ayoisaiah/stellar-photos-server/utils"
)
// Dropbox application key
type key struct {
DropboxKey string `json:"... |
package typesys
import (
"fmt"
"strings"
"bitbucket.org/yyuu/bs/core"
)
type TypeTable struct {
charSize int
shortSize int
intSize int
longSize int
ptrSize int
table map[string]core.IType
}
func NewTypeTable(charSize, shortSize, intSize, longSize, ptrSize int) *TypeTable {
loc := core.NewLocation... |
// Copyright 2015 Google Inc. All Rights Reserved.
//
// 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... |
// Package nodejs implements the "nodejs" runtime.
package nodejs
import (
"strings"
"github.com/apex/apex/function"
)
const (
// Runtime for inference.
Runtime = "nodejs6.10"
)
func init() {
function.RegisterPlugin(Runtime, &Plugin{})
}
// Plugin implementation.
type Plugin struct{}
// Open adds nodejs defa... |
package client
import (
"bytes"
"encoding/json"
"fmt"
ninchat "github.com/ninchat/ninchat-go"
)
func asError(x interface{}) error {
if x == nil {
return nil
}
if err, ok := x.(error); ok {
return err
} else {
return fmt.Errorf("%v", x)
}
}
type JSON struct {
x json.RawMessage
}
func NewJSON(s stri... |
package system
import (
"fmt"
"github.com/influxdb/telegraf/plugins"
)
type MemStats struct {
ps PS
}
func (_ *MemStats) Description() string {
return "Read metrics about memory usage"
}
func (_ *MemStats) SampleConfig() string { return "" }
func (s *MemStats) Gather(acc plugins.Accumulator) error {
vm, err ... |
package object
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"math"
"strings"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/filemode"
fdiff "gopkg.in/src-d/go-git.v4/plumbing/format/diff"
"gopkg.in/src-d/go-git.v4/utils/diff"
dmp "github.com/sergi/go-diff/diffmatchpatch"
)
var ... |
package model
import (
"github.com/stretchr/testify/assert"
"testing"
)
func fixtureEmptySlave() *Slave {
return &Slave{
Hostname: "host1",
Port: 1,
MongodPortRangeBegin: 2,
MongodPortRangeEnd: 3,
PersistentStorage: true,
Mongods: []*Mongod{},
ConfiguredS... |
package model
import (
"log"
"net/rpc"
"time"
)
import (
"github.com/kc1212/virtual-grid/common"
"github.com/kc1212/virtual-grid/discosrv"
)
// GridSdr describes the properties of one grid scheduler
type GridSdr struct {
common.Node
gsNodes *common.SyncedSet // other grid schedulers, not including... |
package action
import (
"encoding/json"
"errors"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
"unicode"
"github.com/zyedidia/json5"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/tcell"
)
var Binder = map[string]func(e Event, acti... |
// Package fusefrontend interfaces directly with the go-fuse library.
package fusefrontend
// FUSE operations on paths
import (
"os"
"path/filepath"
"sync"
"syscall"
"time"
"golang.org/x/sys/unix"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/hanwen/go-fuse/fuse/pathf... |
// Copyright 2017 The Go 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 gophers is a list of names, emails, and Github usernames of people
// from the Go git repos and issue trackers.
package gophers
import (
"strings"
... |
/*
Copyright 2019 The Ceph-CSI Authors.
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 writing, so... |
// Copyright 2020 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
package opa
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"strconv"
"time"
wasm "github.com/wasmerio/go-ext-wasm/wasmer"
"github.com/op... |
package invoices
import (
"errors"
"fmt"
"sync"
"sync/atomic"
"time"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/clock"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/queue"
"github.com/lightningnetwork/ln... |
package govector
import (
"fmt"
"testing"
"github.com/bmizerany/assert"
)
func TestVectors(t *testing.T) {
x, err := AsVector([]int{2, 2, 2, 4, 2, 5})
assert.Equal(t, nil, err, "Error casting integer array to vector")
w, err := AsVector([]float64{1.0, 1.0, 1.0, 1.0, 1.0, 4.0})
assert.Equal(t, nil, err, "Erro... |
package e2e
import (
"fmt"
"sync"
"testing"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
)
// Reboot all nodes in cluster all at once. Wait for nodes to return. Run nginx
// workload.
func TestReboot(t *testing.T) {
nodeList, err := client.C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.