CombinedText stringlengths 4 3.42M |
|---|
package main
import (
"bytes"
"encoding/binary"
"errors"
"flag"
"fmt"
"io"
"io/ioutil"
"math/rand"
"os"
"runtime"
"runtime/pprof"
"strconv"
"strings"
"time"
"github.com/boltdb/bolt"
)
var (
// ErrUsage is returned when a usage message was printed and the process
// should simply exit with an error.
... |
package aws
import (
"fmt"
"strings"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
func TestAccAWSRolePolicyAttachment_basic(t *tes... |
package main
import (
"bufio"
"fmt"
"io"
"io/ioutil"
"log"
"math"
"os"
"os/signal"
"sort"
"strings"
"github.com/ianremmler/clac"
"github.com/kless/term"
"github.com/peterh/liner"
)
var (
trm *term.Terminal
lnr *liner.State
cl = clac.New()
cmdList = []string{}
cmdMap = map[string]func(... |
// Code generated by go-bindata.
// sources:
// templates/consul_catalog.tmpl
// templates/docker.tmpl
// templates/ecs.tmpl
// templates/eureka.tmpl
// templates/kubernetes.tmpl
// templates/kv.tmpl
// templates/marathon.tmpl
// templates/mesos.tmpl
// templates/notFound.tmpl
// templates/rancher.tmpl
// DO NOT EDIT!
... |
package core
import (
"errors"
"reflect"
"strings"
"syscall"
"testing"
"time"
"github.com/elves/elvish/edit/tty"
"github.com/elves/elvish/edit/ui"
"github.com/elves/elvish/styled"
"github.com/elves/elvish/sys"
)
func TestReadCode_AbortsOnSetupError(t *testing.T) {
terminal := newFakeTTY()
terminal.setupE... |
package main
import (
"os"
"os/user"
"github.com/dcos/dcos-cli/pkg/cli"
"github.com/dcos/dcos-cli/pkg/cmd"
"github.com/spf13/afero"
)
func main() {
ctx := cli.NewContext(&cli.Environment{
Input: os.Stdin,
Out: os.Stdout,
ErrOut: os.Stderr,
EnvLookup: os.LookupEnv,
UserLookup: user.Cu... |
// Code generated by go-bindata.
// sources:
// templates/consul_catalog.tmpl
// templates/docker.tmpl
// templates/ecs.tmpl
// templates/eureka.tmpl
// templates/kubernetes.tmpl
// templates/kv.tmpl
// templates/marathon.tmpl
// templates/mesos.tmpl
// templates/notFound.tmpl
// templates/rancher.tmpl
// DO NOT EDIT!
... |
package main
import (
"flag"
"github.com/mackee/kuiperbelt_new"
)
func main() {
var configFilename string
flag.StringVar(&configFilename, "config", "config.yml", "config path")
flag.Parse()
kuiperbelt.Run(configFilename)
}
fix internal package path
package main
import (
"flag"
"github.com/mackee/kuiperb... |
/*
Copyright 2015 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 cmd
import (
"bufio"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"os"
"strconv"
"strings"
"text/tabwriter"
"time"
"github.com/cozy/cozy-stack/client"
"github.com/cozy/cozy-stack/pkg/consts"
"github.com/cozy/cozy-stack/pkg/couchdb"
"github.com/cozy/cozy-stack/pkg/instance"
humanize "github.com... |
package main
import (
"log"
"os"
"regexp"
"strings"
"time"
"github.com/apcera/nats"
)
func main() {
opts := nats.DefaultOptions
natsURL := os.Getenv("NATS_CLUSTER")
if natsURL == "" {
natsURL = "nats://localhost:4222"
}
opts.Servers = strings.Split(natsURL, ",")
opts.MaxReconnect = 5
opts.ReconnectWai... |
package main
import (
"os"
"os/signal"
"syscall"
"google.golang.org/grpc"
"fmt"
"github.com/slok/ragnarok/cmd/node/flags"
"github.com/slok/ragnarok/log"
"github.com/slok/ragnarok/node"
"github.com/slok/ragnarok/node/client"
)
// Main run main logic.
func Main() error {
logger := log.Base()
// Get the c... |
// Copyright (c) 2015-2021 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (... |
package main
// Benchmark the scanning of a file-system tree.
// Usage: scan [dirname [numScans]]
// dirname: the top of the directory tree to scan (default=/)
// numScans: the number of scans to run (default=1, infinite: < 0)
import (
"fmt"
"github.com/Symantec/Dominator/sub/fsrateio"
"github.com/Symantec/... |
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"log"
"net"
"net/http"
"os"
"os/exec"
"path/filepath"
"strconv"
"time"
"github.com/tus/tusd"
"github.com/tus/tusd/filestore"
"github.com/tus/tusd/limitedstore"
"github.com/tus/tusd/memorylocker"
"github.com/tus/tusd/prometheuscollector"
"git... |
/*
This file is part of go-ethereum
go-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
go-ethereum is distributed in the hop... |
// Copyright 2016 Davide Muzzarelli. All right reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package gqt is a template engine for SQL queries.
It helps to separate SQL code from Go code and permits to compose the queries
with a simple syntax.
The... |
// Copyright 2015 Robert S. Gerus. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package main
/*
#cgo LDFLAGS: -lxname
#include <xname.h>
*/
import "C"
import (
// "gopkg.in/yaml.v2"
"sync"
"time"
)
var statusLock sync.Mutex
var statu... |
// Copyright 2017 Vector Creations Ltd
//
// 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 agre... |
package api
// renterhost_test.go sets up larger integration tests between renters and
// hosts, checking that the whole storage ecosystem is functioning cohesively.
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"net/url"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"testing"
"time"
"github.com/Nebulou... |
package hdf5
// #include "hdf5.h"
// #include <stdlib.h>
// #include <string.h>
import "C"
import (
"fmt"
"reflect"
"runtime"
"unsafe"
)
type Attribute struct {
Location
}
func newAttribute(id C.hid_t) *Attribute {
d := &Attribute{Location{id}}
runtime.SetFinalizer(d, (*Attribute).finalizer)
return d
}
fu... |
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"regexp"
"path/filepath"
"strings"
)
func main() {
sourceFile, err := ioutil.ReadFile(os.Args[1])
var s string
var cfile bool = (filepath.Ext(os.Args[1]) == "c")
if err == nil {
s = string(sourceFile)
fmt.Println(s)
}
splitFile := strings.Split(... |
/*
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 command
import (
"flag"
"fmt"
"strings"
"github.com/mitchellh/cli"
"github.com/mohae/rancher/ranchr"
)
// BuildCommand is a Command implementation that generates Packer templates
// from named named builds and passed build arguments.
type BuildCommand struct {
Ui cli.Ui
}
// Rancher help text.
func (c... |
// Copyright 2015 Cloud Security Alliance EMEA (cloudsecurityalliance.org)
//
// 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 main
import (
"fmt"
"strconv"
"github.com/codegangsta/cli"
)
func cmdNodeAdd(c *cli.Context) {
keySlice := []string{"assetid", "name", "team", "server", "online"}
reqSlice := []string{"assetid", "name", "team", "server"}
switch utl.GetCliArgumentCount(c) {
case 8, 10:
break
default:
utl.Abort("S... |
package main
import (
"fmt"
"os"
"strconv"
"strings"
"time"
"github.com/boltdb/bolt"
"github.com/codegangsta/cli"
)
func registerUsers(app cli.App) *cli.App {
app.Commands = append(app.Commands,
[]cli.Command{
// users
{
Name: "users",
Usage: "SUBCOMMANDS for users",
Subcommands: []cli.C... |
// Copyright 2020 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 errors
type Code int
// This file defines the error codes that can be produced during type-checking.
// Collectively, these codes provide an identifie... |
package bothandlers
import (
"math/rand"
"strings"
"github.com/danryan/hal"
)
type ikr struct{
}
func (h *ikr) Method() string {
hal.Logger.Debug("ikr: called Method()")
return hal.HEAR
}
func (h *ikr) Usage() string {
hal.Logger.Debug("ikr: called Usage()")
return `ikr - listens for enthusiasm; responds wit... |
// Copyright 2016 The Upspin 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 perm
// Features:
// - Resolves remote Group files if necessary.
// - Blocks mutations to Store until it has had a chance to prove that either
// ... |
package hook
import (
"fmt"
"log"
"net/http"
"net/url"
"github.com/bitrise-io/api-utils/logging"
"github.com/bitrise-io/bitrise-webhooks/bitriseapi"
"github.com/bitrise-io/bitrise-webhooks/config"
"github.com/bitrise-io/bitrise-webhooks/metrics"
"github.com/bitrise-io/bitrise-webhooks/service"
"github.com/b... |
package tasks
import (
"crypto/md5"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"strconv"
"strings"
"time"
"github.com/ansible-semaphore/semaphore/lib"
log "github.com/Sirupsen/logrus"
"github.com/ansible-semaphore/semaphore/api/sockets"
"github.com/ansible-semaphore/semaphore/db"
"github.com/a... |
package common
import (
"encoding/base64"
"strings"
"github.com/ricallinson/forgery"
"github.com/spacedock-io/index/models"
)
func BasicAuth(req *f.Request, res *f.Response, next func()) {
auth := req.Get("authorization")
req.Map["_user"] = nil
if len(auth) == 0 {
res.Send("No authorization provi... |
package common
import (
"errors"
"io/ioutil"
"os"
"reflect"
"runtime"
)
var (
errInvalidConf = errors.New("invalid conf")
)
// ConfigLoader 配置内容加载器
type ConfigLoader interface {
Load(configPath string) (content []byte, err error)
Exist(configPath string) (exist bool, err error)
}
// ConfigFileLoader 从本地文件中... |
package common
import (
"github.com/EngoEngine/ecs"
"github.com/EngoEngine/engo"
"github.com/EngoEngine/gl"
"image/color"
"sort"
"sync"
"unsafe"
)
const (
// RenderSystemPriority is the priority of the RenderSystem
RenderSystemPriority = -1000
)
type renderChangeMessage struct{}
func (renderChangeMessage) ... |
// Copyright © 2016 Jip J. Dekker <jip@dekker.li>
//
// 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 main is the entry point for the Blue Jay command-line tool called
// Jay.
package main
import (
"fmt"
"log"
"os"
"path/filepath"
"runtime"
"strings"
"github.com/blue-jay/core/env"
"github.com/blue-jay/core/file"
"github.com/blue-jay/core/find"
"github.com/blue-jay/core/generate"
"github.com/blue... |
// Copyright 2015 Vadim Kravcenko
//
// 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... |
package main
import (
"bytes"
"encoding/gob"
"fmt"
"github.com/rdwilliamson/aws/glacier"
"io"
"log"
"os"
"strconv"
"time"
)
type retrievalData struct {
Region string
Vault string
PartSize uint64
Job string
Downloaded uint64
Size uint64
FullTreeHash string
}
var (
... |
// Package kcp - A Fast and Reliable ARQ Protocol
package kcp
import (
"encoding/binary"
"sync/atomic"
)
const (
IKCP_RTO_NDL = 30 // no delay min rto
IKCP_RTO_MIN = 100 // normal min rto
IKCP_RTO_DEF = 200
IKCP_RTO_MAX = 60000
IKCP_CMD_PUSH = 81 // cmd: push data
IKCP_CMD_ACK = 82 // ... |
// Package kcp - A Fast and Reliable ARQ Protocol
package kcp
import (
"encoding/binary"
"sync/atomic"
)
const (
IKCP_RTO_NDL = 30 // no delay min rto
IKCP_RTO_MIN = 100 // normal min rto
IKCP_RTO_DEF = 200
IKCP_RTO_MAX = 60000
IKCP_CMD_PUSH = 81 // cmd: push data
IKCP_CMD_ACK = 82 // ... |
package datastore
import (
"path"
"strings"
dsq "github.com/ipfs/go-datastore/query"
"github.com/satori/go.uuid"
base32 "github.com/whyrusleeping/base32"
)
/*
A Key represents the unique identifier of an object.
Our Key scheme is inspired by file systems and Google App Engine key model.
Keys are meant to be u... |
package main
import {
"fmt"
"github.com/stianeikeland/go-rpio"
"os"
"time"
}
var {
pin = rpio.Pin(4)
}
func main() {
if err := rpio.Open(): err != nil {
fmt.Println(err)
os.Exit(1)
}
defer rpio.Close()
pin.Output()
for i := 0; i < 20; i++ {
pin.Toggl... |
/*
SPDX-License-Identifier: MIT
Copyright (c) 2017 Thanh Ha
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merg... |
package xlsx
import (
"archive/zip"
"encoding/xml"
"errors"
"fmt"
"io"
"path"
"strconv"
"strings"
)
// XLSXReaderError is the standard error type for otherwise undefined
// errors in the XSLX reading process.
type XLSXReaderError struct {
Err string
}
// Error returns a string value from an XLSXReaderError ... |
package fiftyonedegrees
/*
#cgo CFLAGS: -I . -Wimplicit-function-declaration
#cgo LDFLAGS: -lm
#include "51Degrees.h"
*/
import "C"
import (
"errors"
"fmt"
"unsafe"
)
type FiftyoneDegrees struct {
dataSet *C.fiftyoneDegreesDataSet
}
func NewFiftyoneDegrees(fileName, properties string) (*FiftyoneDegrees, error) {... |
package excelize
import (
"archive/zip"
"bytes"
"encoding/gob"
"io"
"log"
"math"
)
// ReadZipReader can be used to read an XLSX in memory without touching the
// filesystem.
func ReadZipReader(r *zip.Reader) (map[string]string, int, error) {
fileList := make(map[string]string)
worksheets := 0
for _, v := ran... |
/*
Package dejavu offers quick detection of already witnessed data.
Limited memory of witnessed data, oldest are forgotten. Library is
thread safe. Offers deterministic and probabilistic (over an order of
magnatude less memory consuming) implementation.
*/
package dejavu
import (
"bufio"
"crypto/sha256"
"fmt"
"gi... |
package main
import (
"flag"
"fmt"
"io"
"log"
"os"
"path/filepath"
"strings"
"time"
"github.com/adiabat/btcd/chaincfg"
"github.com/mit-dci/lit/litbamf"
"github.com/mit-dci/lit/litrpc"
"github.com/mit-dci/lit/lnutil"
"github.com/mit-dci/lit/qln"
)
const (
litHomeDirName = ".lit"
keyFileName = "privkey... |
package main
import (
"bufio"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
"log"
"os"
"path/filepath"
"strings"
"time"
flags "github.com/jessevdk/go-flags"
"github.com/mit-dci/lit/coinparam"
"github.com/mit-dci/lit/litbamf"
"github.com/mit-dci/lit/litrpc"
"github.com/mit-dci/lit/lnutil"
"github.com/mit-... |
package lm2
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"math/rand"
"os"
"sync"
"sync/atomic"
)
const sentinelMagic = 0xDEAD10CC
const (
maxLevels = 4
levelProb = 0.1
cacheProb = 0.1
)
var (
// ErrDoesNotExist is returned when a collection's data file
// doesn't exist.
ErrDoesNotExist = errors.N... |
// Copyright (c) 2013-2017 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Copyright (C) 2015-2017 The Lightning Network Developers
package main
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"io/ioutil"
"math/big"
... |
package gohm
import (
"fmt"
"io"
"net/http"
"strings"
"time"
)
const apacheLogFormat = "%s [%s] \"%s\" %d %d %f\n"
const timeFormat = "02/Jan/2006:15:04:05 MST"
type loggedResponseWriter struct {
http.ResponseWriter
responseBytes int64
status int
}
func (r *loggedResponseWriter) Write(p []byte) (int,... |
package stripe
import (
"fmt"
"io"
"os"
)
//
// Public constants
//
const (
// LevelNull sets a logger to show no messages at all.
LevelNull Level = 0
// LevelError sets a logger to show error messages only.
LevelError Level = 1
// LevelWarn sets a logger to show warning messages or anything more
// sever... |
// Package ltsvlog is a minimalist logging library for writing logs in
// LTSV (Labeled Tab-separated Value) format.
// See http://ltsv.org/ for LTSV.
//
// This logging library has three log levels: Debug, Info and Error.
// The Info and Error levels are always enabled.
// You can disable the Debug level but only when... |
/*
Copyright 2017 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 misc
import (
"net/http"
"os"
"strings"
)
type justFilesFilesystem struct {
Fs http.FileSystem
}
func (fs justFilesFilesystem) Open(name string) (http.File, error) {
f, err := fs.Fs.Open(name)
if err != nil {
return nil, err
}
stat, err := f.Stat()
if stat.IsDir() {
err = f.Close()
if err != ... |
package acceptance
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/DATA-DOG/godog"
"github.com/DATA-DOG/godog/gherkin"
"github.com/ironman-project/ironman/testutils"
"github.com/rendon/testcli"
)
var generatedPath string
var generateFilePath string
func aTemplateToGenerateInstalledWit... |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tls
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/hmac"
"crypto/sha256"
"crypto/subtle"
"errors"
"io"
"golang.org/x/crypto/cryptobyte... |
package hm_test
import (
"errors"
"time"
. "github.com/cloudfoundry/hm9000/hm"
"github.com/cloudfoundry/hm9000/testhelpers/fakelogger"
"github.com/tedsuo/ifrit"
"github.com/tedsuo/ifrit/ginkgomon"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("HM9000Component", func() {
var (
h... |
package autocmd
import (
"nvim-go/commands"
"nvim-go/config"
"github.com/garyburd/neovim-go/vim"
"github.com/garyburd/neovim-go/vim/plugin"
)
func init() {
plugin.HandleAutocmd("BufWritePre",
&plugin.AutocmdOptions{Pattern: "*.go", Group: "nvim-go", Eval: "[getcwd(), expand('%:p')]"}, autocmdBufWritePre)
}
t... |
Return InvalidBody when failing to decode a new login
We always assume that a failure to decode indicates an invalid body, and
return a InvalidBody error instead of the error from the decoder.
|
package main
import (
"fmt"
"math/big"
"github.com/spf13/cobra"
"github.com/NebulousLabs/Sia/api"
)
var (
hostCmd = &cobra.Command{
Use: "host",
Short: "Perform host actions",
Long: "View or modify host settings. Modifying host settings also announces the host to the network.",
Run: wrap(hostcmd),... |
package sudoku
import (
"log"
"math"
"sort"
)
/*
This file is where the basic solve technique infrastructure is defined.
The techniques that Human Solve uses are initalized and stored into human_solves.go Techniques slice here.
Specific techniques are implemented in hst_*.go files (hst == human solve techniqu... |
package main
import (
"testing"
)
func TestValidateUser(t *testing.T) {
var tests = []struct {
username string
password string
want bool
}{
{"foo", "bar", true},
{"user", "pass", false},
}
for _, test := range tests {
if got := IsValidateUser(test.username, test.password); got != test.want {
... |
package ct
import (
"bytes"
"container/list"
"crypto"
"encoding/binary"
"errors"
"fmt"
"io"
)
// Variable size structure prefix-header byte lengths
const (
CertificateLengthBytes = 3
PreCertificateLengthBytes = 3
ExtensionsLengthBytes = 2
CertificateChainLengthBytes = 3
SignatureLengthBytes ... |
// 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... |
package raft
import (
"reflect"
"testing"
"time"
"github.com/coreos/etcd/raft/raftpb"
"github.com/coreos/etcd/third_party/code.google.com/p/go.net/context"
)
// TestNodeStep ensures that node.Step sends msgProp to propc chan
// and other kinds of messages to recvc chan.
func TestNodeStep(t *testing.T) {
for i ... |
// Copyright 2016 The etcd 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 t... |
package gotldmap
// Generated; DO NOT EDIT
// Map - map of top level domains with mark key
var Map = map[string]int{
"abb": 1,
"abbott": 2,
"abogado": 3,
"ac": 4,
"academy": 5,
"accenture": 6,
"account... |
package styxauth
import (
"errors"
"io"
"aqwari.net/net/styx"
)
var (
errAuthFailure = errors.New("authentication failed")
)
type stackAll []styx.Auth
type stackAny []styx.Auth
// All combines multiple styx.Auth values into a single styx.Auth.
// When authenticating, the Auth method of each parameter is called... |
package main
import (
"bytes"
"fmt"
"io"
"strings"
"time"
)
var (
syncProtocolPrefix = "ORGALORG"
syncProtocolHello = "HELLO"
syncProtocolNode = "NODE"
syncProtocolStart = "START"
syncProtocolSync = "SYNC"
)
type syncProtocol struct {
input *bytes.Buffer
output io.WriteCloser
prefix string
}
fu... |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tar
import (
"bytes";
"fmt";
"io";
"testing";
"testing/iotest";
)
type writerTestEntry struct {
header *Header;
contents string;
}
type writer... |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Windows system calls.
package syscall
import (
"unsafe"
"utf16"
)
const OS = "windows"
/*
small demo to detect version of windows you are running:
p... |
package hypervisor
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"syscall"
"time"
"github.com/hyperhq/hypercontainer-utils/hlog"
"github.com/hyperhq/runv/api"
hyperstartapi "github.com/hyperhq/runv/hyperstart/api/json"
"github.com/hyperhq/runv/hyperstart/libh... |
package ec2
import (
"bytes"
"fmt"
"github.com/megamsys/megamd/iaas"
"github.com/megamsys/megamd/provisioner"
"github.com/tsuru/config"
"strings"
"encoding/json"
)
func Init() {
iaas.RegisterIaasProvider("ec2", &EC2IaaS{})
}
type EC2IaaS struct{}
func (i *EC2IaaS) DeleteMachine(string) error {
return nil
... |
package foo
import (
"io"
)
func Foo(c io.Closer) {
c.Close()
}
func FooArgs(rc io.ReadCloser) {
var b []byte
rc.Read(b)
rc.Close()
}
Make sure that we also work with make
package foo
import (
"io"
)
func Foo(c io.Closer) {
c.Close()
}
func FooArgs(rc io.ReadCloser) {
var b []byte
rc.Read(b)
rc.Close(... |
package tester
import (
"fmt"
"hash"
"log"
"sync"
"github.com/facebookgo/ensure"
"github.com/golang/protobuf/proto"
"github.com/lovoo/goka/codec"
"github.com/lovoo/goka/kafka"
"github.com/lovoo/goka/storage"
)
// Codec decodes and encodes from and to []byte
type Codec interface {
Encode(value interface{})... |
package tasks
import (
"bytes"
"context"
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"io"
"mime/multipart"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"time"
"github.com/golang/protobuf/ptypes"
any "github.com/golang/protobuf/ptypes/any"
"pixur.org/pixur/be/imaging"
"pixur.org/pixur/be/schema"
... |
package main
import (
"flag"
"fmt"
"github.com/die-net/fotomat/imager"
"io/ioutil"
"net/http"
"regexp"
"strconv"
)
var maxBufferDimension = flag.Uint("max_buffer_dimension", 2048, "Maximum width or height of an image buffer to allocate.")
func init() {
http.HandleFunc("/albums/crop", imageCropHandler)
}
/*
... |
package images
import(
"io"
"encoding/json"
"github.com/ricallinson/forgery"
"github.com/spacedock-io/registry/models"
"github.com/spacedock-io/registry/cloudfiles"
)
func GetJson(req *f.Request, res *f.Response) {
image, err := models.GetImage(req.Params["id"])
if err != nil {
res.Send(404)
ret... |
package api
import (
"github.com/cloudfoundry/cli/cf/errors"
"github.com/cloudfoundry/cli/cf/models"
"time"
)
type FakeAppInstancesRepo struct {
GetInstancesAppGuid string
GetInstancesResponses [][]models.AppInstanceFields
GetInstancesErrorCodes []string
}
func (repo *FakeAppInstancesRepo) GetInstances(app... |
/*
Copyright 2021 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 welove
import (
"testing"
"io/ioutil"
"log"
"github.com/bitly/go-simplejson"
"encoding/json"
"fmt"
)
func TestTreePost(t *testing.T) {
res, err := TreePost("562949961343086-2ca7e299a09974dd0", "ac5f34563a4344c4", 2)
if err != nil {
log.Fatal(err)
}
bytes, _ := ioutil.ReadAll(res.Body)
js, _ := si... |
package lockfile_test
import (
lockfile "."
"fmt"
"os"
"path/filepath"
)
func ExampleLockfile() {
lock, err := lockfile.New(filepath.Join(os.TempDir(), "lock.me.now.lck"))
if err != nil {
fmt.Printf("Cannot init lock. reason: %v\n", err)
panic(err)
}
err = lock.TryLock()
// Error handling is essential, ... |
// Copyright 2016 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 geolookup
import (
"fmt"
"math"
"math/rand"
"net/http"
"reflect"
"sync"
"sync/atomic"
"time"
"github.com/getlantern/geolookup"
"github.com/getlantern/golog"
"github.com/getlantern/flashlight/pubsub"
"github.com/getlantern/flashlight/ui"
)
const (
messageType = `GeoLookup`
basePublishSeconds ... |
package geolookup
import (
"fmt"
"math"
"math/rand"
"net/http"
"net/http/httputil"
"sync"
"sync/atomic"
"time"
"github.com/getlantern/golog"
"github.com/getlantern/flashlight/pubsub"
"github.com/getlantern/flashlight/ui"
)
const (
messageType = `GeoLookup`
basePublishSeconds = 30
publishSecondsVa... |
package logger
import (
"io"
"log"
"net/http"
"os"
"strconv"
"strings"
"time"
"github.com/satori/go.uuid"
)
// http://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html
type option func(*handler)
// Internal handler
type handler struct {
name string
format string
out io.Wr... |
package logspoutloges
import (
"bytes"
"encoding/json"
"strings"
log "github.com/Sirupsen/logrus"
"github.com/gliderlabs/logspout/router"
"github.com/mattbaird/elastigo/lib"
)
var elastigoConn *elastigo.Conn
func init() {
router.AdapterFactories.Register(NewLogesAdapter, "logspoutloges")
}
// LogesAdapter i... |
// Package proctl provides functions for attaching to and manipulating
// a process during the debug session.
package proctl
import (
"bytes"
"debug/gosym"
"encoding/binary"
"fmt"
"os"
"strconv"
"strings"
"sync"
"syscall"
"unsafe"
"github.com/derekparker/dbg/dwarf/frame"
"github.com/derekparker/dbg/dwarf/... |
// Copyright 2017 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
package main
import (
"archive/tar"
"bytes"
"crypto/rand"
"database/sql"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math/big"
"net"
"os"
"os/exec"
"path"
"path/filepath"
"reflect"
"regexp"
"sort"
"strconv"
"strings"
"syscall"
"time"
"gopkg.in/flosch/pongo2.v3"
"gopkg.in/lxc/go-lxc.v2"
"gopkg.in/y... |
package main
import (
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"time"
"golang.org/x/net/context"
"gopkg.in/lxc/go-lxc.v2"
"gopkg.in/robfig/cron.v2"
"github.com/flosch/pongo2"
"github.com/lxc/lxd/lxd/cluster"
"github.com/lxc/lxd/lxd/db"
"github.com/lxc/lxd/lxd/state"
"github.com/l... |
package main
import (
"fmt"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/lxc/lxd/client"
"github.com/lxc/lxd/lxd/cluster"
"github.com/lxc/lxd/lxd/util"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
)
type initData struct {
api.ServerPut `yaml:",inline"`
Cluster *initDat... |
package main
import (
"fmt"
"net"
"os/exec"
"strconv"
"strings"
"syscall"
"golang.org/x/crypto/ssh/terminal"
"github.com/lxc/lxd/client"
"github.com/lxc/lxd/lxd/util"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/cmd"
"github.com/lxc/lxd/shared/idmap"
"github.c... |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package httputil
import (
"bufio"
"bytes"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
"strings"
"time"
)
// One of the copies, say from b to r... |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// DNS packet assembly, see RFC 1035. Converting from - Unpack() -
// and to - Pack() - wire format.
// All the packers and unpackers take a (msg []byte, off in... |
// DNS packet assembly, see RFC 1035. Converting from - Unpack() -
// and to - Pack() - wire format.
// All the packers and unpackers take a (msg []byte, off int)
// and return (off1 int, ok bool). If they return ok==false, they
// also return off1==len(msg), so that the next unpacker will
// also fail. This lets us ... |
package search
import (
"encoding/json"
"github.com/jinzhu/gorm"
dbModule "github.com/notegio/openrelay/db"
"github.com/notegio/openrelay/types"
"net/http"
"fmt"
"strings"
)
func FormatResponse(orders []dbModule.Order, format string) ([]byte, string, error) {
if format == "application/octet-stream" {
result... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.