text stringlengths 3.08k 10.4k |
|---|
/*
Copyright 2021 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 files
import (
"io"
"io/ioutil"
"mime"
"mime/multipart"
"net/url"
"path"
"strings"
)
const (
multipartFormdataType = "multipart/form-data"
multipartMixedType = "multipart/mixed"
applicationDirectory = "application/x-directory"
applicationSymlink = "application/symlink"
applicationFile =... |
package remote
import (
"bytes"
"errors"
"io"
"os"
"path/filepath"
"sync"
"github.com/spf13/viper"
"github.com/taptap/go-apollo"
)
var (
ErrUnsupportedProvider = errors.New("This configuration manager is not supported")
_ viperConfigManager = apolloConfigManager{}
// getConfigManager方法每次返回新对象导致缓存无效,
// ... |
// Copyright (C) MongoDB, Inc. 2014-present.
//
// 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
package mongoreplay
import (
"fmt"
"io"
"strin... |
package model
import (
"encoding/json"
"time"
"github.com/caos/zitadel/internal/crypto"
"github.com/caos/zitadel/internal/repository/iam"
"github.com/caos/zitadel/internal/repository/org"
es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model"
org_es_model "github.com/caos/zitadel/inter... |
package gitlab
import "time"
type GitLabObj struct {
ObjectKind string `json:"object_kind"`
Before string `json:"before"`
After string `json:"after"`
Ref string `json:"ref"`
CheckoutSha string `json:"checkout_sha"`
Message ... |
/*
Copyright 2021 The Knative 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, soft... |
package main
import (
"context"
"flag"
"fmt"
"io"
"os"
"time"
api "github.com/osrg/gobgp/api"
"google.golang.org/grpc"
)
var (
peerOpt = flag.Int("p", 8, "number of peers")
routeOpt = flag.Int64("r", 771684, "number of routes")
startBgp = flag.Bool("start-bgp", false, "start bgp")
policyOpt = flag.Bo... |
/* This file handles daemon and services related tasks.
By using cvpm daemon install, it will install a system service under current user.
You can uninstall that service by using cvpm daemon uninstall */
package main
import (
"github.com/fatih/color"
"github.com/gin-gonic/gin"
"github.com/googollee/go-socket.io"
... |
package types
// block.go defines the Block type for Sia, and provides some helper functions
// for working with blocks.
import (
"encoding/json"
"fmt"
"io"
"github.com/threefoldtech/rivine/build"
"github.com/threefoldtech/rivine/crypto"
"github.com/threefoldtech/rivine/pkg/encoding/rivbin"
"github.com/threef... |
// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import (
"encoding/json"
"math"
"github.com/cpmech/gofem/fem"
"github.com/cpmech/gofem/inp"
"github.com/cpmech/goga"
"github.com/... |
/*
Copyright © 2021 Alibaba Group Holding 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 agreed to in writ... |
package mstypes
import (
"bytes"
"encoding/hex"
"errors"
"fmt"
"github.com/jcmturner/rpc/v2/ndr"
"golang.org/x/net/http2/hpack"
)
// Compression format assigned numbers. https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-xca/a8b7cb0a-92a6-4187-a23b-5e14273b96f8
const (
CompressionFormatNone ... |
/* (c) 2019, Blender Foundation - <NAME>
*
* 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, pub... |
package pickett
import (
"fmt"
"path/filepath"
"strings"
"time"
"github.com/igneous-systems/pickett/io"
)
// extractionBuilder implements the builder interface so it can be part of a node.
// extractions pull things from their runIn image or node and merge them into another
// node or image. typically, they ar... |
package main
import (
"fmt"
"os"
"github.com/buger/goterm"
"github.com/spf13/cobra"
"github.com/kelda/blimp/cli/bugtool"
"github.com/kelda/blimp/cli/build"
"github.com/kelda/blimp/cli/cp"
"github.com/kelda/blimp/cli/down"
"github.com/kelda/blimp/cli/exec"
"github.com/kelda/blimp/cli/expose"
"github.com/ke... |
/*
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
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 writi... |
package iso8601
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestPeriod_FromString(t *testing.T) {
result, err := PeriodFromString("DT1S")
assert.Nil(t, result)
assert.NotNil(t, err)
assert.Equal(t, "invalid period representation, must start with P", err.Error())
result, err = Perio... |
package mapreduce
import (
"fmt"
"net"
"sync"
)
// Master holds all the state that the master needs to keep track of. Of
// particular importance is registerChannel, the channel that notifies the
// master of workers that have gone idle and are in need of new work.
//master有master需要跟踪的所有状态。 RegisterChannel是一个特别重要的... |
package tcp
import (
"context"
"fmt"
"net/http"
"github.com/containous/traefik/pkg/config"
"github.com/containous/traefik/pkg/log"
"github.com/containous/traefik/pkg/rules"
"github.com/containous/traefik/pkg/server/internal"
tcpservice "github.com/containous/traefik/pkg/server/service/tcp"
"github.com/contai... |
package aegis
//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
//distrib... |
// 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 ... |
package buildsys
import (
"fmt"
"strings"
"github.com/rotisserie/eris"
"go.starlark.net/starlark"
starsyntax "go.starlark.net/syntax"
"mvdan.cc/sh/v3/syntax"
)
type TaskCmdScript struct {
TaskName string
Content string
Index int
}
func (s TaskCmdScript) ToTask() (*Task, error) {
return nil, nil
}
fun... |
package src
import (
"github.com/stretchr/testify/assert"
"testing"
"time"
)
func TestPriorityLruCache_New(t *testing.T) {
lruCache := New(5)
assert.Equal(t, 5, lruCache.maxSize)
}
func TestPriorityLruCache_Get(t *testing.T) {
lruCache := New(5)
lruCache.Set("TestKey", "TestValue", 1, time.Date(9999, 0, 0, 0... |
// 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 rest
import (
"errors"
CLI "go_svelte_lighthouse/cli"
DATABASE "go_svelte_lighthouse/database"
LOGS "go_svelte_lighthouse/logs"
"log"
"net/url"
"runtime"
"strings"
"sync"
"time"
)
// SiteObject | struct to hold site details when fetching data
type SiteObject struct {
name string
url ... |
package main
import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"os"
"reflect"
"sort"
"strings"
"sync"
)
type cssFile struct {
fileName string
classes map[string][]string
}
func (source cssFile) deepCopyCssFile() cssFile {
extractedFile := source
extractedFile.classes = map[string][]string{}
for key, value := ... |
package strftime
import (
"errors"
"io"
"strings"
"sync"
"time"
)
type compileHandler interface {
handle(Appender)
}
// compile, and create an appender list
type appenderListBuilder struct {
list *combiningAppend
}
func (alb *appenderListBuilder) handle(a Appender) {
alb.list.Append(a)
}
// compile, and ex... |
/*
Copyright 2019 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... |
package cmd
import (
"crypto/tls"
"crypto/x509"
"errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
"path/filepath"
"runtime"
"strings"
"time"
minio "github.com/minio/minio-go/v6"
"github.com/spf13/cobra"
"golang.org/x/net/http2"
)
const (
defaultSOSZone = "ch-dk-2"
minioMaxRetry = 2
)
// sosCmd repr... |
package admin
import (
"encoding/json"
aphttp "gateway/http"
"gateway/model"
apsql "gateway/sql"
"gateway/store"
"time"
"golang.org/x/net/websocket"
)
const (
NOTIFY_COMMAND_REGISTER = iota
NOTIFY_COMMAND_UNREGISTER
)
type Notification struct {
Resource string `json:"resource"`
Action str... |
package oom
import (
"context"
"encoding/json"
"errors"
"sync"
"time"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sig... |
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"strings"
"github.com/artemnikitin/devicefarm-ci-tool/errors"
"github.com/artemnikitin/devicefarm-ci-tool/model"
"github.com/artemnikitin/devicefarm-ci-tool/service"
"github.com/artemnikitin/devicefarm-ci-tool/tools"
"github.com/aws/aws-sdk-go/aws"
... |
package tm
/*
#cgo CFLAGS: -I./headers/
#include "cgo.h"
inline void* inc_ptr(void * ptr) {return ++ptr;}
inline tm_engine_update_array_t *cgo_engine_update_set_get_arrays(struct tm_engine_update_set_t *data) {
return data->arrays;
}
*/
import "C"
import (
"unsafe"
)
type Entity uint64
func (e Entity) c() (entit... |
package target
import (
"flag"
"fmt"
"io"
"os"
"strings"
"github.com/upsight/ron/execute"
"github.com/upsight/ron/target"
)
// Command ...
type Command struct {
W io.Writer
WErr io.Writer
AppName string
Name string
}
// Key returns the commands name for sorting.
func (c *Command) Key() string... |
package grpcpool
import (
"context"
"errors"
"google.golang.org/grpc"
"sync"
"sync/atomic"
"time"
"wheels/log"
)
var debug = false
// ErrorPoolSize means the initial size is wring
var ErrorPoolSize = errors.New("the size of grpc connection pool should be greater than 0")
// ErrorPoolFull means grpc conn pool... |
// Package flash provides flash message utilities
package flash
import (
"context"
"errors"
"html/template"
"net/http"
"time"
"github.com/bokwoon95/nusskylabx/helpers/cookies"
"github.com/bokwoon95/nusskylabx/helpers/erro"
)
// FlashMsg represents a flash message
type FlashMsg struct {
Valid bool `json:"Va... |
// Copyright 2019 The Go Cloud Development Kit 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appli... |
/*
Problem: Go reflection does not support enumerating types, variables and functions of packages.
pkgreflect generates a file named pkgreflect.go in every parsed package directory.
This file contains the following maps of exported names to reflection types/values:
var Types = map[string]reflect.Type{ ... }
var Fun... |
// Copyright (c) 2018 The Bitum developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"context"
"encoding/binary"
"math/big"
"net/http"
"os"
"os/signal"
"runtime"
bolt "github.com/coreos/bbolt"
"github.com/bitum-project/bitumd/bit... |
// package contains handlers
package controller
import (
"context"
"fmt"
"log"
"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/bson/primitive"
"github.com/mongodb/mongo-go-driver/mongo"
"gitlab.com/codelittinc/golang-interview-project-jaime/grpc-crud/hirepb"
"gitlab.com/codelitti... |
package mathx
import (
"math"
"math/rand"
"time"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
// Distancer is an interface for types that can caluclate some select
// distance functions such as Euclidean or Cosine. This is meant to
// be used with some underlying vector such as []float64 or variants.
type ... |
/*
MIT License
Copyright (c) 2018 <NAME>
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, publish, distrib... |
package controllers
import (
"context"
"fmt"
"github.com/coreos/go-semver/semver"
v1 "github.com/openshift/api/config/v1"
"github.com/openshift/assisted-service/internal/network"
metal3iov1alpha1 "github.com/openshift/cluster-baremetal-operator/api/v1alpha1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus... |
package game
import (
"fmt"
"strings"
)
type Action struct {
Type ActionType
// a faux effect that resolves after a choice-based action, such as returning Scry cards and drawing
AfterEffect *Effect
Card *Card
// the spell target Card's coming into play effect
EntersTheBattleFieldSpellTarget StackObjec... |
package client
import (
"fmt"
"os"
"sync"
"time"
"github.com/0xNathanW/bittorrent-go/p2p"
msg "github.com/0xNathanW/bittorrent-go/p2p/message"
"github.com/0xNathanW/bittorrent-go/torrent"
)
func (c *Client) Run() {
workQ := c.Torrent.NewWorkQueue() // workQ is the queue of pieces we need to download.
... |
package http
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"time"
"github.com/csmith/goplum"
"github.com/nelkinda/health-go"
)
var client = http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
ForceAttemptHTTP2: true,
DisableKeep... |
package chroma
import (
"fmt"
"math"
"strconv"
"strings"
)
// ANSI2RGB maps ANSI colour names, as supported by Chroma, to hex RGB values.
var ANSI2RGB = map[string]string{
"#ansiblack": "000000",
"#ansidarkred": "7f0000",
"#ansidarkgreen": "007f00",
"#ansibrown": "7f7fe0",
"#ansidarkblue": "00007f... |
package render
import (
"bytes"
"encoding/json"
"strings"
"text/template"
"github.com/solo-io/skv2/codegen/util/stringutils"
"github.com/BurntSushi/toml"
"github.com/Masterminds/sprig/v3"
"github.com/golang/protobuf/protoc-gen-go/descriptor"
"github.com/iancoleman/strcase"
"github.com/solo-io/skv2/codegen/... |
// Package vm defines data types and functions define and
// share data between the runtime runq, proxy and init.
package vm
import (
"bytes"
"compress/gzip"
"encoding/base64"
"encoding/gob"
"io/ioutil"
"net"
"syscall"
"github.com/vishvananda/netlink"
)
// Msgtype declares the type of a message.
type Msgtype... |
package cmd
import (
"context"
"fmt"
"github.com/c-pls/golyrics"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/zmb3/spotify/v2"
"golang.org/x/oauth2"
"strconv"
"strings"
)
func init() {
rootCmd.AddCommand(cmdStatus)
rootCmd.AddCommand(cmdModifyVolume)
rootCmd.AddCommand(cmdPause)
rootCmd.... |
// Copyright DataStax, Inc.
// Please see the included license file for details.
package ginkgo_util
import (
"fmt"
"os"
"regexp"
"strings"
"time"
ginkgo "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/datastax/cass-operator/mage/kubectl"
mageutil "github.com/datastax/cass-operator/mage/uti... |
package swarm
import (
"context"
"fmt"
"strings"
"sync"
"bitbucket.org/kleinnic74/photos/logging"
"github.com/grandcat/zeroconf"
"go.uber.org/zap"
)
const (
PhotoscopeSVCName = "_photoscope._tcp"
DNSSDSVCName = "_services._dns-sd._udp"
)
type Peer struct {
Name string `json:"name"`
... |
package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/hex"
"encoding/pem"
"flag"
"strconv"
"strings"
"io/ioutil"
"github.com/golang/glog"
"github.com/golang/protobuf/proto"
pb "github.com/google/go-tpm-tools/proto"
"github.com/google/go-t... |
// Copyright (c) 2015 <NAME> https://worg.xyz
// 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, ... |
// Package meta provides access to kubernetes objects via informers
package meta
import (
"fmt"
"io"
"strings"
"time"
"github.com/sirupsen/logrus"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"
)
const (
// ... |
package handlers
import (
"errors"
"fmt"
"github.com/gin-gonic/gin"
"github.com/jitsucom/jitsu/server/config"
"github.com/jitsucom/jitsu/server/logging"
"github.com/jitsucom/jitsu/server/middleware"
"github.com/jitsucom/jitsu/server/plugins"
"github.com/jitsucom/jitsu/server/schema"
"github.com/jitsucom/jitsu... |
package main
import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"flag"
"image"
"image/gif"
"image/jpeg"
"image/png"
"io/ioutil"
"log"
"net/http"
"os"
"path"
"path/filepath"
"strconv"
"strings"
"github.com/caoyongzheng/gotest/utils/fileutil"
"github.com/caoyongzheng/image-server/utils"
"github.com... |
/*
* Copyright 2018 DE-labtory
*
* 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 w... |
/**
* Copyright 2015 Comcast Cable Communications Management, 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... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
package tty
import (
"fmt"
"io"
"net"
"net/http"
"os/exec"
"os/user"
"sync"
"text/template"
"github.com/braintree/manners"
"github.com/gorilla/websocket"
"github.com/yubo/gotty/rec"
)
type clientContext struct {
session *session
request *http.Request
connection *webConn
connections *map[ConnK... |
package ship
import (
"fmt"
"math"
"strconv"
"github.com/pkg/errors"
)
type Op rune
const (
OpMvNorth Op = 'N'
OpMvSouth Op = 'S'
OpMvEast Op = 'E'
OpMvWest Op = 'W'
OpTurnLeft Op = 'L'
OpTurnRight Op = 'R'
OpMvFwd Op = 'F'
)
type Instruction struct {
Op Op
Value int
}
func (i Instr... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: CommonMessage.proto
package CommonMessage // import "msgProto/CommonMessage"
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
va... |
package eventbus
import (
"encoding/json"
"fmt"
"github.com/aeden/eventbus/middleware"
"io"
"io/ioutil"
"log"
"net/http"
"time"
)
// configuration options
type option func(*Server)
// The EventBus server.
type Server struct {
httpServer *http.Server
corsHostAndPort string
eventStore EventStore
... |
/**
* @Author: jager
* @Email: <EMAIL>
* @File: client
* @Date: 2021/6/9 4:13 下午
* @package: rpc
* @Version: v1.0.0
*
* @Description:
*
*/
package rpcx
import (
"context"
"fmt"
"github.com/jageros/hawox/contextx"
"google.golang.org/grpc/resolver"
"sync"
"time"
"github.com/jageros/hawox/errc... |
/*
* Copyright IBM Corp. 2018 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 ... |
package mux_net
import (
"encoding/binary"
"errors"
"fmt"
"goproxy/common"
"goproxy/log"
"goproxy/mux/mux_link"
"goproxy/mux/mux_msg"
"io"
"net"
"sync/atomic"
)
var errConnectFail = errors.New("connect to the main server failed")
var errHandshake = errors.New("handshake with server failure")
var errSecretk... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package s3
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
smithy "github.com/awslabs/smithy-go"
"github.com/awslabs/smithy-go/middlewar... |
package main
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"syscall"
"time"
"github.com/protofire/filecoin-rpc-proxy/internal/cache"
"github.com/protofire/filecoin-rpc-proxy/internal/config"
"github.com/protofire/filecoin-rpc-proxy/internal/logger"
"github.com/protofire/filecoin-rpc-proxy/internal/match... |
package stdlib
import "os"
import "strings"
import . "../api"
/* key, in the registry, for table of loaded modules */
const LUA_LOADED_TABLE = "_LOADED"
/* key, in the registry, for table of preloaded loaders */
const LUA_PRELOAD_TABLE = "_PRELOAD"
const (
LUA_DIRSEP = string(os.PathSeparator)
LUA_PATH_SEP = ... |
package aquasec
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"github.com/aquasecurity/terraform-provider-aquasec/client"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/mitchellh/go-homedir"
)
//Config - godoc
t... |
package simulator
import (
"fmt"
"sync"
"time"
logutil "github.com/docker/infrakit/pkg/log"
"github.com/docker/infrakit/pkg/plugin"
"github.com/docker/infrakit/pkg/spi/instance"
"github.com/docker/infrakit/pkg/store"
"github.com/docker/infrakit/pkg/store/file"
"github.com/docker/infrakit/pkg/store/mem"
"git... |
package medianame
import (
"regexp"
"strings"
"github.com/labstack/gommon/log"
)
const (
resolutionTag = "resolution"
sourceTag = "source"
codecTag = "codec"
)
var (
resolutions = []qualityComponent{
qualityComponent{
t: resolutionTag,
v: 10,
n: "360p",
},
qualityComponent{t: resoluti... |
package cmd
import (
"crypto/rand"
"errors"
"fmt"
"io/ioutil"
"strconv"
"strings"
"github.com/kennygrant/sanitize"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.bryk.io/pkg/cli"
"go.bryk.io/pkg/crypto/shamir"
"go.bryk.io/pkg/did"
xlog "go.bryk.io/pkg/log"
)
var registerCmd = &cobra.Command{
Use... |
// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package period
import (
"fmt"
"strconv"
"strings"
)
// MustParse is as per Parse except that it panics if the string cannot be parsed.
// This is intended for setu... |
package stackdriver
import "github.com/grafana-tools/sdk"
// Option represents an option that can be used to configure a stackdriver query.
type Option func(target *Stackdriver)
const AlignmentStackdriverAuto = "stackdriver-auto"
const AlignmentGrafanaAuto = "grafana-auto"
// Aligner specifies the operation that wi... |
package bin
import (
"fmt"
"strconv"
"strings"
"github.com/pkg/errors"
)
// A File is a binary executable.
type File struct {
// Machine architecture specifying the assembly instruction set.
Arch Arch
// Entry point of the executable.
Entry Address
// Sections (and segments) of the executable. Sections are ... |
package pkg
import (
"database/sql"
)
var (
Username string
Password string
Ip string
Port string
Dbname string
Before *basic
)
func NewBasic() *basic {
return &basic{}
}
type basic struct {
// mysql conn
mysqlConn *sql.DB
//basic info
Hostname string
Ips ... |
package algorithm
import (
"math/rand"
"sync/atomic"
)
//节点存储的key 和 value
type Node struct {
index uint64 //用来排序
value interface{}
nextNodes []*Node // 这个节点的当前层存储的节点 0 - 31
}
/**
创建一个节点,创建这个节点时指定这个节点所在层
*/
func newNode(index uint64, value interface{}, level int) *Node {
return &Node{
index: index... |
package errors
import (
"bytes"
"encoding/json"
"fmt"
"reflect"
"runtime"
"strings"
)
var MaxStackDepth = 50
type Tag string
func (t Tag) String() string {
return string(t)
}
func (t Tag) Is(tag interface{}) bool {
return fmt.Sprint(tag) == t.String()
}
type Error struct {
msg string
parent error
sta... |
// 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.
// Executable image layout - address assignment.
package main
import (
"debug/goobj"
)
// A layoutSection describes a single section to add to the
// final... |
package export
import (
"context"
"fmt"
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/cfunkhouser/lb112x"
)
type deviceMetrics struct {
temperature prometheus.Gauge
tempCritical prometheus.Gauge
resetRequired prometheus.... |
package ladder_test
import (
"fmt"
"os"
"reflect"
"testing"
"github.com/arvenil/kata/ladder"
)
type args struct {
start string
end string
}
var tests = []struct {
args args
wantWords []string
wantErr bool
}{
{args{"cat", "dog"}, []string{"cat", "dat", "dot", "dog"}, false},
{args{"gold", "lead"... |
package hub
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"reflect"
"strings"
"testing"
"github.com/microscaling/microbadger/registry"
)
func TestNewService(t *testing.T) {
i := NewService()
if i.baseURL != "https://hub.docker.com" {
t.Errorf("Unexpected hub URL %s", i.baseURL)
}
... |
//go:build integration
// +build integration
package e2e
import (
"bytes"
"context"
"fmt"
"io/ioutil"
"net/http"
"path/filepath"
"testing"
"time"
"github.com/efficientgo/e2e"
"github.com/efficientgo/tools/core/pkg/backoff"
"github.com/efficientgo/tools/core/pkg/testutil"
)
const (
traceJSON = `
{
"reso... |
package schema
import (
"database/sql"
"github.com/godzie44/d3/orm/entity"
"github.com/stretchr/testify/assert"
"reflect"
"testing"
"time"
)
func TestTypeMapping(t *testing.T) {
tp, err := reflectTypeToDbType(reflect.TypeOf(int(1)))
assert.NoError(t, err)
assert.Equal(t, Int, tp)
tp, err = reflectTypeToDbT... |
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"middle-ware/util"
"net"
"net/http"
"strconv"
)
type launchClient struct {
TraceDataPort string
SetWTIConn *util.TcpClient
GetWTConn *util.TcpClient
}
func NewLaunchClient() *launchClient {
return &launchClient{}
}
func (lc *launchClient)... |
package main
import (
"bufio"
"errors"
"io"
"log"
"net"
"os"
"strconv"
"strings"
"time"
forward "github.com/1lann/udp-forward"
)
type link struct {
addr string
linkType string
}
func (l link) isTCP() bool {
return strings.HasPrefix(l.linkType, "tcp") || strings.HasPrefix(l.linkType, "unix")
}
func... |
package handlers
import (
"fmt"
"github.com/SteakBarbare/RPGBot/database"
"github.com/SteakBarbare/RPGBot/utils"
"github.com/bwmarrin/discordgo"
)
func inviteCommandHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
c, err := s.Channel(m.ChannelID)
if err != nil {
s.ChannelMessageSend(m.ChannelID, u... |
// +build !integration
package state_container
import (
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"testing"
"github.com/elastic/beats/libbeat/common"
mbtest "github.com/elastic/beats/metricbeat/mb/testing"
"github.com/stretchr/testify/assert"
)
const testFile = "../_meta/test/kube-state-metrics"
fun... |
package schema
import (
"github.com/nbs-go/nsql/test_utils"
"testing"
"time"
)
type Person struct {
CreatedAt time.Time `db:"createdAt"`
UpdatedAt time.Time `db:"updatedAt"`
Id int64 `db:"id"`
FullName string `db:"fullName"`
BirthDate string `db:"birthDate"`
Age int `db:"-"`
Ni... |
// Package avl implements an easy-to-use AVL tree in Golang.
package avl
// Range is the basic node for the AVL tree leaves.
// The concept Range can be a real data range in most cases, such as
// [LOWER_BOUND, UPPER_BOUND] .
// A Range can also be a single value, such as [VALUE_A, VALUE_A] .
type Range interface {
... |
// mqtt-history
// https://github.com/topfreegames/mqtt-history
//
// Licensed under the MIT license:
// http://www.opensource.org/licenses/mit-license
// Copyright © 2016 Top Free Games <<EMAIL>>
package app
import (
"bytes"
"context"
"encoding/json"
"io"
"io/ioutil"
"net/http"
"strings"
"time"
"github.com... |
// Copyright (C) 2021 Toitware ApS. All rights reserved.
// Use of this source code is governed by an MIT-style license that can be
// found in the LICENSE file.
package commands
import (
"context"
"encoding/json"
"fmt"
"net"
"sort"
"time"
"github.com/manifoldco/promptui"
"github.com/spf13/cobra"
"github.co... |
package cmd
import (
"fmt"
"io/ioutil"
"os"
"path"
"strings"
"github.com/pa/dotman/utils"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
// updateExternalsCmd represents the updateExternals command
var updateExternalsCmd = &cobra.Command{
Use: "update-externals",
Short: "Downloads and updates git ex... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: PeerResponse.proto
package protobuf
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a ... |
/*
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 server
import (
"database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"path"
"strings"
"sync"
"time"
cosddb "github.com/composer22/coreos-deploy/db"
)
// Monitor is a go routine that continually monitors artifactory for any version changes.
func (s *Server) Monitor() {
s.wg.Add(1)
defer s.w... |
/*
Copyright 2019 BlackRock, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.