CombinedText stringlengths 4 3.42M |
|---|
// Copyright (C) 2017, 2018 Damon Revoe. All rights reserved.
// Use of this source code is governed by the MIT
// license, which can be found in the LICENSE file.
package main
import (
"path/filepath"
"strings"
"testing"
)
func TestNoPackages(t *testing.T) {
pi, err := buildPackageIndex(false,
packageDefiniti... |
// Copyright 2016 The LUCI Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package buildbot
import (
"encoding/json"
"fmt"
"net/http"
"os"
"sort"
"strings"
"time"
"github.com/luci/gae/service/datastore"
"gi... |
package fs
import (
//"bufio"
"fmt"
"github.com/Sirupsen/logrus"
//"github.com/docker/libcontainer/cgroups"
"github.com/memoryLimitBySijan"
"os"
//"path/filepath"
"strconv"
)
func SijanAnanya(d *data) {
dir, err := d.join("memory")
defer func() {
if err != nil {
os.RemoveAll(dir)
}
}()
logrus.De... |
// +build integration
// Package s3manager provides
package s3manager
import (
"bytes"
"crypto/md5"
"fmt"
"io"
"os"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/test/integration"
"github.com/aws/aws-sdk-go/service/s3"
"github... |
package services
import (
"errors"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/matrix-org/go-neb/database"
"github.com/matrix-org/go-neb/matrix"
"github.com/matrix-org/go-neb/polling"
"github.com/matrix-org/go-neb/types"
"github.com/mmcdole/gofeed"
"html"
"time"
)
const minPollingIntervalSeconds = (1... |
package fetch
// The following code was sourced and modified from the
// https://github.com/andrew-d/goscrape package governed by MIT license.
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"math"
"net/http"
"net/http/cookiejar"
"net/url"
"strconv"
"strings"
"time"
"github.... |
// +build debug
package dlog
import (
"log"
"runtime"
"strings"
"github.com/kirillDanshin/myutils"
)
// D dumps a value
func (*WithCaller) D(v ...interface{}) {
c, _ := GetCaller()
log.Println(c)
for _, v := range v {
log.Printf("%+#v", v)
}
}
// F is a build-time enabled printf
func (*WithCaller) F(f st... |
// Copyright 2016 CoreOS, 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... |
// A facebook graph api client in go.
// https://github.com/huandu/facebook/
//
// Copyright 2012 - 2014, Huan Du
// Licensed under the MIT license
// https://github.com/huandu/facebook/blob/master/LICENSE
package facebook
import (
"bytes"
"fmt"
"net/http"
)
type pagingData struct {
Data []Result `facebook:",r... |
// Copyright The OpenTelemetry 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 agre... |
package resolver
import (
"fmt"
"regexp"
"strings"
"syscall"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/js_parser"
"github.com/evanw/esbuild/internal/logger"
)
// This file implements the Yarn PnP specification: https://yarnpkg.co... |
//
// Broker peering simulation (part 2).
// Prototypes the request-reply flow
//
package main
import (
zmq "github.com/pebbe/zmq3"
"fmt"
"math/rand"
"os"
//"strings"
"time"
)
const (
NBR_CLIENTS = 10
NBR_WORKERS = 3
WORKER_READY = "**READY**" // Signals worker is ready
)
var (
peers = make(map[strin... |
package controller
import (
// "archive/zip"
"encoding/json"
// "errors"
"fmt"
"path/filepath"
"strings"
// "time"
"github.com/eaciit/colony-core/v0"
"github.com/eaciit/colony-manager/helper"
"github.com/eaciit/dbox"
_ "github.com/eaciit/dbox/dbc/jsons"
// "github.com/eaciit/hdc/hdfs"
"github.com/eaciit/... |
package index
import (
"math/rand"
"restic"
"restic/repository"
"restic/test"
"testing"
"time"
)
var (
snapshotTime = time.Unix(1470492820, 207401672)
depth = 3
)
func createFilledRepo(t testing.TB, snapshots int, dup float32) (restic.Repository, func()) {
repo, cleanup := repository.TestRepository(t... |
package manager
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"net"
"net/http"
"strings"
"time"
log "github.com/Sirupsen/logrus"
r "github.com/dancannon/gorethink"
"github.com/gorilla/sessions"
"github.com/samalba/dockerclient"
"github.com/shipyard/shipyard"
"github.com/shipyard/shipyard/auth"
"githu... |
package render
import (
"image"
"image/color"
"image/draw"
)
// Composite Types, distinct from Compound Types,
// Display all of their parts at the same time,
// and respect the positions and layers of their
// parts.
type Composite struct {
rs []Modifiable
offsets []Point
}
func NewComposite(sl []Modifiab... |
package main
import (
"bufio"
"errors"
"fmt"
"io"
"net"
"strconv"
"strings"
"github.com/jaxi/chess"
)
// TCPPlayer - The Implementation of TCP protocol for chess game
type TCPPlayer struct {
conn net.Conn
io.Reader
io.Writer
}
// ShowTurn displays the message about who is playing
func (tc TCPPlayer) Show... |
package grab
import "testing"
import "net/http"
func TestURLFilenames(t *testing.T) {
tests := map[string]string{
"http://test.com/path/filename": "filename",
}
for url, expect := range tests {
req, _ := http.NewRequest("GET", url, nil)
resp := &http.Response{
Request: req,
}
actual, err := guessFile... |
package slogger
import (
"fmt"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/tychoish/grip/message"
)
func TestSlackError(t *testing.T) {
assert := assert.New(t)
msg := NewStackError("foo %s", "bar")
assert.Implements((*message.Composer)(nil), msg)
assert.Implements((*error)(nil), ms... |
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
package parse
import "unicode/utf8"
type rawtextlexer struct {
str string
pos int
lastpos int
}
func (l *rawtextlexer) eof() bool {
return l.pos >= len(l.str)
}
func (l *rawtextlexer) next() rune {
l.lastpos = l.pos
var r, width = utf8.DecodeRuneInString(l.str[l.pos:])
l.pos += width
return r
}
// r... |
// Only files including IPv4, IPv6, and Location (in english)
// will be read and parsed into lists.
package parser
import (
"bytes"
"errors"
"log"
"net"
"regexp"
"strconv"
"strings"
)
const mapMax = 200000
// IPNode defines IPv4 and IPv6 databases
type IPNode struct {
IPAddressLow net.IP
IPAddressHigh net... |
// Copyright 2016 The clang-server 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
import (
"bytes"
"io"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/go-clang/v3.9/clang"
"github.... |
package main
import (
"bufio"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"strconv"
"github.com/peteraba/d5/shared"
)
func readStdInput(logErrors bool) []byte {
reader := bufio.NewReader(os.Stdin)
bytes, err := ioutil.ReadAll(reader)
if err != nil && logErrors {
log.Println(err)
}
return bytes
}
... |
// Copyright 2012 Samuel Stauffer. All rights reserved.
// Use of this source code is governed by a 3-clause BSD
// license that can be found in the LICENSE file.
package parser
import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"strconv"
"strings"
"github.com/samuel/go-parser"
)
type Filesystem interface {
Ope... |
package funcmaps
import (
"fmt"
"html/template"
"time"
)
const (
Minute = 60
Hour = 60 * Minute
Day = 24 * Hour
Week = 7 * Day
Month = 30 * Day
Year = 12 * Month
)
func timeSince(then time.Time) string {
now := time.Now()
lbl := "前"
diff := now.Unix() - then.Unix()
if then.After(now) {
lbl ... |
package main
import (
"os"
"reflect"
"testing"
)
func TestNewCLI(t *testing.T) {
cli := NewCLI(&Context{}, &Config{}, []string{"rid", "foo", "bar"})
if !reflect.DeepEqual(cli.Args, []string{"foo", "bar"}) {
t.Error("it should drop the first argument")
}
if cli.Stdin != os.Stdin {
t.Error("it should initi... |
// Code generated by pigeon; DO NOT EDIT.
package parser
import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"math"
"os"
"sort"
"strconv"
"strings"
"unicode"
"unicode/utf8"
)
// Helper function taken from pigeon source / examples
func toIfaceSlice(v interface{}) []interface{} {
if v == nil {
return nil
... |
/*
*
* k6 - a next-generation load testing tool
* Copyright (C) 2016 Load Impact
*
* 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 (at your o... |
// Copyright © 2017 The Kubicorn 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... |
// Copyright 2017 The kubecfg 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 applica... |
// Copyright © 2017 Circonus, Inc. <support@circonus.com>
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
package cmd
import (
"encoding/json"
"fmt"
"io"
stdlog "log"
"os"
"time"
"github.com/circonus-labs/circonus-agent/internal/agent"
"github.com/ci... |
// Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package cmd
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
"github.com/Unknwon/com"
"github.com/urfave/cli"
log "gopkg.in/clog.v1"
... |
// Copyright (c) 2015-2022 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 conveymetric
import (
"github.com/Comcast/webpa-common/convey"
"github.com/go-kit/kit/metrics"
)
// UnknownLabel is a constant for when key/tag can not be found in the C JSON
const UnknownLabel = "unknown"
// MetricClosure will be returned after update of struct, this should be used to update the struct, a... |
package main
import (
"container/list"
"errors"
log "github.com/Sirupsen/logrus"
"github.com/gtfierro/cs262-project/common"
"sync"
"time"
)
type MessageHandler func(*MessageFromBroker)
type BrokerManager interface {
ConnectBroker(brokerInfo *common.BrokerInfo, commConn CommConn) (err error)
GetBrokerAddr(bro... |
package writer
import (
"fmt"
"go/format"
"testing"
"github.com/dave/jennifer/jen"
"github.com/jbowes/oag/pkg"
)
func TestSetQueryArgs(t *testing.T) {
tcs := []struct {
name string
in []pkg.Param
out string
}{
{"no args", nil, ""},
{"string arg",
[]pkg.Param{{ID: "arg", Arg: "arg", Type: &pkg.... |
package pattern
import (
"fmt"
"go/ast"
"go/token"
"go/types"
"reflect"
)
var tokensByString = map[string]Token{
"INT": Token(token.INT),
"FLOAT": Token(token.FLOAT),
"IMAG": Token(token.IMAG),
"CHAR": Token(token.CHAR),
"STRING": Token(token.STRING),
"+": Token(t... |
// Copyright 2022 PingCAP, 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 i... |
package renter
// TODO: Add failure cooldowns to the workers, particulary for uploading tasks.
import (
"sync"
"time"
"github.com/NebulousLabs/Sia/modules"
"github.com/NebulousLabs/Sia/types"
)
// A worker listens for work on a certain host.
//
// The mutex of the worker only protects the 'unprocessedChunks' an... |
package main
import (
"fmt"
"github.com/streadway/amqp"
"koding/kontrol/daemon/handler"
"koding/kontrol/daemon/handler/proxy"
"koding/tools/amqputil"
"koding/tools/config"
"log"
)
type Consumer struct {
conn *amqp.Connection
channel *amqp.Channel
tag string
done chan error
}
func init() {
log.S... |
package main
import (
"socialapi/models"
"socialapi/rest"
"socialapi/workers/common/tests"
"testing"
"github.com/koding/runner"
. "github.com/smartystreets/goconvey/convey"
)
func TestFollowedTopics(t *testing.T) {
tests.WithRunner(t, func(r *runner.Runner) {
Convey("While testing followed topics", t, func... |
package main
import (
"fmt"
"io/ioutil"
"strings"
"gopkg.in/yaml.v2"
)
type StringValue struct {
Values map[int]string
}
func NewStringValue() StringValue {
return StringValue{
Values: make(map[int]string),
}
}
func (sv StringValue) SetValue(index int, arg interface{}) error {
var value string
switch ar... |
// 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.
// +build darwin freebsd linux netbsd openbsd
package ipv4_test
import (
"code.google.com/p/go.net/ipv4"
"net"
"testing"
"time"
)
// writeThenReadPayloa... |
package v_0_1_0
const MasterTemplate = `#cloud-config
users:
{{ range $index, $user := .Cluster.Kubernetes.SSH.UserList }} - name: {{ $user.Name }}
groups:
- "sudo"
- "docker"
ssh-authorized-keys:
- "{{ $user.PublicKey }}"
{{end}}
write_files:
- path: /srv/calico-policy-controller-sa.yaml
... |
package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"strconv"
"strings"
"time"
"github.com/satori/go.uuid"
)
type treeRequest struct {
RequestType string
Action string
User string
JobId uuid.UUID
reply chan somaResult
Repository somaRepositoryRequest
Bucket ... |
// 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 valuelocmap provides a concurrency-safe data structure that maps
// keys to value locations. A key is 128 bits and is specified using two
// uint64s (keyA, keyB). A value location is specified using a blockID, offset,
// and length triplet. Each mapping is assigned a timestamp and the greatest
// timestamp w... |
/*
* 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... |
package zip
import (
gozip "archive/zip"
. "jvmgo/any"
"jvmgo/jvm/rtda"
rtc "jvmgo/jvm/rtda/class"
"jvmgo/util"
)
const (
JZENTRY_NAME = 0
JZENTRY_EXTRA = 1
JZENTRY_COMMENT = 2
)
func init() {
_zf(initIDs, "initIDs", "()V")
_zf(getEntryBytes, "getEntryBytes", "(JI)[B")
_zf(getEntryCrc, "getEntryCrc",... |
package zip
import (
gozip "archive/zip"
. "jvmgo/any"
"jvmgo/jvm/rtda"
rtc "jvmgo/jvm/rtda/class"
"jvmgo/util"
)
const (
JZENTRY_NAME = 0
JZENTRY_EXTRA = 1
JZENTRY_COMMENT = 2
)
func init() {
_zf(initIDs, "initIDs", "()V")
_zf(getEntryBytes, "getEntryBytes", "(JI)[B")
_zf(getEntryCrc, "getEntryCrc",... |
package server
import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"github.com/bouk/httprouter"
"github.com/influxdata/chronograf"
)
func validPermissions(perms *chronograf.Permissions) error {
if perms == nil {
return nil
}
for _, perm := range *perms {
if perm.Scope != chronograf.AllScope &... |
// 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 ... |
package tictactoe
import (
"errors"
"github.com/jkomoros/boardgame"
)
type MovePlaceToken struct {
//Which token to place the token
Slot int
//Which player we THINK is making the move.
TargetPlayerIndex int
}
func (m *MovePlaceToken) Legal(payload boardgame.StatePayload) error {
p := payload.(*statePayload)
... |
// Copyright (c) 2018 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 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... |
package app
import (
"errors"
"fmt"
)
var (
// ErrNotFound Item not found
ErrNotFound = errors.New("not found")
// ErrInvalid Invalid request
ErrInvalid = errors.New("invalid")
// ErrExists Item already exists
ErrExists = errors.New("exists")
// ErrNoAccess Access to item not allowed
ErrNoAccess = errors... |
// Copyright (c) 2017 Intel 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 by applicable law or ag... |
package sarama
import (
"errors"
"fmt"
"math"
"sync"
"sync/atomic"
"time"
"github.com/rcrowley/go-metrics"
)
// ConsumerMessage encapsulates a Kafka message returned by the consumer.
type ConsumerMessage struct {
Headers []*RecordHeader // only set if kafka is version 0.11+
Timestamp time.Time ... |
package peerstream_multiplex
import (
"net"
smux "github.com/jbenet/go-stream-mux"
mp "github.com/jbenet/go-stream-muxer/Godeps/_workspace/src/github.com/whyrusleeping/go-multiplex" // Conn is a connection to a remote peer.
)
type conn struct {
*mp.Multiplex
}
func (c *conn) Close() error {
return c.Multiplex.... |
// Copyright (c) 2013 Mathieu Turcotte
// Licensed under the MIT license.
package main
import (
"flag"
"fmt"
"github.com/MathieuTurcotte/sourcemap"
"os"
)
var line = flag.Int("line", -1, "line number to lookup")
var column = flag.Int("column", -1, "column number to lookup")
var printMap = flag.Bool("print", fals... |
package spotify
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strings"
"testing"
"time"
)
func TestFeaturedPlaylists(t *testing.T) {
client, server := testClientFile(http.StatusOK, "test_data/featured_playlists.txt")
defer server.Close()
country := "SE"
msg, p, err := client.... |
package salesforcefsdb
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"path"
"time"
httputil "github.com/grokify/gotilla/net/httputilmore"
)
type FsdbClient struct {
Config SalesforceClientConfig
RestClient RestClient
}
func NewFsdbClient(cfg SalesforceClientConfig) FsdbClient {
... |
package queue
import "time"
// -----------------------------------------------------------------------------
// TimeoutReached returns `true` if the time elapsed since `m.Timeout` is
// greater or equal to `d`. It returns `false` otherwise.
func (m *Message) TimeoutReached(d time.Duration) bool {
if elapsed := time... |
package ergoq
import (
"fmt"
"github.com/garyburd/redigo/redis"
)
const (
RETRY_QUEUE = "ergoq-retry:"
MESSAGE_COUNTER = "ergoq-counter:"
)
var (
popScript *redis.Script
ackScript *redis.Script
queueNonAckedScript *redis.Script
)
func init() {
// redis lua script to POP message from... |
package wayffunctionaltest
import (
"bytes"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"encoding/base64"
"errors"
"flag"
"fmt"
toml "github.com/pelletier/go-toml"
"github.com/wayf-dk/go-libxml2/types"
"github.com/wayf-dk/gosaml"
"github.com/wayf-dk/goxml"
"github.com/wayf-dk/lMDQ"
"github.com/wayf-dk/wayfhy... |
// Copyright 2015 ThoughtWorks, Inc.
// This file is part of Gauge.
// Gauge 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.
// G... |
package armhelpers
import (
"fmt"
"time"
"github.com/Azure/azure-sdk-for-go/arm/authorization"
"github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/arm/graphrbac"
"github.com/Azure/azure-sdk-for-go/arm/resources/resources"
"github.com/Azure/go-autorest/autorest"
)
//MockACSEngine... |
/*
Copyright 2016 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... |
package control
import (
"bufio"
"context"
cryptorand "crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/base64"
"encoding/csv"
"encoding/hex"
"fmt"
"html/template"
"io"
"io/ioutil"
"math/rand"
"net"
"net/http"
"os"
"path"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/rancher/k3s/pkg/da... |
/*
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, ... |
/*
* MinIO Cloud Storage, (C) 2018 MinIO, 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 la... |
//go:build linux || solaris || darwin || freebsd
// +build linux solaris darwin freebsd
package lockfile
import (
"bytes"
cryptorand "crypto/rand"
"encoding/binary"
"fmt"
"os"
"path/filepath"
"sync"
"sync/atomic"
"time"
"github.com/containers/storage/pkg/system"
"golang.org/x/sys/unix"
)
type lockfile st... |
/*
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 paxos
import (
"borg/assert"
"testing"
)
func TestCoordIgnoreOldMessages(t *testing.T) {
ins := make(chan Msg)
outs := SyncPutter(make(chan Msg))
clock := make(chan int)
tCh := make(chan string)
done := make(chan int)
nNodes := uint64(10) // this is arbitrary
go func() {
coordinator(1, UNUSED, nNo... |
package service
import (
"crypto/hmac"
"hash"
)
// Signable is a type which can be signed
type Signable interface {
Message() []byte
HashFunc() func() hash.Hash
}
// Signed is a type which has been signed
// The signature can be authenticated using the Signable interface and recreating the signature
type Signed ... |
// Copyright 2017 Francisco Souza. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package fakestorage
import (
"bytes"
"compress/gzip"
"context"
"crypto/tls"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"reflect"
"strings"
... |
/*
* Copyright 2016 Robin Engel
*
* 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... |
/*
* 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 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package build
import (
"bytes"
"compress/gzip"
"crypto/sha1"
"errors"
"fmt"
"io"
"io/ioutil"
"strings"
"time"
"appengine"
"appengine/datastore"
)
... |
/*
Copyright 2014 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
/*
* 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... |
// Package netint (linode-netint) is a client for accessing the Linode network
// internals samples. This API is undocumented and looks to be a set of
// unauthenticated endpoints that provide JSON data. This package also does
// some alterations to the data provided by Linode as some of the JSON types
// don't make se... |
// Copyright 2015 ikawaha
//
// 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... |
// Generic operations on filesystems and objects
package fs
import (
"fmt"
"io"
"log"
"mime"
"path"
"sort"
"strings"
"sync"
"sync/atomic"
"github.com/pkg/errors"
"github.com/spf13/pflag"
"golang.org/x/text/unicode/norm"
)
// CalculateModifyWindow works out modify window for Fses passed in -
// sets Con... |
// Copyright 2015 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 gc
import (
"bytes"
"fmt"
"html"
"os"
"strings"
"cmd/compile/internal/ssa"
"cmd/internal/obj"
"cmd/internal/sys"
)
var ssaEnabled = true
var... |
// 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 gc
import (
"cmd/compile/internal/types"
"fmt"
"sort"
)
const (
// expression switch
switchKindExpr = iota // switch a {...} or switch 5 {...}
... |
// On-disk mutex protecting a resource
//
// A lock is represented on disk by a directory of a particular name,
// containing an information file. Taking a lock is done by renaming a
// temporary directory into place. We use temporary directories because for
// all filesystems we believe that exactly one attempt to c... |
// Inferno utils/6l/span.c
// https://bitbucket.org/inferno-os/inferno-os/src/default/utils/6l/span.c
//
// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
// Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
// Portions Copyright © 1997-1999 Vita Nuova Limited
// Portions Copyrigh... |
// 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 structs
import (
"bytes"
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"encoding/hex"
"errors"
"fmt"
"io"
"net"
"os"
"path/filepath"
"reflect"
"regexp"
"sort"
"strconv"
"strings"
"time"
"golang.org/x/crypto/blake2b"
"github.com/gorhill/cronexpr"
"github.com/hashicorp/consul/... |
package cliTricks
import (
"encoding/json"
"errors"
"fmt"
"github.com/stretchr/testify/assert"
"reflect"
"testing"
)
func TestBreakupStringArray(t *testing.T) {
testData := []struct {
input string
output []string
}{
{
input: "apple,banana,cherry",
output: []string{"apple", "banana", "cherry"},
... |
// Copyright 2020 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
package structs
import (
"bytes"
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"encoding/hex"
"errors"
"fmt"
"io"
"net"
"os"
"path/filepath"
"reflect"
"regexp"
"sort"
"strconv"
"strings"
"time"
"github.com/gorhill/cronexpr"
"github.com/hashicorp/consul/api"
"github.com/hashicorp/go-m... |
package lnwire
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"math"
"net"
"github.com/go-errors/errors"
"github.com/roasbeef/btcd/btcec"
"github.com/roasbeef/btcd/chaincfg/chainhash"
"github.com/roasbeef/btcd/wire"
"github.com/roasbeef/btcutil"
)
// MaxSliceLength is the maximum allowed lenth for any opa... |
package structs
import (
"bytes"
"container/heap"
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"encoding/base32"
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
"hash"
"hash/crc32"
"math"
"net"
"os"
"reflect"
"regexp"
"sort"
"strconv"
"strings"
"time"
"github.com/hashicorp/nomad/h... |
package common
import (
"io/ioutil"
"os"
"strings"
"testing"
. "github.com/onsi/gomega"
)
var (
testAppName = "test-app-1"
testAppDir = strings.Join([]string{"/home/dokku/", testAppName}, "")
testEnvFile = strings.Join([]string{testAppDir, "/ENV"}, "")
testEnvLine = "export testKey=TESTING"
testAppNam... |
package common
import (
"fmt"
"log"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/hashicorp/packer/template/interpolate"
)
// AccessConfig is for common configuration related to ... |
package logging
import (
"fmt"
"path"
"runtime"
"strings"
"github.com/Sirupsen/logrus"
)
const (
prefix = "github.com/control-center/serviced/"
vendorprefix = prefix + "vendor/"
)
type ContextHook struct{}
func (hook ContextHook) Levels() []logrus.Level {
return logrus.AllLevels
}
func (hook Context... |
package fuse
// all of the code for DirEntryList.
import (
"bytes"
"log"
"unsafe"
"github.com/hanwen/go-fuse/raw"
)
var _ = log.Print
var eightPadding [8]byte
// DirEntry is a type for PathFileSystem and NodeFileSystem to return
// directory contents in.
type DirEntry struct {
Mode uint32
Name string
}
type... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.