CombinedText stringlengths 4 3.42M |
|---|
package actions
import (
"database/sql"
"fmt"
"net/http"
"os"
"time"
"github.com/news-maily/app/entities"
"github.com/news-maily/app/utils"
"github.com/gorilla/csrf"
valid "github.com/asaskevich/govalidator"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ses"
"github.com/gin-gonic/gi... |
package main
import (
"fmt"
"os"
"text/template"
"github.com/spf13/cobra"
"github.com/squaremo/ambergreen/common/backends"
"github.com/squaremo/ambergreen/common/data"
)
type listOpts struct {
backend *backends.Backend
format string
formatInstance string
verbose bool
}
func (opts *listOpt... |
package gps
import (
"fmt"
"go/build"
"go/scanner"
"go/token"
"os"
"path/filepath"
"reflect"
"strings"
"testing"
)
// PackageTree.ExternalReach() uses an easily separable algorithm, wmToReach(),
// to turn a discovered set of packages and their imports into a proper external
// reach map.
//
// That algorith... |
package yagnats
import (
"errors"
"sync"
"time"
"github.com/apcera/nats"
)
type ApceraWrapperNATSClient interface {
Ping() bool
Connect() error
Disconnect()
Publish(subject string, payload []byte) error
PublishWithReplyTo(subject, reply string, payload []byte) error
Subscribe(subject string, handler nats.M... |
package main
import (
"log"
"os"
"path/filepath"
"strings"
"github.com/fsnotify/fsnotify"
)
func scan(path string) ([]string, error) {
var folders []string
folder, err := os.Open(path)
if err != nil {
return nil, err
}
defer folder.Close()
files, err := folder.Readdir(-1)
if err != nil {
panic(err)
... |
package linux
import (
"context"
"log"
"github.com/go-ble/ble"
"github.com/go-ble/ble/linux/att"
"github.com/go-ble/ble/linux/gatt"
"github.com/go-ble/ble/linux/hci"
"github.com/pkg/errors"
)
// NewDevice returns the default HCI device.
func NewDevice() (*Device, error) {
return NewDeviceWithName("Gopher")
}... |
// BaruwaAPI Golang bindings for Baruwa REST API
// Copyright (C) 2019 Andrew Colin Kissa <andrew@topdog.za.net>
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
pac... |
// Package local provides a filesystem interface
package local
import (
"fmt"
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
"regexp"
"runtime"
"strings"
"sync"
"time"
"unicode/utf8"
"golang.org/x/text/unicode/norm"
"github.com/ncw/rclone/fs"
"github.com/pkg/errors"
)
// Constants
const devUnset = 0xde... |
package google
import (
"fmt"
"log"
"time"
"code.google.com/p/google-api-go-client/compute/v1"
"code.google.com/p/google-api-go-client/googleapi"
"github.com/hashicorp/terraform/helper/schema"
)
func resourceComputeDisk() *schema.Resource {
return &schema.Resource{
Create: resourceComputeDiskCreate,
Read:... |
package google
import (
"fmt"
"log"
"regexp"
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/compute/v1"
"google.golang.org/api/googleapi"
)
func resourceComputeDisk() *schema.Resource {
return &schema.Resource{
Create: resourceComputeDiskCreate,
Read: resourceComputeDiskRead,
De... |
// picviewer2.go
package main
/*
REVISION HISTORY
======== =======
7 Apr 20 -- Now called picviewer2.go. I'm going to try the image reading trick I learned from the Qt example imageviewer.
9 Apr 20 -- Will try to handle arrow keys.
*/
import (
"fmt"
"github.com/therecipe/qt/core"
"githu... |
// picviewer2.go
package main
/*
REVISION HISTORY
======== =======
7 Apr 20 -- Now called picviewer2.go. I'm going to try the image reading trick I learned from the Qt example imageviewer.
9 Apr 20 -- Will try to handle arrow keys.
11 Apr 20 -- Won't handle arrow keys that I can get to wo... |
package main
// +build -tags netgo -a
import (
"bitbucket.org/strings/via/pkg"
"bytes"
"errors"
"flag"
"fmt"
"github.com/str1ngs/util"
"github.com/str1ngs/util/console/command"
"github.com/str1ngs/util/file"
"github.com/str1ngs/util/json"
"log"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
)
var (
r... |
package util
import (
"fmt"
suggestionsv1alpha3 "github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1alpha3"
"github.com/kubeflow/katib/pkg/controller.v1alpha3/consts"
)
func GetAlgorithmDeploymentName(s *suggestionsv1alpha3.Suggestion) string {
return s.Name + "-" + s.Spec.AlgorithmName
}
func GetAlgor... |
package reconciler
import (
"context"
"fmt"
"time"
controllerclient "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/controller-runtime/client"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
"github.... |
package test_test
import (
. "k8s.io/kubectl/pkg/framework/test"
"fmt"
"net"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("DefaultAddressManager", func() {
var defaultAddressManager *DefaultAddressManager
BeforeEach(func() {
defaultAddressManager = &DefaultAddressManager{}
})
... |
/*
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 client provides the primitives for a command-line client for music_player
package client
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
)
// Client struct holds the host on which music_player is running
type Client struct {
Host string
}
//... |
package topgun_test
import (
"fmt"
"time"
gclient "code.cloudfoundry.org/garden/client"
gconn "code.cloudfoundry.org/garden/client/connection"
_ "github.com/lib/pq"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
var _ = Describe(":life [#129726125] Hijacked containers... |
package master
import (
"crypto/rand"
"encoding/base64"
"fmt"
. "github.com/KIT-MAMID/mamid/model"
"github.com/KIT-MAMID/mamid/msp"
"github.com/Sirupsen/logrus"
"github.com/jinzhu/gorm"
"time"
)
var caLog = logrus.WithField("module", "cluster_allocator")
type ClusterAllocator struct {
BusWriteChannel *chan<... |
package contractcourt
contractcourt/chain_arbitrator_test: add TestChainArbitratorRepublishCommitment
TestChainArbitratorRepulishCommitment testst that the chain arbitrator
will republish closing transactions for channels marked
CommitementBroadcast in the database at startup.
package contractcourt
import (
"io/io... |
package client
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
"time"
"github.com/docker/distribution"
"github.com/docker/distribution/context"
"github.com/docker/distribution/digest"
"github.com/docker/distribution/manifest/schema1"
"github.com/docker/distribution... |
/**
* Copyright 2015 @ z3q.net.
* name : aftersales_service.go
* author : jarryliu
* date : 2016-07-18 17:16
* description :
* history :
*/
package dps
import (
"github.com/jsix/gof/db"
"go2o/core/domain/interface/after-sales"
"go2o/core/domain/interface/order"
"go2o/core/dto"
"go2o/core/infrastructure/for... |
package main
import (
"log"
"github.com/attwad/cdf/indexer"
"github.com/attwad/cdf/testdata"
)
func main() {
if err := indexer.NewElasticIndexer("http://localhost:9200").Index(
testdata.CreateCourse(), testdata.CreateTranscript()); err != nil {
log.Fatal(err)
}
}
removed index main debug
|
package log
import (
"fmt"
"io"
"log"
"math"
"os"
"strings"
)
const (
LevelFatal = iota
LevelError
LevelWarn
LevelInfo
LevelDebug
)
var Level = func() int {
switch os.Getenv("LOG_LEVEL") {
case "FATAL":
return LevelFatal
case "ERROR":
return LevelError
case "WARN":
return LevelWarn
case "DEBUG"... |
package logger
import (
"bytes"
"testing"
)
const (
namet = name + ".Test"
)
func TestGetLevel(t *testing.T) {
n := New("logger.Test.GetLevel")
n.Info(n, "Starting")
m := make(map[Logger]Priority)
m[""] = DefaultPriority
m["."] = DefaultPriority
m["Test"] = DefaultPriority
m[".Test"] = DefaultPriority
S... |
// Copyright 2013 The go-logger Authors. All rights reserved.
// This code is MIT licensed. See the LICENSE file for more info.
package log
import (
"bytes"
"fmt"
"io"
"math/rand"
"os"
"path/filepath"
"testing"
"runtime"
"time"
)
func TestStream(t *testing.T) {
var buf bytes.Buffer
logr := New(LEVEL_CRITI... |
// xbuild ignore
package main
import (
"bytes"
"flag"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"
)
var runCrossCompile = flag.Bool("cross-compile", true, "run cross compilation tests")
var minioServer = flag.String("minio", "", "path to the minio server ... |
package lua
//#include <lua.h>
//#include <lauxlib.h>
//#include <lualib.h>
//#include <stdlib.h>
//#include "golua.h"
import "C"
import "unsafe"
type LuaError struct {
code int
message string
stackTrace []LuaStackEntry
}
func (err *LuaError) Error() string {
return err.message
}
func (err *LuaError) Code() int... |
package main
import (
"encoding/json"
"fmt"
"os"
"gopkg.in/yaml.v2"
"github.com/lxc/lxd/lxc/config"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/gnuflag"
"github.com/lxc/lxd/shared/i18n"
"github.com/lxc/lxd/shared/log15"
"github.com/lxc/lxd/shared/logging"
)
type... |
package main
import (
"fmt"
"io/ioutil"
"os"
"sort"
"strings"
"syscall"
"github.com/olekukonko/tablewriter"
"gopkg.in/yaml.v2"
"github.com/lxc/lxd"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/i18n"
"github.com/lxc/lxd/shared/termios"
)
type networkCmd struct {... |
package main
import (
"fmt"
"io/ioutil"
"os"
"sort"
"strings"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
"github.com/lxc/lxd/lxc/utils"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
cli "github.com/lxc/lxd/shared/cmd"
"github.com/lxc/lxd/shared/i18n"
"github.com/lxc/lxd/shared/termios"
)
... |
package main
import (
"fmt"
"io/ioutil"
"os"
"sort"
"strconv"
"strings"
"syscall"
"github.com/olekukonko/tablewriter"
"gopkg.in/yaml.v2"
"github.com/lxc/lxd"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/i18n"
"github.com/lxc/lxd/shared/termios"
)
type byNameAn... |
//go:build linux && cgo && !agent
// +build linux,cgo,!agent
package db
import (
"database/sql"
"fmt"
"strconv"
"strings"
"time"
"github.com/pkg/errors"
"github.com/lxc/lxd/lxd/db/cluster"
"github.com/lxc/lxd/lxd/db/query"
"github.com/lxc/lxd/lxd/util"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shar... |
package models
import (
"encoding/json"
"github.com/fugazister/feeds"
"io/ioutil"
"net/http"
"regexp"
"strconv"
"strings"
"time"
)
type VKFeed struct {
FeedUrl string
}
type VKVideo struct {
Id int
Link string
}
type VKPhoto struct {
Album_id int
Owner_id int
Photo_75 string
Photo_130 string... |
package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"syscall"
"github.com/lxc/lxd/shared"
log "gopkg.in/inconshreveable/log15.v2"
)
/* Some interesting filesystems */
const (
filesystemSuperMagicTmpfs = 0x01021994
filesystemSuperMagicExt4 = 0xEF53
filesystemSuperMagicXfs = 0x58465342
filesystem... |
package lxlog
import (
"fmt"
"github.com/Sirupsen/logrus"
"runtime"
"strings"
"io"
"net/http"
"os/exec"
"bufio"
)
var GlobalLogLevel Level = InfoLevel
const (
default_logger = "default_logger"
PanicLevel = Level("PanicLevel")
FatalLevel = Level("FatalLevel")
ErrorLevel = Level("ErrorLevel")
WarnLevel =... |
// Copyright 2014 The Cockroach 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 ag... |
package main
import (
"fmt"
"time"
"strconv"
"github.com/JokerQyou/rpi"
"github.com/JokerQyou/rpi/pcd8544"
"github.com/kidoman/embd"
"github.com/kidoman/embd/sensor/bmp085"
_ "github.com/kidoman/embd/host/rpi"
)
const (
SCLK = 0
DIN = 1
DC = 2
CS = 3
RST = 4
CO... |
package commander
import (
"errors"
"flag"
"fmt"
"os"
"strings"
)
var ErrUnrecognizedCommand = errors.New("No command executed")
// Command wraps together the short command name, the description
// for a command, the commands Flags and the function that will handle
// the command.
type Command struct {
Command... |
package stripe
import (
"net/url"
"strconv"
)
type InvoiceItem struct {
Id string `json:"id"`
Object string `json:"object"`
Livemode bool `json:"livemode"`
Amount int64 `json:"amount"`
Currency string `json:"currency"`
Customer string `json:"customer"`
Date i... |
package sample
import (
"fmt"
"github.com/aliyun/aliyun-oss-go-sdk/oss"
)
// BucketRefererSample shows how to set, get and delete the bucket referer.
func BucketRefererSample() {
// New client
client, err := oss.New(endpoint, accessID, accessKey)
if err != nil {
HandleError(err)
}
// Create the bucket with... |
package libcarina
import (
"archive/zip"
"bytes"
"crypto/tls"
"crypto/x509"
"encoding/json"
"errors"
"io"
"io/ioutil"
"net/http"
"path"
"strings"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/rackspace"
)
// BetaEndpoint reflects the default endpoint for this library
const BetaEnd... |
//
// Copyright (c) 2017 Cavium
//
// SPDX-License-Identifier: Apache-2.0
//
package distro
import (
"io"
"net/http"
"github.com/go-zoo/bone"
)
func replyPing(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/text; charset=utf-8")
w.WriteHeader(http.StatusOK)
str := `pong`
... |
package distro
import (
zmq "github.com/pebbe/zmq4"
"go.uber.org/zap"
)
func initZmq() {
q, _ := zmq.NewSocket(zmq.SUB)
defer q.Close()
logger.Info("Connecting to zmq...")
q.Connect("tcp://localhost:32768")
logger.Info("Connected to zmq")
q.SetSubscribe("")
for {
msg, err := q.RecvMessage(0)
logger.Inf... |
package main
import (
"fmt"
"io"
"net"
"strconv"
)
func startServer(listenPort int, backends *Backends) {
port := strconv.Itoa(listenPort)
fmt.Println("Starting server on port ", port)
addr, _ := net.ResolveTCPAddr("tcp", ":"+port)
listener, err := net.ListenTCP("tcp", addr)
if err != nil {
fmt.Println("... |
/*
Copyright 2016 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, ... |
// 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 parser implements a parser for Go source files. Input may be
// provided in a variety of forms (see the various Parse* functions); the
// output is a... |
// 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.
// Tests for client.go
package http_test
import (
"fmt"
. "http"
"http/httptest"
"io"
"io/ioutil"
"net"
"os"
"strconv"
"strings"
"testing"
"url"
)
... |
// Copyright 2013 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 file implements sysSocket and accept for platforms that
// provide a fast path for setting SetNonblock and CloseOnExec.
// +build freebsd linux
packag... |
// 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 signal implements access to incoming signals.
package signal
// BUG(rsc): This package is not yet implemented on Plan 9 and Windows.
import (
"os"... |
package system
import (
"fmt"
"log"
"os/exec"
"os/user"
"strings"
)
type User struct {
Name string `yaml:"name"`
PasswordHash string `yaml:"passwd"`
SSHAuthorizedKeys []string `yaml:"ssh-authorized-keys"`
SSHImportGithubUser string `yaml:"coreos-ssh-import-github"`
SSHImportURL... |
package gautomator
import (
"fmt"
"github.com/gonum/matrix/mat64" // Matrix
"io"
"log"
"time"
)
const (
TASKQUEUED = -3
TASKADVERTIZED = -2
TASKRUNNING = -1
ORPHAN = -2
FATHER = -1
)
// A task is an action executed by a module
type Task struct {
Id int `json:"id"`
Father int
OriginId int... |
// Copyright 2018 The gVisor 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 agree... |
// Example channel-based high-level Apache Kafka consumer
package main
/**
* Copyright 2016 Confluent 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/li... |
package netlink
import (
"bytes"
"net"
"syscall"
"testing"
"time"
"github.com/vishvananda/netns"
)
const (
testTxQLen int = 100
defaultTxQLen int = 1000
)
func testLinkAddDel(t *testing.T, link Link) {
links, err := LinkList()
if err != nil {
t.Fatal(err)
}
num := len(links)
if err := LinkAdd(lin... |
package Pocket
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type authResponse struct {
code string
state string
}
const (
url string = "https://getpocket.com/v3/oauth/request"
redirectURI string = "https://github.com/daveym/pocket/blob/master/AUTHCOMPLETE.md"
)
// Authenticate t... |
package gardenstore_test
import (
"encoding/json"
"errors"
"io/ioutil"
"net"
"os"
"sync"
"time"
"github.com/cloudfoundry-incubator/executor"
"github.com/cloudfoundry-incubator/bbs/models"
"github.com/cloudfoundry-incubator/executor/depot/gardenstore"
"github.com/cloudfoundry-incubator/executor/depot/garde... |
package gorm_test
import (
"fmt"
"testing"
"time"
"github.com/jinzhu/gorm"
)
type Person struct {
Id int
Name string
Addresses []*Address `gorm:"many2many:person_addresses;"`
}
type PersonAddress struct {
PersonID int
AddressID int
DeletedAt time.Time
CreatedAt time.Time
}
func (*PersonAddr... |
package gps
import (
"reflect"
"testing"
)
func TestLockedProjectSorting(t *testing.T) {
// version doesn't matter here
lps := []LockedProject{
NewLockedProject(mkPI("github.com/sdboyer/gps"), NewVersion("v0.10.0"), nil),
NewLockedProject(mkPI("foo"), NewVersion("nada"), nil),
NewLockedProject(mkPI("bar"), ... |
// Copyright 2015 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package mgrconfig
import (
"encoding/json"
"fmt"
"path/filepath"
"regexp"
"strings"
"github.com/google/syzkaller/pkg/config"
"github.com/google/sy... |
package middleware
import (
"net/http"
"time"
"github.com/rs/zerolog/log"
)
// Timer gets the time taken to process the request and form the response
// Timer is not the real time between writes, but is accurate enough for me (for now)
func Timer(aud *APIAudit) Adapter {
return func(h http.Handler) http.Handler ... |
/*
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 ground
import (
"fmt"
"github.com/pkg/errors"
rbac "k8s.io/api/rbac/v1beta1"
storage "k8s.io/api/storage/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientset "k8s.io/client-go/kubernetes"
v1 "github.com/sapcc/kubernikus/pkg/apis/kubernikus/v1"
op... |
// Copyright 2018 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 agreed ... |
/*
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 executor
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path"
"strings"
)
func getBinaryNameFromCommand(command string) (string, error) {
_, name := path.Split(command)
nameSplit := strings.Split(name, " ")
if len(nameSplit) == 0 {
return "", fmt.Errorf("Failed to extract command name from %s", command)... |
package builder
import (
"github.com/Aptomi/aptomi/pkg/external"
"github.com/Aptomi/aptomi/pkg/external/secrets"
"github.com/Aptomi/aptomi/pkg/external/users"
"github.com/Aptomi/aptomi/pkg/lang"
"github.com/Aptomi/aptomi/pkg/object"
"github.com/Aptomi/aptomi/pkg/util"
"math/rand"
)
var randSeed = int64(239)
va... |
/*
Copyright 2017 Mirantis
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
distri... |
// Copyright 2017-2018 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... |
/*
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 statsd
import (
"context"
"fmt"
"math/rand"
"runtime"
"sync"
"testing"
"time"
"github.com/atlassian/gostatsd"
"github.com/atlassian/gostatsd/pkg/stats"
"github.com/ash2k/stager/wait"
"github.com/stretchr/testify/assert"
)
type testAggregator struct {
agrNumber int
af *testAggregatorFacto... |
/*
* This file is part of the KubeVirt project
*
* 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 la... |
/*
* This file is part of the KubeVirt project
*
* 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 la... |
/*
Copyright 2020 The cert-manager 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 cluster
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"os/user"
"strconv"
"strings"
"sync"
"text/template"
"time"
"github.com/flynn/flynn/cli/config"
"github.com/flynn/flynn/discoverd/client"
"github.com/flynn/flynn/pkg/random"
"github.com/flynn/flynn/test/buildlog"
)
type Cluster... |
package cluster
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"os/exec"
"os/user"
"strconv"
"strings"
"sync"
"text/template"
"time"
"github.com/flynn/flynn/cli/config"
"github.com/flynn/flynn/discoverd/client"
"github.com/flynn/flynn/pkg/iotool"
"github.com/flynn/flynn/pkg/random"
)
type... |
/*
Package sse implements the primary inner workings of the SSE Reporter.
The primary function is Run(), which starts a scheduler after initialization and registration of the
reporter with the mothership.
*/
package sse
import (
"bytes"
"collector"
"encoding/json"
"fmt"
"helper"
"io/ioutil"
"log"
"net/http"
... |
package testdata
import (
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/account"
ctypes "github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/rpc/core/types"
stypes "github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint... |
package jvm
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestEmptyValueAsString(t *testing.T) {
cst := JConst{}
assert.Equal(t, cst.valueAsString(), "")
}
func TestValueAsString(t *testing.T) {
cst := JConst{value: []byte{'h', 'e', 'l', 'l', 'o'}}
assert.Equal(t, cst.valueAsString(), "hello... |
// Tideland Go REST Server Library - JSON Web Token - Unit Tests
//
// Copyright (C) 2016 Frank Mueller / Tideland / Oldenburg / Germany
//
// All rights reserved. Use of this source code is governed
// by the new BSD license.
package jwt_test
//--------------------
// IMPORTS
//--------------------
import (
"githu... |
// Copyright 2015 bs 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 log
import (
"bytes"
"encoding/json"
"fmt"
"github.com/tsuru/tsuru/app"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httptest"
"runtime"
"strings... |
/*
Copyright 2020 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 mackerel
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"net/http/httputil"
"net/url"
"time"
"github.com/mackerelio/golib/logging"
mkr "github.com/mackerelio/mackerel-client-go"
)
var logger = logging.GetLogger("api")
// API is the main interface of Mackerel API.
type API struct {
BaseURL ... |
package macro
import (
"strconv"
"strings"
"github.com/kataras/iris/macro/interpreter/ast"
)
var (
// String type
// Allows anything (single path segment, as everything except the `Path`).
// Its functions can be used by the rest of the macros and param types whenever not available function by name is used.
/... |
// Copyright 2016 Etix Labs
//
// 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 wr... |
package mahjong
type Kaze rune
const (
東風 Kaze = '東'
南風 = '南'
西風 = '西'
北風 = '北'
)
type Order Kaze
// A Command specifies an action a player can take.
type Command int
const (
Tsumo Command = iota
TsumoHoura
RonHoura
Chi
Pong
AnngKan
MingKan
Tahai
TahaiReach
)
// An Action specifies who... |
package main
import (
"bufio"
"encoding/hex"
"encoding/json"
"math"
"net"
"strconv"
"strings"
"sync"
"time"
)
//-0b2b48fe3aef1f88621a0856110a31c01105c4e6c4e6c40a9a820300000000000000;rs=7;
/*
HDR:
MDB Type: 1
Address: 2B48FE (TIS-B track file address)
SV:
NIC: 6
Latitude... |
package main
//#include <Windows.h>
import "C"
import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"syscall"
"unsafe"
"github.com/AllenDang/w32"
"github.com/gonutz/blob"
"github.com/gonutz/d3d9"
"github.com/gonutz/mixer"
"github.com/gonutz/payload"
)
func init() {
runtime... |
package mains
import (
"context"
"errors"
"fmt"
"io"
"os"
"runtime"
"github.com/mattn/go-isatty"
"github.com/zetamatta/nyagos/frame"
"github.com/zetamatta/nyagos/functions"
"github.com/zetamatta/nyagos/history"
"github.com/zetamatta/nyagos/lua"
"github.com/zetamatta/nyagos/shell"
)
var noLuaEngineErr = ... |
// +build !ignore_autogenerated
/*
Copyright 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 l... |
package remoteexec
import (
"bufio"
"bytes"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"strings"
"time"
helper "github.com/hashicorp/terraform/helper/ssh"
"github.com/hashicorp/terraform/terraform"
)
const (
// DefaultShebang is added at the top of the script file
DefaultShebang = "#!/bin/sh"
)
type ResourcePro... |
// Copyright 2014 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.
// The coordinator runs on GCE and coordinates builds in Docker containers.
package main // import "golang.org/x/tools/dashboard/coordinator"
import (
"bytes"... |
package middlewares
import "github.com/gin-gonic/gin"
// ErrorWriter writes last error into response body if not written yet
func ErrorWriter() gin.HandlerFunc {
return func(c *gin.Context) {
c.Next()
if c.Writer.Written() {
return
}
if err := c.Errors.ByType(gin.ErrorTypeAny).Last(); err != nil {
c.... |
// Copyright (c) 2021 Uber Technologies, Inc.
//
// 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, merge... |
// Copyright 2010 The draw2d Authors. All rights reserved.
// created: 21/11/2010 by Laurent Le Goff
// Package gopher draws a gopher avatar based on a svg of:
// https://github.com/golang-samples/gopher-vector/
package gopher
import (
"image/color"
"github.com/llgcode/draw2d"
"github.com/llgcode/draw2d/samples"
... |
// Copyright 2018 The OpenPitrix Authors. All rights reserved.
// Use of this source code is governed by a Apache license
// that can be found in the LICENSE file.
package iam
import (
"context"
"fmt"
"openpitrix.io/openpitrix/pkg/constants"
"openpitrix.io/openpitrix/pkg/logger"
"openpitrix.io/openpitrix/pkg/ma... |
/*
Package docstore implements a JSON-based document store
built on top of the Versioned Key-Value store and the Blob store.
Each document will get assigned a MongoDB like ObjectId:
<binary encoded uint32 (4 bytes) + 8 random bytes hex encoded >
The resulting id will have a length of 24 characters encoded as hex (... |
package mandira
import (
"testing"
)
type M map[string]interface{}
type Test struct {
template string
context interface{}
expected string
}
func (t *Test) Run(tt *testing.T) {
output := Render(t.template, t.context)
if output != t.expected {
tt.Errorf("%v expected %v, got %v", t.template, t.expected, outpu... |
// Copyright 2016-2018 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.