text stringlengths 3.08k 10.4k |
|---|
package cmd
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
"golang.org/x/oauth2"
"github.com/bored-engineer/rms/aadrm"
"github.com/spf13/cobra"
"github.com/pkg/errors"
)
// licenseCmd represents the license command
var licenseUserAgent string
var licensePlatformID ... |
// +build !cgo
package chacha
// core applies the ChaCha20 core function to 16-uint32 input matrix in, and puts
// the result into 64-byte array out.
//
// TODO: Use regs rather than an array
func core(in *[16]uint32, out *[64]byte, rounds int) {
var x [16]uint32
copy(x[:], in[:])
// Applies 8 quarterrounds round... |
package reports
import (
"encoding/csv"
"fmt"
"github.com/nsip/dev-nrt/helper"
"github.com/nsip/dev-nrt/records"
"github.com/tidwall/gjson"
"github.com/tidwall/sjson"
)
type ItemExpectedResponses struct {
baseReport // embed common setup capability
cfh helper.CodeframeHelper
}
//
// Highlights any di... |
package sparse
import (
"crypto/sha1"
"os"
"fmt"
"sync"
fio "github.com/rancher/sparse-tools/directfio"
"github.com/rancher/sparse-tools/log"
)
// File I/O methods for direct or bufferend I/O
var fileOpen func(name string, flag int, perm os.FileMode) (*os.File, error)
var fileReadAt func(file *os.File, data ... |
package vm
import (
"fmt"
"io"
)
// VM contains properties of CPU
type VM struct {
stack *IntStack
instructionPointer int
program []int
globals map[int]int
constantPool map[int]interface{}
frameStack *FrameStack
flags map[string]interface{}
}
// ... |
package v2
import (
"encoding/json"
"github.com/imulab/go-scim/pkg/v2/prop"
"github.com/imulab/go-scim/pkg/v2/spec"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"io/ioutil"
"os"
"testing"
)
func TestDeserialize(t *testing.T) {
s := new(MongoD... |
package utils
import (
"context"
"fmt"
"os"
"reflect"
"time"
dynatracev1alpha1 "github.com/Dynatrace/dynatrace-operator/api/v1alpha1"
"github.com/go-logr/logr"
"github.com/pkg/errors"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apim... |
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface"
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
)
const (
healthy = "Healthy"
)
// adjust runs a single adjustment in the loop to update an ASG in a rolling fashion to l... |
package ipfsman
import (
context "context"
crand "crypto/rand"
"encoding/base64"
"encoding/json"
"fmt"
"path"
"strings"
"sync"
mobileipfs "github.com/ipfs-shipyard/gomobile-ipfs/go/bind/core"
ipfs_config "github.com/ipfs/go-ipfs-config"
"github.com/pkg/errors"
"go.uber.org/multierr"
"go.uber.org/zap"
)
... |
package main
import (
"context"
"flag"
"fmt"
"net"
"os/exec"
"strconv"
"strings"
"sync"
"time"
//"./known"
"golang.org/x/sync/semaphore"
)
const (
colorRed = "\033[31m"
colorGreen = "\033[32m"
colorCyan = "\033[36m"
)
type PortScanner struct {
ip string
lock *semaphore.Weighted
}
func (ps *Por... |
package gin
import (
"cafapp-returns/config"
"cafapp-returns/socket"
"net/http"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
)
var count = 0
func corsMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
c.Writ... |
package main
import (
"fmt"
"strings"
)
type TemplateCommon struct {
BasePackage string
BasePackageImport string
BasePackageName string
BasePackageNameCap string
EndpointPackage string
EndpointPackageName string
EndpointPrefix string
InterfaceName string
InterfaceNameLcase st... |
// The maze solving experiments based on NEAT methodology with Novelty Search and Fitness based optimization
package maze
import (
"fmt"
"github.com/yaricom/goNEAT/neat"
"github.com/yaricom/goNEAT/neat/genetics"
"github.com/yaricom/goNEAT/neat/network"
"github.com/yaricom/goNEAT_NS/neatns"
"math"
)
// The simul... |
// Copyright (c) 2020 Chair of Applied Cryptography, Technische Universität
// Darmstadt, Germany. All rights reserved. This file is part of
// perun-eth-mobile. Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package prnm
import (
"github.com/pkg/errors"
eth... |
package torrent
import (
"io"
"net/http"
"os"
"strings"
"time"
"github.com/cenkalti/rain/torrent"
"github.com/fatih/color"
)
type Stat struct {
Status string
Downloaded int64
Peers int
Total int64
}
var Version string = "420"
var conf = torrent.Config{
Database: ... |
package uaa
import (
"crypto/rsa"
"encoding/json"
"fmt"
"net/http"
"strings"
jwt "github.com/dgrijalva/jwt-go"
"github.com/inconshreveable/log15"
"io/ioutil"
)
// Auth is the main inteface exposed by the auth module providing encapsulation
type Auth interface {
LoadUaaKeys(uaaURL string) error
Protected(Re... |
package event
import (
"context"
"time"
"github.com/hashicorp/terraform/helper/schema"
calendar "google.golang.org/api/calendar/v3"
)
var (
eventSchema = map[string]*schema.Schema{
"start": &schema.Schema{Type: schema.TypeString, Required: true, ValidateFunc: datetime()},
"end": &schema.Schema{Type: schem... |
package news_service
import (
"bytes"
"fmt"
"go-eth/models"
"golang.org/x/text/encoding/simplifiedchinese"
"golang.org/x/text/transform"
"io/ioutil"
"log"
"reflect"
"strconv"
"sync"
"time"
)
/**
部分热榜标题需要转码
*/
func GbkToUtf8(s []byte) ([]byte, error) {
reader := transform.NewReader(bytes.NewReader(s), simp... |
/*
Copyright 2022 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 writing, softw... |
// Package gff reads and writes gff3 files.
// This package supports the format described in:
// http://www.sequenceontology.org/gff3.shtml
// As per the spec, gff files contain zero or more features
// of nine tab-separated fields, with the ninth column comprised of
// one or more semicolon separated fields.
//
// Fea... |
/*
Copyright 2021 The Cockroach Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, s... |
// Copyright 2018 The Fuchsia 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 symbolize
import (
"bufio"
"context"
"fmt"
"io"
"strconv"
"strings"
)
// TODO: Implement a reflection based means of automatically doing th... |
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package lifecycle_test
import (
"strings"
"testing"
"github.com/jxu86/fabric-chaincode-go/shim"
"github.com/jxu86/fabric-gm/common/channelconfig"
commonledger "github.com/jxu86/fabric-gm/common/ledger"
"github.com/jxu86/fabric-... |
package jira
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net"
"net/http"
"net/http/httputil"
"strings"
"time"
)
const (
// RFC3339 is jira datetime format.
RFC3339 = "2006-01-02T15:04:05-0700"
baseURLv3 = "/rest/api/3"
baseURLv2 = "/rest/api/2"
baseURLv1 = "/rest/agile/1.0"
)
var (
// ErrNoResu... |
package rekwest
import (
"bytes"
"context"
"encoding/json"
"encoding/xml"
"fmt"
"io"
"io/ioutil"
"net/http"
"reflect"
"time"
)
type request struct {
client *http.Client
multiErr MultiError
url string
method string
body io.Reader
header http.Header
basicAuth ... |
package mempool
import (
"bytes"
"fmt"
"reflect"
"time"
abci "github.com/tendermint/abci/types"
wire "github.com/tendermint/go-wire"
"github.com/tendermint/tmlibs/clist"
"github.com/tendermint/tmlibs/log"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/p2p"
"github.com/tend... |
// Copyright 2019 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... |
// Copyright 2020 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 blob
import (
"context"
"encoding/json"
"io"
"sync"
"time"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
"github.com/kopia/kopia/internal/gather"
)
// ErrSetTimeUnsupported is returned by implementations of Storage that don't support SetTime.
var ErrSetTimeUnsupported = errors.Errorf("SetTime... |
package main
import (
"fmt"
"strings"
"sync"
"github.com/budavariam/advent_of_code/2018/utils"
)
func main() {
input := utils.LoadInput("18_1")
result := SimulateLumberChange(input)
fmt.Println(result)
}
// SimulateLumberChange ticks one minute in tis changing world
func SimulateLumberChange(input []string) ... |
package miscmanager
import (
"fmt"
"time"
"github.com/colinzuo/tunip/pkg/logp"
"github.com/colinzuo/tunip/pkg/utils"
)
// WorkerRequest request wrapper
type WorkerRequest struct {
Type string
GUID string
Body interface{}
RspChan chan interface{}
DoneChan chan bool
}
// WorkerContext def
type W... |
/*
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 ... |
// Copyright (c) 2019 Perlin
//
// 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, distri... |
// +build !noresumabledigest
package storage
import (
"fmt"
"io"
"os"
"path"
"strconv"
"github.com/Sirupsen/logrus"
"github.com/docker/distribution/context"
storagedriver "github.com/docker/distribution/registry/storage/driver"
"github.com/stevvooe/resumable"
// register resumable hashes with import
_ "g... |
package notification
import (
"fmt"
"github.com/go-gorp/gorp"
"github.com/ovh/cds/engine/api/permission"
"github.com/ovh/cds/engine/api/user"
"github.com/ovh/cds/sdk"
"github.com/ovh/cds/sdk/interpolate"
"github.com/ovh/cds/sdk/log"
"github.com/ovh/cds/sdk/luascript"
)
var (
uiURL string
)
// Init initial... |
// Copyright 2019 Google Inc. All Rights Reserved.
// This file is available under the Apache license.
package mtail
import (
"context"
"expvar"
"fmt"
"os"
"runtime"
"testing"
"time"
"github.com/golang/glog"
"github.com/google/mtail/internal/metrics"
"github.com/google/mtail/internal/metrics/datum"
"githu... |
package msg
import (
"bytes"
"fmt"
"github.com/Robbin-Liu/go-binance-sdk/common/types"
"github.com/tendermint/tendermint/crypto"
)
// Description - description fields for a validator
type Description struct {
Moniker string `json:"moniker"` // name
Identity string `json:"identity"` // optional identity signa... |
package main
import (
"fmt"
"image"
"log"
"math/rand"
"sync"
"time"
)
func main() {
gridSize := image.Point{X: 20, Y: 10}
grid := NewMarsGrid(gridSize)
rover := make([]*RoverDriver, 5)
for i := range rover {
rover[i] = startDriver(fmt.Sprint("rover", i), grid)
}
time.Sleep(10 * time.Second)
}
func star... |
package api
import (
"context"
"database/sql"
"fmt"
"strings"
"github.com/go-sql-driver/mysql"
)
//Model represents a device model
type Model struct {
ID int64 `json:"id"`
Manufacturer string `json:"manufacturer"`
Model string `json:"model"`
}
//Validate cleans and validates the given Mode... |
// Copyright 2020 The goftp 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 minio
import (
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"
"testing"
"time"
"github.com/jlaffaye/ftp"
"github.com/marco/goftp-tlsconfig/cor... |
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package schema
import (
"context"
"os"
"path/filepath"
"testing"
"time"
"ariga.io/atlas/sql/migrate"
"ariga.io/atlas... |
// Code generated by gotdgen, DO NOT EDIT.
package mt
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = ... |
package kotsstore
import (
"bytes"
"database/sql"
"io/ioutil"
"path/filepath"
"time"
"github.com/pkg/errors"
kotsv1beta1 "github.com/replicatedhq/kots/kotskinds/apis/kots/v1beta1"
"github.com/replicatedhq/kots/kotskinds/client/kotsclientset/scheme"
gitopstypes "github.com/replicatedhq/kots/pkg/gitops/types"
... |
/*
Copyright 2015 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... |
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package endorser
import (
"fmt"
pb "github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric/common/channelconfig"
"github.com/hyperledger/fabric/core/aclmgmt"
"github.com/hyperledger/fabric/core/aclmgmt/reso... |
package cmd
import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace/pkg/style"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "julia",
Short: "high-level, high-performance dynamic programming language for technical computing",
Long: "https://julialang.org/",
Run: func(cmd *cobra... |
// Copyright 2018 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
package smallstack
import (
"encoding/json"
"fmt"
"net"
"net/http"
"time"
"github.com/Cloud-Foundations/Dominator/hypervisor/client"
"github.com/Cloud-Foundations/Dominator/lib/constants"
"github.com/Cloud-Foundations/Dominator/lib/log"
"github.com/Cloud-Foundations/Dominator/lib/slavedriver"
"github.com/Cl... |
package keeper
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov/types"
)
// SubmitProposal create new proposal given a content
func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (types.Proposal, sdk.Error) {... |
package al
import (
"math/rand"
"testing"
"time"
. "github.com/lens-vm/gogl"
. "github.com/sdboyer/gocheck"
)
// TODO reimplement with specs
//func SetUpBenchmarksFromBuilder(b GraphBuilder) bool {
//Suite(&GraphBenchSuite{b: b})
//return true
//}
//var _ = SetUpBenchmarksFromBuilder(BMBD)
type GraphBenchSui... |
// Copyright (c) 2020, Cloudflare. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the ... |
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
"time"
"github.com/bitrise-io/go-steputils/stepconf"
"github.com/bitrise-io/go-utils/colorstring"
)
var buildSucceeded = os.Getenv("BITRISE_BUILD_STATUS") == "0"
func getValueForBuildStatus(ifSuccess, ifFailed... |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
package rotatecerts
import (
"fmt"
"math/rand"
"time"
"github.com/Azure/aks-engine/cmd/rotatecerts/internal"
"github.com/Azure/aks-engine/pkg/api/common"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
v1... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package personalize
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type ListSolutionVersionsInput struct {
_ struct{} `type:"structure"`
// The maximum number of solution versions to r... |
// Package ec provides erasure coding (EC) based data protection for AIStore.
/*
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
*/
package ec
import (
"fmt"
"os"
"sync"
"github.com/NVIDIA/aistore/3rdparty/glog"
"github.com/NVIDIA/aistore/cluster"
"github.com/NVIDIA/aistore/cmn"
"github.c... |
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package idemix
import (
"github.com/milagro-crypto/amcl/version3/go/amcl"
"github.com/milagro-crypto/amcl/version3/go/amcl/FP256BN"
"github.com/pkg/errors"
)
// Identity Mixer Credential is a list of attributes certified (signed) ... |
// Copyright 2018 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... |
// Copyright (c) 2020 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, The Serviced Authors. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
//
// endpointregistry is used for storing a list of application endpoints
// under an endpoint key.
//
// The zookeeper structures is:
// /endpoin... |
package secrets
import (
"fmt"
"strings"
"time"
"k8s.io/apimachinery/pkg/types"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/sets"
"github.com/openshift/ci-tools/pkg/api/vault"
"github.com/openshift/ci-tools/pkg/vaultclient"
)
type VaultClient interface {
GetKV(path string... |
package trace
import (
"context"
"net"
"regexp"
"go.opentelemetry.io/otel/api/correlation"
"go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/propagation"
"go.opentelemetry.io/otel/api/trace"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/label"
"go.opentelemetry.io/otel/semconv... |
package hbase
//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 2021 Matrix Origin
//
// 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 view
import (
"fmt"
"github.com/sirupsen/logrus"
"github.com/wagoodman/dive/dive/filetree"
"github.com/wagoodman/dive/dive/image"
"github.com/wagoodman/dive/runtime/ui/format"
"github.com/wagoodman/dive/runtime/ui/key"
"strconv"
"strings"
"github.com/dustin/go-humanize"
"github.com/jroimartin/gocui"... |
//go:build windows
package ui
import (
"github.com/rodrigocfd/windigo/ui/wm"
"github.com/rodrigocfd/windigo/win"
"github.com/rodrigocfd/windigo/win/co"
)
// Implements WindowModal interface.
type _WindowRawModal struct {
_WindowRaw
opts *_WindowModalO
hPrevFocusParent win.HWND // chil... |
package muti_service
import (
"fmt"
"io"
"net"
"sync"
"time"
"github.com/ProtossGenius/SureMoonNet/basis/smn_err"
"github.com/ProtossGenius/SureMoonNet/basis/smn_net"
"github.com/ProtossGenius/SureMoonNet/basis/smn_stream"
"github.com/ProtossGenius/SureMoonNet/pb/smn_base"
"google.golang.org/protobuf/proto"... |
// Copyright © 2019 <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 wri... |
// Copyright (C) 2013-2018 by <NAME> <<EMAIL>>
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merg... |
// Package rcs contains the common components used to create retro-computing
// systems.
package rcs
import (
"encoding/gob"
"fmt"
"io"
"math/bits"
"strconv"
"github.com/veandco/go-sdl2/sdl"
)
func X(v int) string {
return fmt.Sprintf("$%x", v)
}
func X8(v uint8) string {
return fmt.Sprintf("$%02x", v)
}
f... |
package client
/*
The client package provides a general purpose interface (Client) for connecting
to a tendermint node, as well as higher-level functionality.
The main implementation for production code is client.HTTP, which
connects via http to the jsonrpc interface of the tendermint node.
For connecting to a node ... |
package ganzhi
import (
"time"
"github.com/Lofanmi/chinese-calendar-golang/animal"
"github.com/Lofanmi/chinese-calendar-golang/gan"
"github.com/Lofanmi/chinese-calendar-golang/solarterm"
"github.com/Lofanmi/chinese-calendar-golang/utils"
"github.com/Lofanmi/chinese-calendar-golang/zhi"
)
// Ganzhi 干支历
type Gan... |
package generic
import (
"fmt"
"reflect"
)
func verifyFuncSignature(fn reflect.Value, types ...reflect.Type) bool {
// 检查是function
if fn.Kind() != reflect.Func {
return false
}
// 检查入参和出参数量
if fn.Type().NumIn() != len(types) - 1 || fn.Type().NumOut() != 1 {
return false
}
// 检查参数和方法参数类型是否能对上
for i :=... |
package asyncloader
import (
"context"
"errors"
"io/ioutil"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-graphsync"
"github.com/ipfs/go-graphsync/ipldbridge"
"github.com/ipfs/go-graphsync/metadata"
"github.com/ipfs/go-graphsync/requestmanager/asyncloader/loadattemptqueue"
"github.com/ipfs/go... |
// Code generated by gotdgen, DO NOT EDIT.
package tdapi
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_... |
// 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 testing
import (
"flag"
"fmt"
"os"
"runtime"
"time"
)
var matchBenchmarks = flag.String("test.bench", "", "regular expression to select benchmark... |
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package edv
import (
"encoding/json"
"errors"
"fmt"
"github.com/btcsuite/btcutil/base58"
"github.com/hyperledger/aries-framework-go/pkg/doc/jose"
"github.com/hyperledger/aries-framework-go/pkg/storage/edv/mod... |
/*
Copyright 2019 The Skaffold 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... |
/*
Copyright 2018 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 (
"context"
"encoding/json"
"fmt"
"net/http"
"os"
"time"
sentryecho "github.com/getsentry/sentry-go/echo"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
servertiming "github.com/mitchellh/go-server-timing"
mw2 "github.com/neko-neko/echo-logrus/v2"
log2 "githu... |
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
vekeeper "github.com/merlion-zone/merlion/x/ve/keeper"
vetypes "github.com/merlion-zone/merlion/x/ve/types"
"github.com/merlion-zone/merlion/x/voter/types"
)
func (k Keeper) CreateGauge(ctx sdk.Context, depoistDenom string) {
if !k.gaugeKeeper.HasG... |
package gateway
import (
"net/http"
"time"
"github.com/funkygao/gafka/cmd/kateway/manager"
"github.com/funkygao/gafka/cmd/kateway/store"
"github.com/funkygao/httprouter"
log "github.com/funkygao/log4go"
"github.com/gorilla/websocket"
)
//go:generate goannotation $GOFILE
// @rest GET /v1/ws/msgs/:appid/:topic/... |
package store
import (
jwt "github.com/dgrijalva/jwt-go"
)
type User struct {
ID int64 `json:"id"`
Email string `json:"email"`
Username string `json:"username"`
Password string `json:"-"`
}
type Profile struct {
ID int64 `json:"-"`
UserID int64 `json:"userId"`
LastName string `json:... |
// Copyright 2021 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 peer
import (
"bittorrent-go/job"
"bittorrent-go/message"
"bittorrent-go/util"
"bytes"
"context"
"crypto/sha1"
"errors"
"github.com/sirupsen/logrus"
"net"
"time"
)
const protocolIdentifier = "BitTorrent protocol"
type Peer struct {
Connection net.Conn
PeerID util.PeerID
Address string
}
... |
/**
* @license
* Copyright 2020 Dynatrace 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 ag... |
package schedule
import (
"fmt"
"strings"
"time"
"github.com/mycontroller-org/server/v2/pkg/types/cmap"
)
// cron types
const (
TypeRepeat = "repeat"
TypeCron = "cron"
TypeSimple = "simple"
TypeSunrise = "sunrise"
TypeSunset = "sunset"
)
// frequency types
const (
FrequencyDaily = "daily"
Frequen... |
// Copyright 2016 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, ... |
/*
Package proj provides an interface to the Cartographic Projections Library PROJ.4 [cartography].
See: https://proj.org
This version works with the old PROJ.4 library as well as the newer PROJ library up to and including version 6.
Example usage:
merc, err := proj.NewProj("+proj=merc +ellps=clrk66 +lat_ts=33"... |
package utils
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"syscall"
"time"
"github.com/dsoprea/go-exif"
log "github.com/dsoprea/go-logging"
)
type IfdEntry struct {
IfdPath string `json:"ifd_path"`
FqIfdPath string `json:"fq_ifd_path"`
IfdIndex int `json:"ifd_inde... |
// Copyright (c) 2017 Cisco and/or its affiliates.
//
// 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 applicabl... |
package mysql
import (
"testing"
"time"
"github.com/go-xorm/xorm"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
"github.com/grafana/grafana/pkg/tsdb"
. "github.com/smartystreets/goconvey/convey"
)
// To r... |
package mod
import (
"bytes"
"context"
"fmt"
"go/token"
"strings"
"golang.org/x/mod/modfile"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/lsp/protocol"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/internal/span"
)
func Hover(ctx context.Context, snapshot source.Snapshot,... |
/*
* Copyright 2018 the original author or 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 ... |
package main
/*
* 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
* "L... |
// Copyright 2022 The go-exactonline AUTHORS. All rights reserved.
//
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
// Code generated by gen-services.go; DO NOT EDIT.
package salesorder
import (
"context"
"encoding/json"
"github.com/stack11/go-exactonline/api"
"... |
package split_array_largest_sum
import (
"fmt"
"math"
)
func SplitArray(nums []int, m int) int {
// Find the sum of all elements and the maximum element
sum := Sum(nums)
maxElement := Max(math.MinInt32, nums...)
// Define the left and right boundary of binary search
left := maxElement
right := sum
var minim... |
package fs
import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/user"
"path"
"path/filepath"
"strings"
"syscall"
"unicode/utf16"
"unsafe"
"github.com/dennis1248/OpenOEM/src/functions"
"github.com/dennis1248/OpenOEM/src/options"
"github.com/dennis1248/OpenOEM/src/types"
... |
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.c... |
// Code generated by go-swagger; DO NOT EDIT.
package search
// 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"... |
package issue
import (
"database/sql"
"errors"
"strings"
"github.com/mauleyzaola/issue-tracker/server/domain"
"github.com/mauleyzaola/issue-tracker/server/operations/database"
"github.com/mauleyzaola/issue-tracker/utils/tecgrid"
)
func (t *IssueDb) Subscribers(tx interface{}, issue *domain.Issue, excludeCurren... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.