CombinedText
stringlengths
4
3.42M
package kite import ( "github.com/streadway/amqp" "io" "koding/tools/log" "sync" ) type connection struct { messageChannel *amqp.Channel messageStream <-chan amqp.Delivery publishChannel *amqp.Channel replyExchange string bufferedMessage []byte closed bool closers []io.Closer closeM...
package python import ( "encoding/json" "log" "os" "os/exec" "path/filepath" "github.com/kr/fs" "sourcegraph.com/sourcegraph/srclib/toolchain" "sourcegraph.com/sourcegraph/srclib/unit" ) // Scan a directory, listing all source units func Scan(srcdir string, repoURI string, repoSubdir string) ([]*unit.Source...
// Copyright 2012 tsuru 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 queue import ( "encoding/gob" "errors" "io" "net" "sync/atomic" "time" ) // The size of buffered channels created by ChannelFromWriter. const Cha...
package machine import ( "fmt" "sort" ) type Machine struct { vendor Vendor changeMaker ChangeMaker } func NewMachine(vendor Vendor, changeMaker ChangeMaker) *Machine { return &Machine{vendor, changeMaker} } // Purchase the item in the specific slot and accept the given coins as payment // Return success ...
package terraform import ( "fmt" "log" "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" "github.com/zclconf/go-cty/cty/gocty" "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/config" "github.com/hashicorp/terraform/config/hcl2shim"...
// Copyright 2009 The Go Authors. All rights reserved. // Copyright (c) 2015 Klaus Post // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package flate import ( "fmt" "io" "math" ) const ( NoCompression = 0 BestSpeed = 1 BestCompression ...
package storage import ( "context" "fmt" "io" "os" "path/filepath" "strings" "sync" "time" "github.com/pkg/errors" log "gopkg.in/inconshreveable/log15.v2" "gopkg.in/yaml.v2" "github.com/lxc/lxd/lxd/backup" "github.com/lxc/lxd/lxd/cluster/request" "github.com/lxc/lxd/lxd/db" deviceConfig "github.com/lx...
// Copyright © 2015-2016 Lawrence E. Bakst. All rights reserved. // Originaly written on a plane from SFO->EWR on 7-23-15 in about an hour. // Based on an idea I had been mulling in my mind for years. // // dedup scans files or directories and calculates fingerprints hashes for them based on their contents. // Withou...
// +build !providerless /* 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 ...
// package main provides the monstache binary package main import ( "bytes" "crypto/tls" "crypto/x509" "encoding/base64" "encoding/json" "errors" "flag" "fmt" "github.com/BurntSushi/toml" "github.com/coreos/go-systemd/daemon" "github.com/evanphx/json-patch" "github.com/globalsign/mgo" "github.com/globalsi...
package rados // #cgo LDFLAGS: -lrados // #include <errno.h> // #include <stdlib.h> // #include <rados/librados.h> import "C" import "unsafe" import "time" // PoolStat represents Ceph pool statistics. type PoolStat struct { // space used in bytes Num_bytes uint64 // space used in KB Num_kb uint64 // number of o...
package messenger import ( "fmt" "math/rand" "net" "net/http" "net/http/httptest" "strconv" "sync" "testing" "time" "github.com/gogo/protobuf/proto" "github.com/mesos/mesos-go/messenger/testmessage" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/assert" "golang.org/x/net/context" ) var (...
package main import "testing" const aroundD4 = (CFile|DFile|EFile)&(Rank3|Rank4|Rank5) ^ (DFile & Rank4) func TestSouthAttacks(t *testing.T) { for _, v := range []struct { input Board empty Board want Board }{ {a1.Board(), ^a1.Board(), 0}, {h1.Board(), ^h1.Board(), 0}, {a8.Board(), ^a8.Board(), AFile ...
package main import ( "reflect" "regexp" "testing" ) var genMatcherTests = []struct { src string dst *regexp.Regexp }{ // one branch {`abc`, regexp.MustCompile(`(abc)`)}, {`abcdef`, regexp.MustCompile(`(abcdef)`)}, // multiple branches {`a,b`, regexp.MustCompile(`(a|b)`)}, {`a,,b,c`, regexp.MustCompile(`(...
// Copyright © 2013-2016 Pierre Neidhardt <ambrevar@gmail.com> // Use of this file is governed by the license that can be found in LICENSE. // TODO: Add shell auto-completion file. // TODO: Allow for embedding covers. Have a look at: // * mp4art (libmp4v2): mp4art --add cover.jpg track.m4a // * vorbiscomment (vorbis-t...
package main import ( "errors" "flag" "github.com/crowdmob/goamz/aws" "github.com/crowdmob/goamz/cloudwatch" mp "github.com/mackerelio/go-mackerel-plugin" "log" "os" "time" ) var graphdef map[string](mp.Graphs) = map[string](mp.Graphs){ "elb.latency": mp.Graphs{ Label: "Whole ELB Latency", Unit: "float"...
package manager import ( "crypto/x509" "encoding/pem" "fmt" "net" "os" "path/filepath" "sync" "syscall" "time" "github.com/Sirupsen/logrus" "github.com/docker/swarmkit/api" "github.com/docker/swarmkit/ca" "github.com/docker/swarmkit/log" "github.com/docker/swarmkit/manager/allocator" "github.com/docker...
// 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...
// Copyright (c) 2014 Couchbase, 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 w...
package lfs import ( "bytes" "io/ioutil" "testing" "github.com/github/git-lfs/vendor/_nuts/github.com/technoweenie/assert" ) func TestWriterWithCallback(t *testing.T) { called := 0 calledRead := make([]int64, 0, 2) reader := &CallbackReader{ TotalSize: 5, Reader: bytes.NewBufferString("BOOYA"), C: f...
package freetree import "testing" // ----------------------------------------------------------------------------- func TestFreeTree_pair_sorted_input(t *testing.T) { expected := ComparableArray{intTest(1), intTest(3), intTest(2), intTest(5), intTest(6), intTest(4)} st := NewSimpleTree() cs := ComparableArray{in...
// Copyright (c) 2013-2017 The btcsuite developers // Copyright (c) 2015-2016 The Decred developers // Heavily inspired by https://github.com/btcsuite/btcd/blob/master/version.go // Copyright (C) 2015-2017 The Lightning Network Developers package build import ( "bytes" "fmt" "strings" ) // Commit stores the curre...
package consul import ( "fmt" "log" "math/rand" "net" "os" "strings" "sync/atomic" "testing" "time" "github.com/hashicorp/consul/agent/consul/agent" "github.com/hashicorp/consul/testrpc" "github.com/hashicorp/consul/testutil" "github.com/hashicorp/consul/testutil/retry" "github.com/hashicorp/consul/type...
package marshal import ( "errors" "strconv" ) type MarshalledObject struct { MajorVersion byte MinorVersion byte data []byte symbolCache *[]string size int } type marshalledObjectType byte var TypeMismatch = errors.New("gorails/marshal: an attempt to implicitly typecast a marshalled objec...
package computer import ( "arp147/systems/key" "arp147/ui/fonts" "arp147/ui/position" "arp147/ui/text" "engo.io/ecs" "engo.io/engo" "image/color" ) func (c *Computer) Entity() *ecs.Entity { c.entity = ecs.NewEntity("RenderSystem", "KeySystem") kc := &key.KeyComponent{} // Alpha for i := engo.A; i <= engo...
package net import ( "bufio" "net" "strconv" "strings" "time" "github.com/heidi-ann/ios/config" "github.com/heidi-ann/ios/msgs" "github.com/golang/glog" ) type peerHandler struct { id int peers []config.NetAddress failures *msgs.FailureNotifier net *msgs.PeerNet } // iterative through pee...
// Copyright (C) 2014,2015 Nippon Telegraph and Telephone Corporation. // // 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 req...
// Diskv (disk-vee) is a simple, persistent, key-value store. // It stores all data flatly on the filesystem. package diskv import ( "bytes" "errors" "fmt" "io" "io/ioutil" "os" "path/filepath" "strings" "sync" "syscall" ) const ( defaultBasePath = "diskv" defaultFilePerm os.FileMode = 0666 ...
package digitalocean import ( "fmt" "io/ioutil" "net/http" "net/http/httptest" "os" "strings" "testing" "github.com/nuveo/gofn/iaas" ) var ( mux *http.ServeMux server *httptest.Server ) func setup() { mux = http.NewServeMux() server = httptest.NewServer(mux) os.Setenv("DIGITALOCEAN_API_URL", server....
// shell sorting package main import ( "fmt" "ashumeow/meow_sort" ) func main { meow := meow_sort.RandArray(10) fmt.Println("Given array is: ", meow) fmt.Println("") for ig_ig := int(len(arr)/2); ig_ig > 0; ig_ig /= 2 { for x := ig_ig; x < len(meow); x++ { for xx := x; xx >= ig_ig && meow[xx - ig_ig] > me...
package memorystore import ( "sync" "time" "github.com/mattheath/phosphor/domain" ) func New() *MemoryStore { s := &MemoryStore{ store: make(map[string]domain.Trace), } // run stats worker go s.statsLoop() return s } type MemoryStore struct { sync.RWMutex store map[string]domain.Trace } func (s *Memo...
// go-rst - A reStructuredText parser for Go // 2014 (c) The go-rst Authors // MIT Licensed. See LICENSE for details. package parse import ( "bufio" "bytes" "encoding/json" "fmt" "github.com/demizer/go-elog" "github.com/demizer/go-spew/spew" "os" "strings" "testing" ) type lexTest struct { name st...
package flags import ( "bytes" "fmt" "os" "sort" "strings" "unicode/utf8" ) type parseState struct { arg string args []string retargs []string positional []*Arg err error command *Command lookup lookup } func (p *parseState) eof() bool { return len(p.args) == 0 } func (p *pars...
// 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 fsnotify import ( "os" "time" "testing" ) func TestFsnotifyEvents(t *testing.T) { // Create an fsnotify watcher instance and initialize it watche...
package funcs import ( "bufio" "bytes" "fmt" "log" "strings" "github.com/open-falcon/agent/g" "github.com/open-falcon/common/model" "github.com/toolkits/file" "github.com/toolkits/sys" ) func UrlMetrics() (L []*model.MetricValue) { reportUrls := g.ReportUrls() sz := len(reportUrls) if sz == 0 { return ...
package handler import ( "OnlineJudge/base" "OnlineJudge/db" "OnlineJudge/irpc" "OnlineJudge/models" "OnlineJudge/pbgen/api" "log" "time" ) func (this *AdminHandler) Submit(response *api.SubmitResponse, req *api.SubmitRequest) { defer PanicHandler(response, this.debug) Submit_BuildResponse(this.dbu, respons...
package boardgame import ( "github.com/Sirupsen/logrus" "github.com/jkomoros/boardgame/enum" "github.com/jkomoros/boardgame/errors" "sort" ) //GameDelegate is the place that various parts of the game lifecycle can be //modified to support this particular game. Typically you embed //DefaultGameDelegate in your won...
// 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...
/* Copyright 2015 Gravitational, 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 writing, soft...
// Package auth implements http request authentication package auth import ( "errors" "github.com/MG-RAST/AWE/lib/auth/basic" "github.com/MG-RAST/AWE/lib/conf" e "github.com/MG-RAST/AWE/lib/errors" "github.com/MG-RAST/AWE/lib/user" ) // authCache is a var authCache cache var authMethods []func(string) (*user.Use...
/* Copyright 2016 Christian Grabowski 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 t...
// Copyright 2021 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writ...
// Copyright (c) Alex Ellis 2017. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. package builder import ( "fmt" "os" "strings" "github.com/openfaas/faas-cli/schema" "github.com/openfaas/faas-cli/stack" ) // AdditionalPackageBuildArg ho...
package builder // nginx const ( NginxVersion = "1.13.0" NginxDownloadURLPrefix = "https://nginx.org/download" ) // pcre const ( PcreVersion = "8.40" PcreDownloadURLPrefix = "http://ftp.csx.cam.ac.uk/pub/software/programming/pcre" ) // openssl const ( OpenSSLVersion = "1.0.2k" Ope...
package buildkite import ( "fmt" "github.com/buildkite/agent/buildkite/logger" "os" "path/filepath" "regexp" "time" ) // The Job struct uses strings for StartedAt and FinishedAt because // if they were actual date objects, then when this struct is // initialized they would have a default value of: 00:00:00.0000...
package api import ( "fmt" "github.com/grafana/grafana/pkg/api/dtos" "github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/services/dashboards" "github.com/grafana/grafana/pkg/services/guardian" "github.com/grafana/grafana/pkg/util" ) func GetFolders(c *models.ReqContext) Response { s := das...
// Copyright (C) 2018 Yasuhiro Matsumoto <mattn.jp@gmail.com>. // // Use of this source code is governed by an MIT-style // license that can be found in the LICENSE file. // +build cgo // +build sqlite_unlock_notify package sqlite3 /* #cgo CFLAGS: -DSQLITE_ENABLE_UNLOCK_NOTIFY #include <stdlib.h> #include <sqlite3-...
// Playbook - http://play.golang.org/p/3wFl4lacjX package main import ( "bytes" "crypto/aes" "crypto/cipher" //"crypto/rand" "errors" "fmt" "github.com/gotamer/conv" //"io" ) func Pad(src []byte) []byte { fmt.Println(len(src)) padding := aes.BlockSize - len(src)%aes.BlockSize padtext := bytes.Repeat([]byt...
package bytecode import ( "errors" ) // Raw is the raw bytecode, i.e. a list of bytes. // If a byte has an argument, the next two bytes // are converted into a single 16-bit integer: // // (a << 8) + b // // Where a is the first argument byte, and b is the // second. type Raw []byte // Code is the "parsed" bytecod...
package entity import ( "github.com/jinzhu/gorm" ) // Tag is a descriptive identifier given to ease searchability type Tag struct { gorm.Model Value string `sql:"type:text" gorm:"unique;not null"` Flags []*Flag `gorm:"many2many:flags_tags"` } Fix integration issue with mysql package entity import ( "github....
/* Copyright 2013 Google 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 writing, software di...
// Copyright 2016-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 self_test import ( "context" "crypto/tls" "fmt" "io/ioutil" mrand "math/rand" "net" "sort" "sync" "sync/atomic" "time" "github.com/lucas-clemente/quic-go" quicproxy "github.com/lucas-clemente/quic-go/integrationtests/tools/proxy" "github.com/lucas-clemente/quic-go/internal/protocol" "github.com/...
/* Copyright 2019 The xridge kubestone 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 to i...
package login import ( "crypto/tls" "errors" "fmt" "strings" "github.com/davecgh/go-spew/spew" "github.com/go-ldap/ldap" "github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/log" m "github.com/grafana/grafana/pkg/models" ) type ldapAuther struct { server *LdapServerConf conn ...
// Copyright (C) 2014 Nippon Telegraph and Telephone Corporation. // // 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...
package allocation import ( "fmt" "net" "testing" "time" "github.com/gortc/turn" "github.com/pion/stun" "github.com/stretchr/testify/assert" "github.com/pion/turn/internal/ipnet" ) func TestAllocation(t *testing.T) { tt := []struct { name string f func(*testing.T) }{ {"GetPermission", subTestGetP...
// 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 calendar import ( "database/sql" "fmt" "math" "strings" "time" "github.com/MyHomeworkSpace/api-server/data" ) // A ViewDay represents a day in a View. type ViewDay struct { DayString string `json:"day"` ShiftingIndex int `json:"shiftingIndex"` // if it's...
package main import ( "encoding/json" "fmt" "log" "net/http" "os" "strconv" "github.com/ferki/poker-player-go/player" ) func main() { PORT, err := strconv.Atoi(os.Getenv("PORT")) if err != nil { PORT = 4711 } http.HandleFunc("/", handleRequest) if err := http.ListenAndServe(fmt.Sprintf(":%d", PORT), n...
package handlers import ( "context" "encoding/json" "io" "io/ioutil" "net/http" "github.com/gorilla/handlers" "github.com/danielkrainas/tinkersnest/api/errcode" "github.com/danielkrainas/tinkersnest/api/v1" "github.com/danielkrainas/tinkersnest/auth" "github.com/danielkrainas/tinkersnest/context" "github....
// Google Image Search functionality package gis import ( "fmt" "github.com/collinvandyck/gesture/core" "github.com/collinvandyck/gesture/util" "math/rand" neturl "net/url" "strings" "time" ) func Create(bot *core.Gobot, config map[string]interface{}) { defaultUrl, useDefault := config["default"].(string) b...
package cluster import ( "errors" "fmt" "io" "io/ioutil" "os" "os/exec" "path/filepath" "strconv" "strings" "sync" "syscall" "time" "github.com/flynn/flynn/Godeps/_workspace/src/golang.org/x/crypto/ssh" "github.com/flynn/flynn/pkg/attempt" "github.com/flynn/flynn/pkg/random" ) func NewVMManager(bridge...
/* Copyright 2020 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...
// Copyright 2017 tsuru 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 migrate import ( "testing" "github.com/tsuru/config" "github.com/tsuru/tsuru/app" "github.com/tsuru/tsuru/db" "github.com/tsuru/tsuru/router" ch...
package watchman import ( "sync" "time" "github.com/winston-ci/winston/builder" "github.com/winston-ci/winston/config" "github.com/winston-ci/winston/resources" ) type Watchman interface { Watch( job config.Job, resource config.Resource, checker resources.Checker, latestOnly bool, interval time.Durat...
// errchk $G $D/$F.go // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This is a test case for issue 804. package main func f() [10]int { return [10]int{} } var m map[int][10]int func main() { f()[1...
package do import ( "bytes" "context" "encoding/json" "fmt" "io" "net/http" "time" "github.com/skibish/ddns/misc" ) // Record describe record structure type Record struct { ID uint64 `json:"id"` Type string `json:"type"` Name string `json:"name"` Data string `json:"data"` TTL uint...
// Package genapi implements a generic skeleton we can use as the basis for an // api service. It will set up command line arguments, connections to backend // databases, handle test modes which might affect those databases, register // itself with skyapi, and more. // // Basic definition // // To use first initialize ...
package aws import ( "bytes" "crypto/sha1" "encoding/base64" "encoding/hex" "fmt" "log" "strings" "time" "github.com/hashicorp/aws-sdk-go/aws" "github.com/hashicorp/aws-sdk-go/gen/ec2" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/...
package boomer import ( "errors" "math" "strconv" "strings" "sync/atomic" "time" ) // RateLimiter is used to put limits on task executions. type RateLimiter interface { // Start is used to enable the rate limiter. // It can be implemented as a noop if not needed. Start() // Acquire() is called before execu...
package main import ( "os" "os/exec" "path/filepath" "fmt" "time" "bytes" "sync" "strings" "github.com/spf13/cobra" "github.com/fatih/color" ) func findRepo(root string, sign string, c chan string) { visit := func(path string, info os.FileInfo, err error) error { if !info.IsDir() { return nil } ...
package controllers_test import ( "encoding/json" "fmt" "net/http" "net/http/httptest" "strings" "testing" "github.com/antonve/logger-api/config" "github.com/antonve/logger-api/controllers" "github.com/antonve/logger-api/models" "github.com/antonve/logger-api/models/enums" "github.com/antonve/logger-api/ut...
package storage import ( "fmt" "os" "github.com/syndtr/goleveldb/leveldb/opt" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/stats" "github.com/chrislusf/seaweedfs/weed/storage/backend" "github.com/chrislusf/seaweedfs/weed/storage/needle" "github.com/chrislusf/seaweedfs/weed/...
// // Copyright 2021, Sander van Harmelen // // 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 a...
// This code was originally based on the Digital Ocean provider from // https://github.com/hashicorp/terraform/tree/master/builtin/providers/digitalocean. package main import ( "fmt" "log" "strings" "time" "github.com/JamesClonk/vultr/lib" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp...
package node import ( "compress/gzip" "encoding/json" "errors" "fmt" "github.com/tywkeene/autobd/manifest" "github.com/tywkeene/autobd/options" "github.com/tywkeene/autobd/packing" "github.com/tywkeene/autobd/version" "io" "io/ioutil" "log" "net/http" "os" "path" "strings" "time" ) func Get(url string...
// Copyright (c) 2014 - Max Ekman <max@looplab.se> // // 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 graft import ( "log" "testing" "time" ) func TestNewNode(t *testing.T) { node, err := NewNode([]string{"10.88.147.130:1213", "10.88.147.2:1213"}, "10.88.104.33", "test.log", 1213) if err != nil { log.Println(err.Error()) return } log.Println("test") if node.State() == LEADER { log.Println("i am ...
package encrypted import ( "encoding/json" "io/ioutil" "log" "os" "strings" "github.com/tinzenite/shared" ) type chaninterface struct { // reference back to encrypted enc *Encrypted } func createChanInterface(enc *Encrypted) *chaninterface { return &chaninterface{ enc: enc} } // ----------------------- ...
package nomad import ( "fmt" "io" "reflect" "sync" "time" metrics "github.com/armon/go-metrics" log "github.com/hashicorp/go-hclog" memdb "github.com/hashicorp/go-memdb" "github.com/hashicorp/nomad/helper/uuid" "github.com/hashicorp/nomad/nomad/state" "github.com/hashicorp/nomad/nomad/structs" "github.com...
// Package eperf offers an easy solution to analyse the basic performance outline // of program parts. package eperf import ( "log" "time" ) type Perftest struct { name string cycles int round int min time.Duration last time.Time } // New creates a new Perftest with a given name and the number of time...
// Copyright (c) 2012-2013 Matt Nunogawa @amattn // This source code is release under the MIT License, http://opensource.org/licenses/MIT package deeperror import ( "fmt" "log" "net/http" "runtime" "strconv" "strings" ) var globalErrorLoggingEnabled bool func init() { globalErrorLoggingEnabled = false } con...
package dropbox import ( "net/http" ) // error tag constant values const ( TooManyRequests = "too_many_requests" ) // Error response. type Error struct { Status string StatusCode int Header http.Header Summary string `json:"error_summary"` Message string `json:"user_message"` // option...
package redis import ( "fmt" "io" "net" "strings" ) // Redis nil reply, .e.g. when key does not exist. var Nil = errorf("redis: nil") // Redis transaction failed. var TxFailedErr = errorf("redis: transaction failed") type redisError struct { s string } func errorf(s string, args ...interface{}) redisError { ...
package txbuilder import ( "bytes" "fmt" "time" "golang.org/x/net/context" "chain/cos/bc" "chain/cos/hdkey" "chain/cos/txscript" "chain/errors" ) // ErrBadBuildRequest is returned from Build when the // arguments are invalid. var ErrBadBuildRequest = errors.New("bad build request") // Build builds or adds ...
package repeater import ( m "github.com/advantageous/metricsd/metric" lg "github.com/advantageous/metricsd/logger" "github.com/advantageous/metricsd/util" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/cloudwatch" "time" ) type AwsCloudMetricRepeater struct { logger lg.Logger conn *cloud...
package repeatgenome /* WARNING!!! This program is currently under development and may be buggy or broken. A barebones (at the moment) Go script for parsing and minimizing RepeatMasker output files alongside FASTA reference genomes. This script expects there to be a subdirectory of the current directory nam...
package maxminddb import ( "errors" "fmt" "io/ioutil" "math/big" "math/rand" "net" "path/filepath" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestReader(t *testing.T) { for _, recordSize := range []uint{24, 28, 32} { for _, ipVersion := range []ui...
package checkerlution import ( "fmt" "github.com/couchbaselabs/logg" cbot "github.com/tleyden/checkers-bot" core "github.com/tleyden/checkers-core" ng "github.com/tleyden/neurgo" ) type OperationMode int const ( RUNNING_MODE = iota TRAINING_MODE ) type Checkerlution struct { ourTeamId cbot.TeamTy...
package gonatra import ( "net/http" "testing" ) func TestBuildRequest(t *testing.T) { route := Route{"/foo/:id/bar/:bar_id", HTTP_GET, nil, nil} url := "http://example.com/foo/123/bar/456" request, err := http.NewRequest(HTTP_GET, url, nil) if err != nil { t.Errorf("Som...
// Package that provides chronobiology functions to analyse time series data package chronobiology import ( "time" "math" "errors" ) /* BEGIN INTERNAL FUNCTIONS */ // Used to truncate a float64 value func round(value float64) float64 { return math.Floor(value + .5) } // Used to truncate a float64 v...
package gentle import ( "errors" "github.com/afex/hystrix-go/hystrix" "github.com/benbjohnson/clock" "sync" "time" ) const ( // Types of resilience, are most often used as part of RegistryKey. StreamRateLimited = "sRate" StreamRetry = "sRetry" StreamBulkhead = "sBulk" //StreamSemaphore = "sSem...
package main import ( "log" "os" "strconv" "time" "github.com/garyburd/redigo/redis" "github.com/lancetw/hcfd-forecast/db" "github.com/lancetw/hcfd-forecast/rain" "github.com/line/line-bot-sdk-go/linebot" ) const timeZone = "Asia/Taipei" var bot *linebot.Client func main() { strID := os.Getenv("ChannelID"...
// Copyright (c) 2017-2018 Tigera, 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 ap...
// Copyright 2014-2015 Apptimist, 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/binary" "errors" "fmt" "io" "net" "os" "runtime" "time" "github.com/apptimistco/asn/debug" ) const ( AsnStr ...
package crypto import ( "time" "github.com/btcsuite/btcd/btcec" "github.com/denkhaus/bitshares/config" "github.com/denkhaus/bitshares/types" "github.com/juju/errors" ) //TransactionSigner can sign and verify a transaction. type TransactionSigner struct { *types.SignedTransaction } //NewTransactionSigner crea...
package record import ( "database/sql" "errors" "fmt" _ "github.com/lib/pq" "github.com/rkbodenner/parallel_universe/game" ) type GameRecord struct { Game *game.Game } func NewGameRecord(g *game.Game) *GameRecord { return &GameRecord{g} } func (rec *GameRecord) Find(db *sql.DB, id int) error { var e...
package bzip2 import ( "testing" ) func TestNewWriter(t *testing.T) { t.Parallel() } func TestNewWriterLevel(t *testing.T) { t.Run("with DefaultCompression level", func(t *testing.T) { t.Parallel() }) t.Run("with level lower than BestSpeed", func(t *testing.T) { t.Parallel() }) t.Run("with BestSpeed lev...
package player import ( "bytes" "expvar" "fmt" "log" "net" "os" "sync" "chunkymonkey/gamerules" "chunkymonkey/nbtutil" "chunkymonkey/physics" "chunkymonkey/proto" . "chunkymonkey/types" "chunkymonkey/window" "nbt" ) var ( expVarPlayerConnectionCount *expvar.Int expVarPlayerDisconnectionCount *expv...