text stringlengths 3.08k 10.4k |
|---|
package web
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strings"
"testing"
)
var (
listenAddr = "127.0.0.1:45678"
indexData = []byte(`<!DOCTYPE html>
<html>
<head>
<title>My Homepage</title>
</head>
<body>
Welcome!
</body>
</html>`)
jsonData = []byte(`{"some":"data"}`)
dataS... |
package hnet
import (
"errors"
"io"
"net"
"sync"
"time"
"github.com/hqpko/hbuffer"
)
var ErrOverMaxReadingSize = errors.New("over max reading size")
const (
defMaxReadingByteSize = 1 << 26 // 64M
defTimeoutDuration = 8 * time.Second
)
type Socket struct {
net.Conn
readLock sync.Mutex
writ... |
package prox
import (
"context"
"encoding/json"
"io"
"net"
"sort"
"strings"
"github.com/pkg/errors"
"go.uber.org/zap"
)
// A Server wraps an Executor to expose its functionality via a unix socket.
type Server struct {
*Executor
socketPath string
listener net.Listener
logger *zap.Logger
}
// socket... |
package upload
import (
"context"
"encoding/csv"
// "encoding/json"
"fmt"
"io"
"log"
"strconv"
"strings"
"time"
"cloud.google.com/go/firestore"
"cloud.google.com/go/functions/metadata"
"cloud.google.com/go/storage"
)
//GCSEvent is the payload of a GCS event.
type GCSEvent struct {
Bucket string... |
// Copyright (c) 2004-present Facebook All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package resolver
import (
"context"
"fmt"
"github.com/facebookincubator/symphony/graph/graphql/models"
"github.com/facebookincubator/symphony/pkg/ent... |
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
package main
import (
"fmt"
"google.golang.org/grpc/credentials/insecure"
"log"
"net"
"os"
"path"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1"
)
// NullDevicePlugin implements the Kubernetes device plugin API
type NullDevicePlugin struc... |
package metadata
import (
"time"
"github.com/romberli/go-util/common"
"github.com/romberli/go-util/constant"
"github.com/romberli/das/internal/dependency/metadata"
)
var _ metadata.MySQLServer = (*MySQLServerInfo)(nil)
// MySQLServerInfo is a struct map to table in the database
type MySQLServerInfo struct {
m... |
// Copyright 2022 Couchbase, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... |
/*******************************************************************************
* Copyright (c) 2018 charles
*
* 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, incl... |
// Copyright © 2017 The Things Network
// Use of this source code is governed by the MIT license that can be found in the LICENSE file.
package util
import (
"fmt"
"io/ioutil"
"os"
"path"
yaml "gopkg.in/yaml.v2"
"github.com/TheThingsNetwork/ttn/core/types"
"github.com/apex/log"
"github.com/spf13/viper"
)
c... |
// Copyright 2017 Baliance. All rights reserved.
//
// Use of this source code is governed by the terms of the Affero GNU General
// Public License version 3.0 as published by the Free Software Foundation and
// appearing in the file LICENSE included in the packaging of this file. A
// commercial license can be purchas... |
package text
import (
"fmt"
"strings"
"sync"
"time"
"github.com/kanatohodets/carbonsearch/index"
"github.com/kanatohodets/carbonsearch/index/text/bloom"
"github.com/kanatohodets/carbonsearch/index/text/document"
"github.com/dgryski/carbonzipper/mlog"
)
var logger mlog.Level
/*
* refactor bloom index into ... |
package main
import (
"regexp"
"strings"
"unicode"
"golang.org/x/text/runes"
"golang.org/x/text/transform"
"golang.org/x/text/unicode/norm"
"golang.org/x/text/unicode/rangetable"
)
const (
CLDR_VERSION = "31.0.1"
RAW_DIR = "./raw-data"
SUPPLEMENTARY_DIR = "./data-supplement... |
package build
import (
"fmt"
"log"
"os"
"path/filepath"
"runtime"
"github.com/wailsapp/wails/v2/internal/fs"
"github.com/wailsapp/wails/v2/internal/shell"
"github.com/wailsapp/wails/v2/internal/project"
"github.com/wailsapp/wails/v2/pkg/clilogger"
)
// Mode is the type used to indicate the build modes
typ... |
/*
Copyright 2017 Loopring Project Ltd (Loopring Foundation).
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable ... |
/*
Copyright 2020 The Qmgo 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, sof... |
package ebpf1
// 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 agre... |
// Copyright (c) 2014 The go-exchange AUTHORS
//
// Use of this source code is governed by The MIT License
// that can be found in the LICENSE file.
// go-exchange is an in-process message (or event) exchange, for now featuring
// the publish-subscribe messaging pattern. The interestng part is, however,
// that callba... |
package main
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
"github.com/spf13/pflag"
"github.com/spf13/viper"
)
type AlertNotification struct {
Version string `json:"version"`
GroupKey string `json:"groupKey"`
TruncatedAler... |
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"log"
"math/rand"
"os"
"os/signal"
"sync"
"syscall"
"time"
"github.com/firepear/petrel"
"github.com/firepear/gnatwren/internal/hwmon"
"github.com/firepear/gnatwren/internal/data"
)
var (
req = []byte("agentupdate ")
nl = []byte("\n")
mux = ... |
// Copyright 2021 Rubrik, 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, publish, dist... |
package main
import (
"context"
"errors"
"fmt"
"image"
"io/ioutil"
"net/http"
"net/url"
"path"
"runtime/debug"
"sync"
"time"
"github.com/artifacthub/hub/internal/api"
"github.com/artifacthub/hub/internal/hub"
"github.com/artifacthub/hub/internal/img"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"... |
package apitest
import (
"archive/zip"
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"testing"
"github.com/romshark/zipapi/api/config"
"github.com/romshark/zipapi/apitest/setup"
"github.com/romshark/zipapi/store"
mockstore "github.com/romshark/zipapi/store/mock"
"github.com/stretchr/testify... |
package image
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
// DefaultImageTag is used when an image tag is needed and the configuration does not specify a tag to use.
DefaultImageTag = "latest"
// ManagedByOpenShiftAnnotation indicates that an image is managed by... |
/*
Copyright © 2020 ConsenSys
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
dis... |
// 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 ingress
import (
"context"
"crypto/md5"
"encoding/hex"
"fmt"
"github.com/konveyor/crane-lib/state_transfer/endpoint"
corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/p... |
package epg
import (
"context"
"encoding/xml"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"time"
)
// Client for the EPG Web API
type Client struct {
httpClient *http.Client
baseURL *url.URL
userAgent string
}
// NewClient creates an EPG Client
func NewClient(options ...func(*Client)) *Client {
c := ... |
package main
import (
"github.com/fclaude/dicemath/generator"
"github.com/gin-gonic/gin"
"log"
"os"
)
func ap(c string) string {
if c == "s" {
return "'"
}
return "'s"
}
const MaxName = 20
func cleanName(name string) string {
if len(name) > MaxName {
log.Printf("Got a name that is too long: %d", len(nam... |
package metrics
import (
"fmt"
"net/http"
"strconv"
"sync"
"time"
"github.com/anycable/anycable-go/server"
"github.com/apex/log"
)
// Printer describes metrics logging interface
type Printer interface {
Print(snapshot map[string]int64)
}
// Metrics stores some useful stats about node
type Metrics struct {
... |
package main
import (
"os/exec"
"bytes"
"fmt"
"strings"
"database/sql"
"os"
"bufio"
"flag"
)
// 配置文件结构体
type Conf struct {
InputFile string // 需要分析的日志文件路径
StartDate string // 开始日期
EndDate string // 结束日期
Overtime string // 超时时间
TopIP string
TopRequest string
LogFormat string ... |
package models
import (
"ForestBlog/config"
"ForestBlog/utils"
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"sort"
"strings"
"time"
)
type Time time.Time
type Article struct {
Title string `json:"title"`
Date Time `json:"date"`
Description string `json:"description"`
Ta... |
package wasm
import (
"context"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/httptest"
"os"
"os/exec"
"regexp"
"strings"
"testing"
"time"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/runtime"
"github.com/chromedp/chromedp"
)
func run(cmdline string) error {
args := strings... |
// Copyright 2021 Google LLC. 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 graphql
import (
"context"
"encoding/json"
_errors "errors"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"reflect"
"testing"
"time"
)
// func TestDo(t *testing.T) {
// }
type Response struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"des... |
package cmd
import (
"io/ioutil"
"path/filepath"
"github.com/pkg/errors"
"github.com/wercker/wercker/core"
"github.com/wercker/wercker/docker"
"github.com/wercker/wercker/util"
"golang.org/x/net/context"
"gopkg.in/mgo.v2/bson"
)
// cmdWorkflow is the main driver for running a workflow.
func cmdWorkflow(ctx c... |
package gobootconfig
import (
"fmt"
"io"
"log"
"net/http"
"os"
"path/filepath"
"strings"
)
const propertiesSource = "properties"
const yamlSource = "yaml"
const profilePropertiesSource = "profileProperties"
const profileYamlSource = "profileYaml"
const goConfigLocation = "go.config.location"
const goConfigNam... |
package octopusdeploy
import (
"encoding/json"
"net/url"
"testing"
"time"
"github.com/kinbiko/jsonassert"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func CreateTestKubernetesEndpoint(t *testing.T) *KubernetesEndpoint {
authentication := &EndpointAuthentication{}
clusterCert... |
package config
import (
"github.com/gofuncchan/ginger/common"
"gopkg.in/yaml.v2"
"io/ioutil"
)
// 基础配置
type Base struct {
Env string `yaml:"env"`
ListenPort int64 `yaml:"listen"`
}
// 日志配置
type Log struct {
LogDir string `yaml:"logDir"`
LogMaxDayCount int `yaml:"maxD... |
package main
import "log"
import "flag"
import "net"
import "io"
import "bufio"
import "time"
import "github.com/miolini/godaemon"
import "compress/gzip"
import "runtime"
import nsq "github.com/bitly/go-nsq"
import "strings"
import "code.google.com/p/snappy-go/snappy"
import "sync"
const (
RECV_BUF_LEN = 2048
)
var... |
package issues
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"go.skia.org/infra/go/common"
"go.skia.org/infra/go/sklog"
"go.skia.org/infra/go/util"
)
const (
MONORAIL_BASE_URL_TMPL = "https://monorail-prod.appspot.com/_ah/api/monorail/v1/projects/%s/issues"
PROJECT_ANGLE = "a... |
package wasmer
import (
"fmt"
"reflect"
"unsafe"
)
// ImportedFunctionError represents any kind of errors related to a
// WebAssembly imported function. It is returned by `Import` or `Imports`
// functions only.
type ImportedFunctionError struct {
functionName string
message string
}
// NewImportedFunction... |
// Copyright 2015 The Vanadium 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 vlog
import (
"v.io/x/lib/llog"
)
// Info logs to the INFO log.
// Arguments are handled in the manner of fmt.Print; a newline is appended if m... |
/*
Copyright © 2021 <NAME>
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
distribut... |
package gen
import (
"bytes"
"github.com/jchavannes/jgo/jerr"
"github.com/memocash/index/ref/bitcoin/memo"
"github.com/memocash/index/ref/bitcoin/tx/parse"
"github.com/memocash/index/ref/bitcoin/tx/script"
)
func (c *Create) getMoreUTXOs() ([]memo.UTXO, error) {
var moreUTXOs []memo.UTXO
if !c.isEnoughSlpValue... |
package ebpf
import (
"github.com/cilium/ebpf/asm"
"github.com/cilium/ebpf/internal/btf"
"github.com/pkg/errors"
)
// CollectionOptions control loading a collection into the kernel.
type CollectionOptions struct {
Programs ProgramOptions
ExistingMaps map[string]*Map
}
// CollectionSpec describes a collection.
t... |
package main
import (
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"log"
"net/http"
"os"
"os/exec"
"os/signal"
"strconv"
"syscall"
)
type Counter struct {
cmd *exec.Cmd
}
func NewCounter() *Counter {
c := &Counter{}
c.Initialize()
return c
}
func (... |
package virtual_network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/cl... |
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"os/signal"
"strings"
"syscall"
"github.com/mailgun/holster/v3/setter"
"github.com/mailgun/kafka-pixy/config"
"github.com/mailgun/kafka-pixy/logging"
"github.com/mailgun/kafka-pixy/service"
log "github.com/sirupsen/logrus"
)
var (
cmdGRPCAddr ... |
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
)
const (
defaultServerImage = "chubaofs/cfs-server:0.0.1"
defaultDataDirHostPath = "/var/lib/chubao"
defaultLogDirHostPath = "/var/log/chubao"
// Master
masterDefaultReplicas = 4
masterDefaultLogLevel = "error"
masterDefaultRet... |
// Copyright 2019-present Audioid contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at https://github.com/audioid/audioid/tree/master/LICENSE
package flac
import (
"encoding/bi... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
smithy "github.com/awslabs/smithy-go"
... |
// Copyright (c) 2020, <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 geom
import (
"fmt"
"math"
math2 "github.com/roeldev/go-sdl2-experiments/pkg/sdlkit/math"
)
// var (
// vectorUp = Vector{0, -1}
// vectorDown ... |
package models
import (
"errors"
"fmt"
"goload/server/models/configuration"
"io/ioutil"
"log"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"time"
)
type ShareOnline struct {
config *configuration.Configuration
apiUrl string
urlPattern string
loginUrl string
loginCookies []*http.... |
/*
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, ... |
// Code generated by entc, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"entgo.io/contrib/entproto/internal/todo/ent/pony"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PonyCreate is the builder for creating a Pony entity.
type PonyCreate struct {
config
mutation *PonyMu... |
package conversion
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"github.com/sirupsen/logrus"
apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/p... |
package git
import (
"bufio"
"bytes"
"github.com/gookit/color"
"github.com/klyall/kl-cli/pkg/output"
"io"
"os"
"os/exec"
"regexp"
"strconv"
"strings"
)
type StatusMessage struct {
Color color.Color
Message string
}
var CommittedChanges = StatusMessage{output.WarnColor, "Changes to push"}
var NoChanges ... |
package hime
import (
"context"
"crypto/tls"
"html/template"
"net"
"net/http"
"os"
"os/signal"
"sync"
"syscall"
"time"
reuseport "github.com/kavu/go_reuseport"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
)
// App is the hime app
type App struct {
srv http.Server
handler http.... |
//nolint:unparam // golangci-linter
package bn256
import (
"math/big"
)
var half = new(big.Int).Rsh(Order, 1)
var curveLattice = &lattice{
vectors: [][]*big.Int{
{bigFromBase10("147946756881789319000765030803803410728"), bigFromBase10("147946756881789319010696353538189108491")},
{bigFromBa... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package cloudformation
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
// The input for DescribeStackEvents action.
type DescribeStackEventsInput struct {
_ struct{} `type:"structure"`
... |
// Copyright 2018-2020 <NAME>
//
// 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 redis
import (
"sync"
"time"
"github.com/BluePecker/JwtAuth/pkg/storage"
"github.com/go-redis/redis"
"crypto/md5"
"encoding/hex"
"github.com/BluePecker/JwtAuth/pkg/storage/redis/uri"
"reflect"
"github.com/Sirupsen/logrus"
"github.com/kataras/iris/core/errors"
)
type (
Redis struct {
create time.T... |
package pubnub
import (
"bytes"
"fmt"
"log"
"mime/multipart"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/pubnub/go/v6/pnerr"
"github.com/pubnub/go/v6/utils"
)
type endpointOpts interface {
jobQueue() chan *JobQItem
config() Config
client() *http.Client
context() Context
validate() err... |
// Gophers are fuzzy.
package gophertags
import (
"crypto/rand"
"math/big"
"math/bits"
r255 "github.com/gtank/ristretto255"
"golang.org/x/crypto/sha3"
)
// SecretKey is the secret key held by the ultimate recipient of the messages.
// It is used to derive public keys and detection keys for distribution.
// Inte... |
// Receives commands from Alexa voice assistant ("Alexa, turn off <device name>") via AWS
// SQS (so the Lambda fn doesn't need direct connection to Hautomo). The commands are
// one-way, so Alexa won't know if the command succeeded.
package alexaadapter
import (
"context"
"encoding/json"
"errors"
"fmt"
"time"
... |
package dao
import (
"context"
"crypto/md5"
"encoding/hex"
"io"
"net/http"
"regexp"
"strconv"
"strings"
"time"
"fishing/internal/model"
"github.com/go-kratos/kratos/pkg/cache/memcache"
"github.com/go-kratos/kratos/pkg/cache/redis"
"github.com/go-kratos/kratos/pkg/conf/paladin"
"github.com/go-kratos/kra... |
package main
import (
"bytes"
"encoding/binary"
"encoding/xml"
"io"
"io/ioutil"
)
// Header represents the header of our BRLYT
type Header struct {
Magic [4]byte
BOM uint32
FileSize uint32
HeaderLen uint16
SectionCount uint16
}
// SectionTypes are known parts of a BRLYT.
type Section... |
// Copyright 2020 The jackal 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... |
// Copyright 2019 <NAME>. 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... |
// Copyright 2021 Dolthub, 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 loader
import (
"fmt"
"github.com/rs/zerolog/log"
"go/types"
"golang.org/x/tools/go/packages"
"path/filepath"
"regexp"
"strings"
)
// LoadMode determines how a path should be loaded
type LoadMode int
const (
// PackageLoadMode indicates that the path is an import path and should be loaded with that c... |
package MqttClient
import (
"fmt"
"math/rand"
"os"
"sync"
"github.com/gogf/gf/frame/g"
mqtt "github.com/eclipse/paho.mqtt.golang"
"crypto/tls"
"log"
"strings"
"time"
)
type MqttClient struct {
c mqtt.Client
ClientOnce sync.Once
gGetHostNameOnce sync.Once
gHostName string
}... |
//<developer>
// <name><NAME></name>
// <email><EMAIL></email>
// <wx>superexc</wx>
// <qqgroup>128148617</qqgroup>
// <url>https://jsq.ink</url>
// <role>pku engineer</role>
// <date>2019-03-16 19:40:08</date>
//</624456005194878976>
/*
版权所有IBM公司。保留所有权利。
SPDX许可证标识符:Apache-2.0
**/
package cont... |
package main
/*
index enables quick look ups of words that are adjacent to a given word. Where adjacent means that two words
diff by a single letter.
For examples:
1. "cat" and "bat" are adjacent
2. "cat" and "cats" are adjacent
3. "cat" and "bot" are not adjacent
4. "cat" and "cots" are not adjacent
*/
import (
... |
/*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
* This source code is licensed under the Apache License Version 2.0.
*/
package log
import (
"context"
"encoding/json"
"fmt"
"github.com/olivere/elastic/v7"
"github.com/pkg/errors"
"net"
"os"
"runtime"
"time"
)
type esLog str... |
package repository
import (
"testing"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/quarantine"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab... |
// Copyright 2016 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 ssa
import "fmt"
// A SparseTreeMap encodes a subset of nodes within a tree
// used for sparse-ancestor queries.
//
// Combined with a SparseTreeHelpe... |
// Copyright 2021-2022, the SS project owners. All rights reserved.
// Please see the OWNERS and LICENSE files for details.
package lambda
import (
"encoding/json"
"errors"
"sync"
"sync/atomic"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/s... |
// Copyright (c) 2017 Arista Networks, Inc.
// Use of this source code is governed by the Apache License 2.0
// that can be found in the COPYING file.
// cmdproc provides following facilities to a command line application
// a) Template driven usage text
// b) Template driven command help text
// c) Register comman... |
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package e2e
import (
"path"
"strconv"
"testing"
"time"
"github.com/hyperledger/fabric-sdk-go/api/apiconfig"
"github.com/hyperledger/fabric-sdk-go/test/integration"
"github.com/hyperledger/fabric-sdk-go/test/... |
package term
import (
"context"
"fmt"
"github.com/brigadecore/brigade/sdk/v2/core"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
const jobPageName = "job"
// jobPage is a custom UI component that displays Job info and a list of
// associated logs.
type jobPage struct {
*page
jobInfo *tview.... |
package main
import (
"flag"
"fmt"
"os"
"strings"
"sync/atomic"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/cenkalti/backoff"
)
const (
ExitCodeOK int = 0
ExitCodeErro... |
package crawl
import (
"fmt"
"io/ioutil"
"os"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
type configTest struct {
validConfigFile string
backupConfigFile string
invalidConfigFile string
nonExistFile string
}
func getConfigTest() *configTest {
conf := &configTest{
validConfigFile... |
package analysis
import (
"fmt"
"sort"
"strings"
"github.com/gonum/graph"
"github.com/gonum/graph/topo"
osgraph "github.com/openshift/origin/pkg/api/graph"
buildapi "github.com/openshift/origin/pkg/build/api"
buildedges "github.com/openshift/origin/pkg/build/graph"
buildgraph "github.com/openshift/origin/pk... |
package main
import (
"github.com/codegangsta/cli"
"github.com/dmp42/scape-go/docker"
"github.com/dmp42/scape-go/scape"
"os"
// "log"
"fmt"
"github.com/docker/engine-api/types"
)
func init() {
}
func main() {
var debug bool
var force bool
app := cli.NewApp()
app.Name = "Scape Go"
app.Usage = "Use it, ... |
package journal
import (
"net/http"
"time"
"github.com/shestakovda/errx"
"github.com/shestakovda/fdbx"
"github.com/shestakovda/journal/crash"
"github.com/shestakovda/typex"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
type FdbSuite struct {
suite.Suite
entry *Entry
}
func (s... |
package runtime
import (
"context"
"sync"
"time"
"github.com/empiricaly/recruitment/internal/ent"
"github.com/empiricaly/recruitment/internal/ent/hook"
runModel "github.com/empiricaly/recruitment/internal/ent/run"
"github.com/empiricaly/recruitment/internal/mturk"
"github.com/empiricaly/recruitment/internal/s... |
// webserver for ournotes
package main
import (
"database/sql"
"flag"
"fmt"
"log"
"net/http"
"os"
"time"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
_ "github.com/go-sql-driver/mysql"
"github.com/muesli/termenv"
)
const signDB string = "root:password@tcp(localhost:3306)/yourdb" // e... |
package main
import (
"encoding/binary"
"fmt"
"io/ioutil"
"math/rand"
"os"
"strings"
"time"
"github.com/golang/protobuf/proto"
"github.com/google/uuid"
"github.com/riferrei/srclient"
"gopkg.in/confluentinc/confluent-kafka-go.v1/kafka"
)
const producerMode string = "producer"
const consumerMode string = "c... |
package auth
import (
"strconv"
"testing"
"time"
"github.com/dgrijalva/jwt-go"
"github.com/gghcode/go-gin-starterkit/api/common"
"github.com/gghcode/go-gin-starterkit/api/user"
"github.com/gghcode/go-gin-starterkit/config"
"github.com/go-redis/redis"
"github.com/stretchr/testify/mock"
"github.com/stretchr/t... |
package forum
import (
"cloud.google.com/go/firestore"
"context"
"fmt"
"time"
)
type Context = context.Context
const (
MaxDepth = 100
Root = "Posts"
)
type PostID = string
type User struct {
ID string
Name string
PhotoURL string
Joined time.Time
}
type DeleteInfo struct {
When time.Time... |
package store
import (
"bytes"
"net/http"
"time"
"github.com/lbryio/reflector.go/internal/metrics"
"github.com/lbryio/reflector.go/shared"
"github.com/lbryio/lbry.go/v2/extras/errors"
"github.com/lbryio/lbry.go/v2/stream"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/a... |
package events
import (
"encoding/json"
"fmt"
"os"
"time"
"github.com/pkg/errors"
)
// Event describes the attributes of a libpod event
type Event struct {
// ContainerExitCode is for storing the exit code of a container which can
// be used for "internal" event notification
ContainerExitCode int
// ID can ... |
package fsext
import (
"fmt"
"os"
"path"
"strings"
"testing"
"time"
"github.com/spf13/afero"
"github.com/stretchr/testify/require"
)
func TestChangePathFs(t *testing.T) {
var m = afero.NewMemMapFs()
var prefix = "/another/"
var c = NewChangePathFs(m, ChangePathFunc(func(name string) (string, error) {
if... |
package main
import (
"fmt"
"log"
"os"
"strconv"
"strings"
"time"
"github.com/xyproto/env"
"github.com/xyproto/kal"
"github.com/xyproto/textoutput"
"github.com/xyproto/vt100"
)
// centerPad will pad a string with spaces up to the given width,
// so that the string is centered.
func centerPad(s string, widt... |
package limio
import (
"errors"
"io"
"time"
"github.com/golang/glog"
)
//A Manager enables consumers to treat a group of Limiters as a single Limiter,
//enabling hierarchies of limiters. For example, a network interface could have
//a global limit that is distributed across connections, each of which can
//manag... |
package tokens
import (
"fmt"
"net/http"
"strconv"
"testing"
"time"
"github.com/rancher/norman/types"
"github.com/rancher/rancher/pkg/features"
v3 "github.com/rancher/rancher/pkg/generated/norman/management.cattle.io/v3"
"github.com/rancher/wrangler/pkg/randomtoken"
"github.com/stretchr/testify/assert"
v1 ... |
// 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 tls
import (
"crypto/hmac"
"crypto/md5"
"crypto/sha1"
"hash"
"os"
)
// Split a premaster secret in two as specified in RFC 4346, section 5.
func ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.