blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
c97fa300a9ddbbe6a34583ffde3eaef27f41afc8 | c0dd619857b2dff78ae756c124eb4c4c01f2e260 | zeitlinger/go-gin | /ginhttp/server_internal_test.go | Go | go | 892 | permissive | package ginhttp
import (
"github.com/opentracing/opentracing-go/ext"
"github.com/opentracing/opentracing-go/mocktracer"
"github.com/stretchr/testify/assert"
"testing"
)
func TestSetIp(t *testing.T) {
tests := []struct {
name string
addr string
expectedSpanTags map[string]interface{}... |
fd4c40341ca8718ac15d202ecee909bb461fff67 | 908e1381b79606b6f840240b09afca7e293f77dc | nebchan/lino | /x/account/model/errors.go | Go | go | 6,737 | permissive | package model
import (
"fmt"
"github.com/lino-network/lino/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// ErrAccountInfoNotFound - error if account info is not found
func ErrAccountInfoNotFound() sdk.Error {
return types.NewError(types.CodeAccountInfoNotFound, fmt.Sprintf("account info is not found"))
}
... |
6164abae5b280be4ac8df4d0154c7d7abc6790d5 | 398485a72787d1c9d43018387793002dd0d69efb | r00t-101-LoL/gvisor | /pkg/sentry/syscalls/linux/sys_splice.go | Go | go | 10,049 | permissive | // Copyright 2019 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
00846516c1d0f22589833a1039f5b90ad1b3019b | 288c3df9a625a7768780a6e86ee8e76f4fd1ebae | C0reFast/cyclone | /pkg/workflow/coordinator/cycloneserver/client.go | Go | go | 3,317 | permissive | package cycloneserver
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
"github.com/gorilla/websocket"
log "github.com/sirupsen/logrus"
websocketutil "github.com/caicloud/cyclone/pkg/util/websocket"
)
const (
cycloneAPIVersion = "/apis/v1alpha1"
apiPathForLogSt... |
015914e06b98c0d904b425b8910b422e6ce7d1a8 | 985d494595893e187002d8718ee11ccd8fed3eaf | 858chain/wallet-keeper | /cmd/logger.go | Go | go | 1,089 | permissive | package main
import (
"errors"
"fmt"
"os"
"path/filepath"
log "github.com/sirupsen/logrus"
)
func setupLogger(logLevel string, logDir string, formatter string) error {
// set log output to local file if logPath specified, os.Stdout by default.
if len(logDir) == 0 {
fmt.Fprintln(os.Stdout, "use stdout as def... |
328b75757f20c405121b2c33a96d19c6ee944fdc | 630006e0194175d2efcd42b3439a8bf391a49466 | trevorhiley/rftg | /game/gdice_test.go | Go | go | 1,777 | no_license | package game
import "testing"
func getDieSides() []DiceSide {
return []DiceSide{Explore, Develop, Settle, Produce, Ship, Wild}
}
func getDieTypes() []DiceType {
return []DiceType{Home, Alien, Rare, Consumption, Military, Genes, Novelty}
}
func TestDiceSidesString(t *testing.T) {
diceString := Explore.String()
i... |
2cf8b9b364407aa4b415bb3e326638efa8b8bb17 | 3c48807e4dc7836815e26181cc80e1c2e8b7f130 | AdamGuan/dream_api_sms_v2 | /models/mresp.go | Go | go | 4,019 | no_license | package models
type MResp struct {
responseNo int
responseMsg string
}
type MRegisterResp struct {
responseNo int
responseMsg string
F_uid string
}
type MFindPwdResp struct {
responseNo int
responseMsg string
password string
}
type MUserExistsResp struct {
responseNo int
responseMsg string
e... |
7c57eacd5215c4792999a92bdb85bc50d148852e | 81c1604e901993e34616dc84ec6f7a8d8cd80a60 | listinvest/go_keylogger | /keylogger_gui/setupgrid/centers.go | Go | go | 5,492 | no_license | package setupgrid
import "github.com/dustin/go-heatmap"
var centers = map[string]heatmap.DataPoint{
"Test": heatmap.P(100.0, 100.0),
// 1st row
"Escape": heatmap.P(44.0, 37.0),
"F1": heatmap.P(169.0, 37.0),
"F2": heatmap.P(244.0, 37.0),
"F3": heatmap.P(319.0, 37.0),
"F4": ... |
eff96c9c6f26758bde1f1da7cfbfd0f892a15f8e | 54b05242b28765462272f78df9b84c5e97cd6dbd | ruifly2012/xj_game_server | /client/102_bjl/client.go | Go | go | 9,349 | no_license | package main
import (
"bytes"
"encoding/binary"
"encoding/json"
"fmt"
"github.com/golang/protobuf/proto"
"io"
"log"
"net"
gamemsg "xj_game_server/client/102_bjl/msg"
"time"
)
const (
//addr = "47.56.172.167:8000"
addr = "47.113.94.16:12280"
//addr = "127.0.0.1:8003"
//addr = "47.56.17... |
bbddec4de4f62c5ec098bf9b5118acb29f80053e | a5ea41579cda79ecdf561cb2472092e72dffb8cb | alchemy-lee/dubbo-go | /cluster/router/v3router/factory_test.go | Go | go | 1,193 | permissive | /*
* 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 ... |
45624f253a4d021d12e3360a63f90d343701cab7 | 46f1bd671e67c23545ec8fa0426066ea13a705a0 | yam8511/gola | /internal/bootstrap/helper.go | Go | go | 1,276 | permissive | package bootstrap
import (
"fmt"
"log"
"os"
"strings"
"github.com/fatih/color"
)
// GetAppEnv 取環境變數
func GetAppEnv() string {
env := strings.TrimSpace(os.Getenv("APP_ENV"))
if env == "" {
env = "default"
}
return env
}
// GetAppSite 取賽程控客端變數
func GetAppSite() string {
site := strings.TrimSpace(os.Getenv... |
7d617c72b8017b505b7c4c96808ecb0d3a1f364c | d2ff6e0684c14644e0ba791a95ca84a9d8aa19e5 | nogio/noggo-data-sqlite | /driver.go | Go | go | 510 | no_license | package data_sqlite
import (
. "github.com/nogio/noggo/base"
"github.com/nogio/noggo/driver"
"errors"
)
type (
SqliteDriver struct {
}
)
//驱动连接
func (drv *SqliteDriver) Connect(config Map) (driver.DataConnect,error) {
if config == nil {
return nil,errors.New("配置不可为空")
}
if file,ok := config["file"].(st... |
5807d05f3de1ff33788c6336f06cae7388f11eb7 | 632b1f21a16445efa77d1f6133fc3cf961a839b5 | ssor/sql2dgraph | /cmd/mysql_sample/generator/relation.go | Go | go | 1,566 | no_license | package generator
import (
"fmt"
"log"
)
type ClassRelation struct {
From string
FromKey string `yaml:"from_key"`
Dest string
DestKey string `yaml:"dest_key"`
Relation string
}
func GenerateClassRelationSets(relations []*ClassRelation, inserts Inserts) []string {
var sets []... |
7070a7fbff469c7b4591f0fd7d5e23d2907c3d7c | 4b4d611883c5d37b410f8915b925b6abfd53f4ec | recogni/sorten | /gcloud/gcloud.go | Go | go | 3,449 | permissive | ////////////////////////////////////////////////////////////////////////////////
package gcloud
////////////////////////////////////////////////////////////////////////////////
import (
"errors"
"io"
"os"
"path/filepath"
"strings"
"sync"
"cloud.google.com/go/storage"
"golang.org/x/net/context"
)
//////////... |
96024f91d102a78b2339253697b3398cbb4fd7dc | f0ff7750d3df562527ffacc6a48fa3926ca7984f | evdenis/syzkaller | /dashboard/app/jobs_test.go | Go | go | 23,502 | permissive | // Copyright 2017 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package main
import (
"bytes"
"fmt"
"strings"
"testing"
"time"
"github.com/google/syzkaller/dashboard/dashapi"
"github.com/google/syzkaller/pkg/em... |
c9e8d36f070b5737402fc39ca139e030276e3f25 | 1e094a517248803babacf075d0244441587b60d4 | knoxville9/tree | /app/dao/postvote.go | Go | go | 715 | no_license | // ============================================================================
// This is auto-generated by gf cli tool only once. Fill this file as you wish.
// ============================================================================
package dao
import (
"lqc.com/tree/app/dao/internal"
)
// postvoteDao is the... |
9367e9e0fba94fd6eb9280aed2094cc949227706 | ba3280f0379cf992a6d6f7324c764447e8ffd4de | ustuzhanin/seaweedfs | /weed/filesys/dir_link.go | Go | go | 4,519 | permissive | package filesys
import (
"context"
"github.com/chrislusf/seaweedfs/weed/util"
"os"
"syscall"
"time"
"github.com/chrislusf/seaweedfs/weed/filer"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/fuse"
"github.com/seaweedfs/fuse/fs"
)
var _ = f... |
11ed32ad0cb5a8858012d4ff92b64d8e6a9b84f3 | 5b285fcd9990a06251c172b22792655d66796c7c | amangale/algoliasearch-client-go | /algolia/search/requests_rules.go | Go | go | 940 | permissive | package search
import (
iopt "github.com/algolia/algoliasearch-client-go/algolia/internal/opt"
"github.com/algolia/algoliasearch-client-go/algolia/opt"
)
type searchRulesParams struct {
Query string `json:"query"`
Anchoring *opt.AnchoringOption `json:"anchoring,omitempty"`
Context ... |
a66b9c0e369d1d0c266a626d6e43f741536dfee2 | 27db0455d83c8a648d49910ec102cd724304923a | groovenauts/magellan-proxy | /message.go | Go | go | 1,851 | permissive | package main
import (
"github.com/ugorji/go/codec"
"reflect"
)
type Request struct {
V int `codec:"v" msgpack:"v"`
Env struct {
ReferenceIp string `codec:"REFERENCE_IP", msgpack:"REFERENCE_IP"`
Method string `codec:"METHOD", msgpack:"METHOD"`
Url string `codec:"URL", msgpack:"U... |
209b49114ddbe92f30900c01d1eccd25ac0917cf | a0383bb42e51fed8f7edd954363d3e8b9a6f3b45 | staebler/splunk-forwarder-operator | /vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/requests.go | Go | go | 7,344 | permissive | package loadbalancers
import (
"fmt"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/pagination"
)
// ListOptsBuilder allows extensions to add additional parameters to the
// List request.
type ListOptsBuilder interface {
ToLoadBalancerListQuery() (string, error)
}
// ListOpts allows th... |
46a735c155ec0c946b878533f59cc58f6e40ef5d | 325a1675b95d6b4d080fe212cc1082b499316628 | zucchinidev/pty-go | /basicPTY/commands/stack.go | Go | go | 2,376 | no_license | package commands
import (
"bufio"
"fmt"
"io"
"os"
"os/user"
"path/filepath"
"pty-go/basicPTY/color"
"pty-go/basicPTY/scanner"
)
func init() {
_ = Register(&Stack{})
}
// The strings store in the Stack represent the state of the command
type Stack struct {
data []string
}
func (s *Stack) GetName() string {... |
a4dc1e0dc1990a9760b89f6ad54fe70a437aaa83 | b434daeaafcc05d65ce3844984622199d0feb507 | huaweicloud/huaweicloud-sdk-go-v3 | /services/rms/v1/model/model_list_all_resources_request.go | Go | go | 971 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// ListAllResourcesRequest Request Object
type ListAllResourcesRequest struct {
// 区域ID
RegionId *string `json:"region_id,omitempty"`
// 企业项目ID
EpId *string `json:"ep_id,omitempty"`
// 资源类型(provider.type)
Type *st... |
dbc0cf90cd7793142139a47d96a607f976885075 | 800b4678a60ef8c9e1d30cbcc5b24a834fb187e3 | cristaloleg/talks | /2017/concurrency-in-go/code/message/message.go | Go | go | 2,720 | permissive | package main
import (
"errors"
"fmt"
"sync"
"time"
)
// START_DEFS OMIT
type (
Post string
Message string
Feed chan<- Message
)
type Subscriber interface {
Socket() Feed
}
type Broker struct {
sync.Mutex
connections map[Post][]Feed
}
type Client struct {
name string
feed chan Message
sleep cha... |
ee3c2fcc28ac7e566d3b9eedf69fcb0ae0a11026 | a0d18aa7e483ac4a4a06185d3a04baac5c3e4b33 | DanielLiu14/mathnavigatorSite | /constellations/orion/src/domains/semester_valid_test.go | Go | go | 1,727 | no_license | package domains_test
import (
"strings"
"testing"
"github.com/ahsu1230/mathnavigatorSite/constellations/orion/src/domains"
)
func TestValidSemesterId(t *testing.T) {
// Checks for valid semester IDs
semester := domains.Semester{SemesterId: "2019_fall", Title: "Fall 2019"}
if err := semester.Validate(); err != ... |
af6a4a2bcb0e7551a0aff77dbe79b7e7ed15d8dc | 305491c1e419b01f17bc4ec0c6b914bed4290eb5 | jackc/pgtype | /convert.go | Go | go | 13,659 | permissive | package pgtype
import (
"database/sql"
"fmt"
"math"
"reflect"
"time"
)
const (
maxUint = ^uint(0)
maxInt = int(maxUint >> 1)
minInt = -maxInt - 1
)
// underlyingNumberType gets the underlying type that can be converted to Int2, Int4, Int8, Float4, or Float8
func underlyingNumberType(val interface{}) (inter... |
1c2e6effbe8773ec60c5dd04d765bc5905651bc7 | e8fe99e66feb74c41b24e8d10eb517393905926d | Azure/ARO-RP | /vendor/github.com/microsoftgraph/msgraph-sdk-go/chats/item_members_add_request_builder.go | Go | go | 4,468 | permissive | package chats
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors"
)
// ItemMembersAddRequestBuilder ... |
4aa08b7c1fefba8b708bef8094d3abfeffcbae25 | 525f3a957d0604e346c011e505eee541707f4616 | zhan3333/note | /leetcode-golang/design/027_移除元素.go | Go | go | 1,008 | permissive | package design
// 给你一个数组 nums 和一个值 val,你需要 原地 移除所有数值等于 val 的元素,并返回移除后数组的新长度。
//
//不要使用额外的数组空间,你必须仅使用 O(1) 额外空间并 原地 修改输入数组。
//
//元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。
//
//
//
//示例 1:
//
//给定 nums = [3,2,2,3], val = 3,
//
//函数应该返回新的长度 2, 并且 nums 中的前两个元素均为 2。
//
//你不需要考虑数组中超出新长度后面的元素。
//示例 2:
//
//给定 nums = [0,1,2,2,3,0,4,2], ... |
05f19fd3e9799c63d5ec5a4afac8a7e58d610e68 | 43d7d828d0da233a4b808756a543592f58e59087 | AmnaIrfan/provider-aws | /apis/identity/v1alpha1/doc.go | Go | go | 780 | permissive | /*
Copyright 2019 The Crossplane 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, ... |
3c017dfb6f2b438b2f1190f95e88b347f858e466 | c93695422b9a256a254e537d039e6d48daa6575c | gtrevg/mpb | /cwriter/writer_posix_test.go | Go | go | 1,039 | permissive | // +build !windows
package cwriter_test
import (
"bytes"
"fmt"
"testing"
"github.com/vbauerster/mpb/cwriter"
)
var (
cursorUp = fmt.Sprintf("%c[%dA", cwriter.ESC, 1)
clearLine = fmt.Sprintf("%c[2K\r", cwriter.ESC)
clearCursorAndLine = cursorUp + clearLine
)
// TestWriterPosix by writing a... |
e8421386cd9b57e4e8f1c8cb697ae37fa5d646b6 | a46f8c108aee62a016d862366878751a9ce4d9fc | kimberlyly/spotitube | /models/base_playlist.go | Go | go | 476 | no_license | package models
type ClientPlaylist interface {
GetID() string
GetOwnerID() string
GetName() string
GetURL() string
GetCoverURL() string
}
type Playlist struct {
ID string
OwnerID string
Name string
URL string
CoverURL string
}
func NewPlaylist(playlist ClientPlaylist) *Playlist {
return &P... |
0c5d5fb5fbe7efec82be89a16b60f47b74c7f78b | 0a406cc2586400962a97cc421a38eabf9c260e80 | SDITools/goraygun | /raygun.go | Go | go | 1,803 | permissive | package goraygun
import (
"encoding/json"
"errors"
"log"
"net/http"
"strings"
)
const ENDPOINT = "https://api.raygun.io/entries"
const (
ClientName = "Go-Raygun"
ClientVersion = "0.0.1"
ClientRepo = "http://github.com/sditools/go-raygun"
)
type Settings struct {
ApiKey string
Endpoint string... |
77169218ab84bf12fac11ead1a6d59b59b745130 | d2ad59ba2dd8ca19dd1bd30d70d336d82ec9fefe | openshift/cluster-api-provider-kubevirt | /pkg/loadbalancer/loadbalancer_suite_test.go | Go | go | 783 | permissive | /*
Copyright 2021 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, ... |
e946b17ddf10d08d152b8f31d57f6a50a2234bcd | c2b02e32512723cb63446a0e88ce8af641300215 | DecentralTechOrg/lotus | /cmd/lotus-chainwatch/scheduler/scheduler.go | Go | go | 1,368 | permissive | package scheduler
import (
"context"
"database/sql"
"time"
logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors"
)
var log = logging.Logger("scheduler")
// Scheduler manages the execution of jobs triggered
// by tickers. Not externally configurable at runtime.
type Scheduler struct {
db *sql.DB
}
// Pr... |
a8c47f6df023876e6d0e65ef562a0257d5ad3e3b | aa7cd180c187609683d5f74a9250bf60ea2faadf | extoor/mkcert | /truststore_java.go | Go | go | 3,332 | permissive | // Copyright 2018 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 main
import (
"bytes"
"crypto/sha1"
"crypto/sha256"
"crypto/x509"
"encoding/hex"
"hash"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
)... |
d3b512bb70e705f765473d3106a0e42e8a02d9c5 | 13ad8badabcf9223215fc0b4b385949a2bcf54f2 | microsoftgraph/msgraph-sdk-go | /sites/item_term_store_sets_item_terms_term_item_request_builder.go | Go | go | 12,040 | permissive | package sites
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3 "github.com/microsoftgraph/msgraph-sdk-go/models/termstore"
ia572726a95efa92ddd544552cd950653... |
af7316761c181aca1093027b036d301db82132ca | f2efe30c80893f6f70d995f54cddec4915b58d15 | chack1920/mqtt-http-bridge-go | /cmd/server/main.go | Go | go | 441 | permissive | package main
import (
"fmt"
"github.com/DrBenton/mqtt-http-bridge-go/pkg"
)
func main() {
go connectToMqttBrokers()
pkg.StartHttpServer(8080)
}
func connectToMqttBrokers() {
topicName := "test/e1CzbjHBW5GaiAy"
mqttClient, error := pkg.ConnectToMqttBrokerAndSubscribeToTopics("tcp://broker.hivemq.com:1883", []p... |
0c14387e9e7fd41986eaf02d5b206247266c6aaa | 89d3978371072f3a3d7fcb9a075fa1ed3c4fe8ca | cw2030/govcl | /vcl/radiogroup.go | Go | go | 26,962 | permissive |
//----------------------------------------
// The code is automatically generated by the GenlibLcl tool.
// Copyright © ying32. All Rights Reserved.
//
// Licensed under Apache License 2.0
//
//----------------------------------------
package vcl
import (
. "github.com/ying32/govcl/vcl/api"
. "github.com/yin... |
b479408e23596b7cf9e66c15ca2452b643e294a1 | 66c9772046e18342cfb756845502c73a873d40db | wtks/cmkp | /backend/model/user_request_note.go | Go | go | 3,396 | no_license | package model
import (
"context"
"github.com/jinzhu/gorm"
"time"
)
func getUserRequestNoteLoader(ctx context.Context) (*UserRequestNoteLoader, bool) {
v, e := ctx.Value(LoadersKey).(*Loaders)
return v.UserRequestNote, e
}
func createUserRequestNoteLoader(ctx context.Context) *UserRequestNoteLoader {
db := orm(... |
f62d098ae82972066e14248794f283953e832910 | 75772c72dc1d40fa31fc4a869f860dce59d4167e | drcsuite/drc | /wire/msggetblocks.go | Go | go | 4,761 | permissive | // Copyright (c) 2013-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package wire
import (
"fmt"
"io"
"github.com/drcsuite/drc/chaincfg/chainhash"
)
// MaxBlockLocatorsPerMsg is the maximum number of block locator hashes allowed
// ... |
38406697827aa43b1cb4ffc980f1c8b13f828505 | 60454ba354079a8a156597cb0205313b8e18de53 | ouqiang/goutil | /crypt/hmac.go | Go | go | 247 | permissive | package crypt
import (
"crypto/hmac"
"crypto/md5"
"encoding/hex"
)
// HMacMD5 生成hmac hash
func HMacMD5(s string, key []byte) string {
mac := hmac.New(md5.New, key)
_, _ = mac.Write([]byte(s))
return hex.EncodeToString(mac.Sum(nil))
}
|
2188e809aad3d3597ee3f47dc71e4aac7785799d | 58a06a15b73492c14cd6f46ef588b715de8f8b7a | KageKirin/flatGLM | /go/Matrix2x4_u32.go | Go | go | 1,253 | no_license | // automatically generated by the FlatBuffers compiler, do not modify
package flatmath
import (
flatbuffers "github.com/google/flatbuffers/go"
)
/// 2x4 matrix of uints
type Matrix2x4_u32 struct {
_tab flatbuffers.Struct
}
func (rcv *Matrix2x4_u32) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
... |
e28cd7819c4f8d5664355321369c726cc64db184 | bdddd781e4615319026e290a20edff41b2b03f17 | 2050utopia/sourcegraph | /cmd/repo-updater/repos/syncer.go | Go | go | 5,369 | permissive | package repos
import (
"context"
"fmt"
"sort"
"time"
"github.com/k0kubun/pp"
"github.com/pkg/errors"
"github.com/sourcegraph/sourcegraph/pkg/api"
log15 "gopkg.in/inconshreveable/log15.v2"
)
// A Syncer periodically synchronizes available repositories from all its given Sources
// with the stored Repositories... |
e33d5d4d72ad4151b39dabdd248c5837b5fd5470 | c2af8c36ca049135f9adbec24bd6626e2f6c923b | iss14036/go-balls | /common/tusd.go | Go | go | 616 | no_license | package common
import (
b64 "encoding/base64"
"errors"
"strings"
)
func GetFileType(metadata string) (string, error) {
headerUpload := strings.Split(metadata, ",")
if headerUpload[1] == "" {
return "", errors.New("no header uplaod detected")
}
fileType := strings.Split(headerUpload[1], " ")
if fileType[1] ... |
5198ed724913b34385a0704a5f65be5650a524f7 | a5a02c7167ee81fa86a7676af455544d2f2378e5 | microsoftgraph/msgraph-sdk-go | /users/item_calendars_item_events_item_snooze_reminder_request_builder.go | Go | go | 4,671 | permissive | package users
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors"
)
// ItemCalendarsItemEventsItemSn... |
104678139f3ac3fd9da4f09567d366761a62031c | fcd87795e41aa7798814028e17bf010a1c2f6a01 | alexzorin/go-bluetooth | /bluez/profile/agent/gen_AgentManager1.go | Go | go | 4,326 | permissive | // Code generated DO NOT EDIT
package agent
import (
"sync"
"github.com/muka/go-bluetooth/bluez"
"github.com/godbus/dbus"
)
var AgentManager1Interface = "org.bluez.AgentManager1"
// NewAgentManager1 create a new instance of AgentManager1
//
// Args:
func NewAgentManager1() (*AgentManager1, error) {
a ... |
1f7110eda42c471e02ada3580009683a46fc7676 | bf8264fa72b3e048160c5ca641e662c4bc5a02d6 | eproxus/entitas | /matcher.go | Go | go | 3,448 | no_license | package entitas
import (
"fmt"
"sort"
"strings"
)
const (
componentHashFactor uint16 = 647
allHashFactor = 653
anyHashFactor = 659
noneHashFactor = 661
)
type Matcher interface {
Matches(entity Entity) bool
Hash() MatcherHash
ComponentTypes() []ComponentType
Equals(m ... |
9ee77aab7361e190db2f5c97df5f0472ae0ac2a8 | b121e895be519a57feb8e52a00aeb3b188e2145b | mzy2240/home-automation | /libraries/go/firehose/firehose.go | Go | go | 1,296 | permissive | package firehose
import (
"encoding/json"
"github.com/go-redis/redis"
)
// Publisher is the interface that wraps the Publish function
type Publisher interface {
Publish(string, interface{}) error
}
// DefaultPublisher is a global instance of Publisher
var DefaultPublisher Publisher
func mustGetDefaultPublisher(... |
e499ceb3546ae02a09e6da9f434803009bedd97d | ddb9753247879d9e9539b50cdfea8b2287be8a90 | yongfa365/tidb | /plan/refiner.go | Go | go | 15,315 | permissive | // Copyright 2015 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... |
9e67cd3ad3709c9b7eedefba51bd8450a0390392 | 7924985b0daa9fee239186e9b1c7d7a275fd6170 | olli-ai/jx | /pkg/cmd/step/verify/step_verify_url_test.go | Go | go | 1,750 | permissive | // +build unit
package verify_test
import (
"net/http"
"net/http/httptest"
"os"
"testing"
"time"
"github.com/olli-ai/jx/v2/pkg/cmd/opts"
"github.com/olli-ai/jx/v2/pkg/cmd/step/verify"
"github.com/stretchr/testify/assert"
)
func newTestServer(endpoint string, fn func(http.ResponseWriter, *http.Request)) *htt... |
580bd3c7297f29201f045b14d45d8389d547b2a7 | 7146b3d62907fa6685ce2dd050562aa719584bc6 | kawabatas/echo | /middleware/key_auth_test.go | Go | go | 1,998 | permissive | package middleware
import (
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
"github.com/kawabatas/echo/v4"
"github.com/stretchr/testify/assert"
)
func TestKeyAuth(t *testing.T) {
e := echo.New()
req := httptest.NewRequest(http.MethodGet, "/", nil)
rec := httptest.NewRecorder()
c := e.NewConte... |
bfbebc7228416c3e4309225698c46186f739c649 | 3ef82ec8897780c34c1b99d0b5a3ae0406946d5b | yuanying/molamola | /vendor/github.com/kubernetes-sigs/kustomize/pkg/configmapandsecret/configmapfactory_test.go | Go | go | 4,564 | permissive | /*
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, ... |
318008f752723d34c12467141e97744148803d41 | 2eeff8e48c59008d51d65d3df980130571684b81 | xennygrimmato/sourcegraph | /services/backend/defs_authors.go | Go | go | 3,554 | no_license | package backend
import (
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"sort"
"sourcegraph.com/sourcegraph/sourcegraph/api/sourcegraph"
"sourcegraph.com/sourcegraph/sourcegraph/pkg/conf/feature"
"sourcegraph.com/sourcegraph/sourcegraph/pkg/emailaddrs"
"sourcegraph.com/sou... |
4afffd0e3a61ac98c095f9ea636dd0f85b76f0af | fbf081e1479c87a691134c8b6259ddc5a878ab40 | romakingwolf/patriot | /core/rpc/client/httpclient.go | Go | go | 15,845 | permissive | package client
import (
"context"
"net/http"
"strings"
"sync"
"time"
"github.com/pkg/errors"
amino "github.com/tendermint/go-amino"
cmn "github.com/romakingwolf/patriot/core/libs/common"
tmpubsub "github.com/romakingwolf/patriot/core/libs/pubsub"
ctypes "github.com/romakingwolf/patriot/core/rpc/core/types... |
1eac8dece144218120e3888ff9e9d2a302530a33 | 48221b1c798f3f5ca8004be5556fa069410cb6bd | mendersoftware/mender | /client/https_server_test.go | Go | go | 41,419 | permissive | // Copyright 2023 Northern.tech AS
//
// 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 t... |
766aa7cd6434ee643b6071ce593a9b3affd24fda | 9dcb7625137b7379c33f120f2e794a52c86fd6c2 | usamaiqbal83/slumber-books-api-example | /hooks/hooks_users.go | Go | go | 635 | no_license | package hooks
import (
"errors"
"fmt"
"github.com/sogko/slumber-users"
"log"
"net/http"
)
func HandlerPostCreateUserHook(resource *users.Resource, w http.ResponseWriter, req *http.Request, payload *users.PostCreateUserHookPayload) error {
if payload == nil || payload.User == nil {
return errors.New("Missing ... |
3b763e044d02a3feb6b092923f8bb8b83b012581 | d4a1ac73476162ce06ffdc0c8fcef04d8b3a4017 | vbauerster/mpb | /_examples/spinnerDecorator/main.go | Go | go | 1,117 | permissive | package main
import (
"fmt"
"math/rand"
"sync"
"time"
"github.com/vbauerster/mpb/v8"
"github.com/vbauerster/mpb/v8/decor"
)
func main() {
var wg sync.WaitGroup
// passed wg will be accounted at p.Wait() call
p := mpb.New(mpb.WithWaitGroup(&wg), mpb.WithWidth(64))
total, numBars := 100, 3
wg.Add(numBars)
... |
99ee8bf809193b946d535ecf3726d896419d0a4c | 19d83976556a766185710539800205b5c97a35b3 | qiniu/qshell | /iqshell/common/config/log.go | Go | go | 1,513 | permissive | package config
import (
"github.com/qiniu/qshell/v2/iqshell/common/data"
"github.com/qiniu/qshell/v2/iqshell/common/log"
)
type LogSetting struct {
LogLevel *data.String `json:"log_level,omitempty"`
LogFile *data.String `json:"log_file,omitempty"`
LogRotate *data.Int `json:"log_rotate,omitempty"`
LogStdou... |
6e18ed2c93b0cce3a64bcbf7c16b7fd52ca926c3 | ba12da9da63d1c1a66747a528a5a556703121774 | berty/go-libtor | /libtor/darwin_zlib_inftrees.go | Go | go | 244 | permissive | // go-libtor - Self-contained Tor from Go
// Copyright (c) 2018 Péter Szilágyi. All rights reserved.
// +build darwin,amd64 darwin,arm64 ios,amd64 ios,arm64
// +build staticZlib
package libtor
/*
#include <../zlib/inftrees.c>
*/
import "C"
|
dfb95803c047ef57f1e3fa6c03db2af21acc0522 | 06d0ef029373e23ad6a61df0aa6bbd3d1066aef1 | tlskins/bet-hound | /cmd/betting/create_bet.go | Go | go | 3,459 | permissive | package betting
import (
"fmt"
"math/rand"
"time"
uuid "github.com/satori/go.uuid"
"bet-hound/cmd/db"
t "bet-hound/cmd/types"
)
func CreateBet(proposer *t.User, newBet *t.NewBet) (bet *t.Bet, note *t.Notification, err error) {
now := time.Now()
rand.Seed(now.UnixNano())
pReplyFk := "-1"
bet = &t.Bet{
Id... |
5c44594328858c8bc5c1be56759fa9297367e525 | 73236fef0f2453f1340341ed8103d0b23b16e302 | mat-rumian/opentelemetry-collector-contrib | /processor/resourcedetectionprocessor/internal/gcp/gce/gce_test.go | Go | go | 3,859 | permissive | // Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
307d8d5dd9e151235ca2bc407c342dc4bb561a40 | fcf9a6c9327abd5fcf96252e5c4059fb0b8135ef | rosskusler/cli | /pkg/cmds/create.go | Go | go | 3,720 | permissive | package cmds
import (
"errors"
"fmt"
"io"
tapi "github.com/k8sdb/apimachinery/api"
"github.com/k8sdb/cli/pkg/kube"
"github.com/k8sdb/cli/pkg/util"
"github.com/k8sdb/cli/pkg/validator"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
clientset "k8s.io/client-go/kubernetes"
"k8s.i... |
13a59c0dcdca9f17846e44a7ef1570beab5967d6 | 09c962b8b0436b510acbe7a62071751d0a97722c | fhermeni/wints | /httpd/survey.go | Go | go | 1,160 | no_license | package httpd
import (
"fmt"
"html/template"
"net/http"
"github.com/BurntSushi/toml"
"github.com/fhermeni/wints/logger"
"github.com/fhermeni/wints/schema"
)
func (ed *HTTPd) survey(w http.ResponseWriter, r *http.Request) {
//Cache ?
kind := r.URL.Query().Get("kind")
s := schema.Survey{}
if _, err := toml.D... |
ca63bc29c0500b5537078f3623ae3289061b5b1c | 52c2a6a313970a3ff92d19a6ec7948e69a4b5e79 | haoshuwei/argo-cd | /util/git/creds.go | Go | go | 15,341 | permissive | package git
import (
"context"
"crypto/sha256"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"strconv"
"strings"
"time"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
gocache "github.com/patrickmn/go-cache"
argoio "github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/gitops-engine/pkg/... |
ee7b230c19104f2e1fe9dd2714861db9eba3b31b | d8da99f676abbd00049db2d370c9039eb6e5dabc | punokawan/document-service-gin | /middlewares/authenticate.go | Go | go | 985 | no_license | package middlewares
import (
"document-service-gin/helpers"
"document-service-gin/models"
"document-service-gin/services"
"github.com/gin-gonic/gin"
"strconv"
"strings"
)
// Authenticate fetches user details from token
func Authenticate() gin.HandlerFunc {
return func(c *gin.Context) {
requiredToken := c.Ge... |
bd8b78663bc68f07c06e418e9ce9f4ff459b7bd6 | 2f5ed5241acc190a8654d589f5ee7b20875e8195 | mg/hog | /c3/partition.go | Go | go | 2,788 | permissive | package main
import (
"bytes"
"fmt"
"time"
)
type (
Keyfunc func(...interface{}) string
Memfunc func(...interface{}) interface{}
Algofunc func(int, []int) []int
)
func memoize(f Memfunc, kf Keyfunc) Memfunc {
if kf == nil {
kf = func(v ...interface{}) string {
// Very naive keygen func, simply use stri... |
3c31ceb15338f16c6e1aa4705203775015a1a03c | 5e68abaceb9a61bdb0eef3c0297515e11055823f | tuliomonteiro/fabric | /core/chaincode/chaincode_support_test.go | Go | go | 29,526 | permissive | /*
Copyright IBM Corp. 2017 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
8e5a87b6c3609533f18ddf00b32bc460d6024e50 | 66036e32efc1a4320b71cc1d9910063d57b833d7 | jainsmit/stork | /pkg/monitor/monitor_test.go | Go | go | 17,568 | permissive | // +build unittest
package monitor
import (
"fmt"
"testing"
"time"
"github.com/libopenstorage/stork/drivers/volume"
"github.com/libopenstorage/stork/drivers/volume/mock"
stork_api "github.com/libopenstorage/stork/pkg/apis/stork/v1alpha1"
fakeclient "github.com/libopenstorage/stork/pkg/client/clientset/version... |
89b5381781d350bd530c90bdb7f430c56edf29c2 | 5ef02a0cbcda9f46dfd9a29cf98e5a6ae0ef29d3 | gobuffalo/fizz | /translators/translators_test.go | Go | go | 963 | permissive | package translators_test
import (
"os"
"testing"
"github.com/stretchr/testify/suite"
)
type CockroachSuite struct {
suite.Suite
}
type PostgreSQLSuite struct {
suite.Suite
}
type MySQLSuite struct {
suite.Suite
}
type MariaDBSuite struct {
suite.Suite
}
type MsSqlServerSQLSuite struct {
suite.Suite
}
ty... |
74828b0fdd454744e54978a159b6660a10f60a5a | f9430d52df249810c2c2f9c7e14c66f27f37fee1 | zhaoxiangchun/onecloud | /pkg/multicloud/openstack/shell/storage.go | Go | go | 1,258 | permissive | // Copyright 2019 Yunion
//
// 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... |
3163b1185358c4eeb84d96edd026d323d546c300 | 46fec599d2bf7e8b6b6a759f08f39e913b8479da | bububa/opentaobao | /api/pur/AlibabaCeresSupplierPoQuery.go | Go | go | 567 | permissive | package pur
import (
"github.com/bububa/opentaobao/core"
"github.com/bububa/opentaobao/model/pur"
)
// AlibabaCeresSupplierPoQuery 采购供应商订单查询接口
// alibaba.ceres.supplier.po.query
//
// 采购供应商订单查询接口
func AlibabaCeresSupplierPoQuery(clt *core.SDKClient, req *pur.AlibabaCeresSupplierPoQueryAPIRequest, session string) (*... |
ad700f23def980e08923899ed7ad8158ce1806ea | fc4206bb66a50bdfd064aa700989c05fb24abac2 | skyformat99/mangos | /examples/pubsub/pubsub.go | Go | go | 3,013 | permissive | // Copyright 2018 The Mangos Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use 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... |
381520bbd2e150b4e84f63496ccb6c1eacbfa828 | ecce34161e9d8ef3bf8d6673402bf5d94c32d130 | sinesiobittencourt/docker | /api/client/pull.go | Go | go | 1,600 | permissive | package client
import (
"fmt"
"net/url"
Cli "github.com/docker/docker/cli"
"github.com/docker/docker/graph/tags"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/registry"
)
// CmdPull pulls an image or a repository from the registry.
//
// Usage: dock... |
60f3ca3afc4458f88182371d5e2b934d0b0cc119 | 11b934a377658d3939d8676a7e25b49582842e9d | wwwhaoxu/kratos | /internal/httputil/http_test.go | Go | go | 3,886 | permissive | package httputil
import (
"google.golang.org/grpc/codes"
"net/http"
"testing"
)
func TestContentSubtype(t *testing.T) {
tests := []struct {
contentType string
want string
}{
{"text/html; charset=utf-8", "html"},
{"multipart/form-data; boundary=something", "form-data"},
{"application/json; charse... |
df896533e8962c826d3ea4519bd4521fb8582f00 | 98a48c9ca8c24f74e5ce6f88b8670c07f52a4d98 | Abirdcfly/containerized-data-importer | /pkg/importer/util.go | Go | go | 1,637 | permissive | package importer
import (
"io/ioutil"
"net/url"
"os"
"os/signal"
"path/filepath"
"syscall"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"kubevirt.io/containerized-data-importer/pkg/common"
"kubevirt.io/containerized-data-importer/pkg/util"
)
// ParseEndpoint parses the required endpoint and return the url str... |
d3484fba087f2896b7a47e8a936307afb787a7b4 | ead6948bdc4a479f420846d4e0e93099305d1e87 | morrell/pulumi-azure-native | /sdk/go/azure/keyvault/getSecret.go | Go | go | 1,435 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package keyvault
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource information with extended details.
// API Version: 2019-09-01.
func LookupSec... |
2c5206d76290e2a84a1dd82487b23733c7f36a4c | e2c810ad67f35f4c6fca6edde9912911af85d551 | Uwimbabazi/Replication | /src/instances/test029_n32_m512_o016_p030.go | Go | go | 63,975 | no_license | package main
import (
"os"
"fmt"
"sync"
"time"
"math/rand"
. "github.com/pspaces/gospace"
)
var debug bool
var l sync.Mutex
var writes_local int
var writes_remote int
var reads_local int
var reads_remote int
var writes_replicated int
var writestotal int
var reads_success int
var reads_insuccess int
var writes_... |
13917546f2c409c9f21b6c9cb2e978de5bf6373f | ef5c8c94f39493703f4263fb03a56f78c3fcefea | bryanl/sheaf | /pkg/commands/manifest.go | Go | go | 506 | permissive | /*
* Copyright 2020 Sheaf Authors
*
* SPDX-License-Identifier: Apache-2.0
*/
package commands
import (
"github.com/spf13/cobra"
"github.com/bryanl/sheaf/pkg/commands/manifest"
)
// NewManifestCommand creates a manifest command.
func NewManifestCommand() *cobra.Command {
cmd := &cobra.Command{
Use: ... |
102983e5e98011e0a902fea62e445973affa4820 | 25399a89874cfddf5f8f7d92b36df5fecac1bc42 | matheosu/knative-aws-sources | /pkg/apis/arn_test.go | Go | go | 3,042 | permissive | /*
Copyright (c) 2020 TriggerMesh 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, soft... |
7c0b4a0f648fbf783f93b3093dd0f3d6b3d862b6 | 12c713ed555726b1b36b622e2e220cfde4bcdd18 | openshift/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/clients/client_gen.go | Go | go | 1,305 | permissive | package clients
// NOTE: this file is generated - manual changes will be overwritten.
import (
containerservice_v2022_09_02_preview "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview"
loadtestservice_v2021_12_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/loadtes... |
26fdb56ad7eebd8a59f7817c16331537b8d00362 | 593884c33d19f09786c0dc75474f7e238d292902 | ZacharyJude/golangdemos | /demo_stringer/main.go | Go | go | 638 | no_license | package main
import (
"fmt"
)
const _enumA_name = "v0v1v2v3"
var _enumA_index = [...]uint8{0, 2, 4, 6, 8}
func (i enumA) String() string {
if i < 0 || i+1 >= enumA(len(_enumA_index)) {
return fmt.Sprintf("enumA(%d)", i)
}
return _enumA_name[_enumA_index[i]:_enumA_index[i+1]]
}
type enumA int
//go:generate s... |
b2ca8f8efbbb887fb4a356cd6ba70509a68cd0fa | d47049f83bd87ed5bb559c3ae9bdf9368feea07d | bobcallaway/relic | /lib/pkcs8/pkcs8.go | Go | go | 2,083 | permissive | //
// Copyright (c) SAS Institute 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 agre... |
5be0da60b5ae510da038704662670eec5f7d3245 | 16b47ea3102e2f3d94850b8c768e77f7c6d5541d | skpr/mail | /internal/provider/ses/ses.go | Go | go | 1,558 | no_license | package ses
import (
"fmt"
"log"
"net/mail"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ses"
"github.com/skpr/mail/internal/mailutils"
)
// AccessKeyPrefix is used when identifying if a credential is u... |
1f240ccfa59245d90389f912410919ddc24b5da8 | 86a931c006742c89cd2755a2e55b686fafe40ba7 | woopla/sh | /syntax/simplify_test.go | Go | go | 2,430 | permissive | // Copyright (c) 2017, Daniel Martí <mvdan@mvdan.cc>
// See LICENSE for licensing information
package syntax
import (
"bytes"
"fmt"
"strings"
"testing"
)
type simplifyTest struct {
in, want string
}
func noSimple(in string) simplifyTest {
return simplifyTest{in: in, want: in}
}
var simplifyTests = [...]simpl... |
3c9c62575a87698b2845910784d96d75a13b4d2b | cdbdb76f9fa112ab038c43ee268ea83ddc82e9e8 | gbrlsnchs/jwt | /json.go | Go | go | 339 | permissive | package jwt
import (
"bytes"
"errors"
)
// ErrNotJSONObject is the error for when a JWT payload is not a JSON object.
var ErrNotJSONObject = errors.New("jwt: payload is not a valid JSON object")
func isJSONObject(payload []byte) bool {
payload = bytes.TrimSpace(payload)
return payload[0] == '{' && payload[len(pa... |
f7ce6a06c1c7ac69e3b789e3fcaf630ed82dc27c | c45210e597f5068af8ff27f34ba410317f70bc1d | zehuaiWANG/kubesphere | /pkg/server/filter/logging.go | Go | go | 1,448 | permissive | /*
Copyright 2019 The KubeSphere 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, ... |
26364739ce607edbb602a6f2a6fa22d019f7449d | 3f8de8477ee8d04c4467d6d190f85b1fd3ec28aa | jsummers/fpresize | /fpresize_test.go | Go | go | 10,585 | permissive | // ◄◄◄ fpresize_test.go ►►►
// This file implements regression tests for fpresize. It is not a part of
// the main fpresize library.
package fpresize
import "testing"
import "fmt"
import "os"
import "bytes"
import "io/ioutil"
import "runtime"
import "image"
import "image/draw"
import "image/png"
import _ "image/jpeg... |
fcedca7d55919dc163ccc560478688c0a3cb70dd | 97712240993f6e329a03c9c6117e6a90e68d692e | iCodeIN/gf | /.example/container/garray/sorted_string_array2.go | Go | go | 599 | permissive | package main
import (
"fmt"
"strings"
"github.com/snail007/gf/container/garray"
"github.com/snail007/gf/frame/g"
)
func main() {
array := garray.NewSortedStringArray()
array.Add("/api/ctl/show")
array.Add("/api/ctl/post")
array.Add("/api/obj/rest")
array.Add("/api/handler")
array.Add("/api/obj/delete")
ar... |
7a2f66fa08cd51182a9b20b9dddbcb5be5e42eaa | 9847a510ea8533c77a7e9814e594f4c9eeb26ee8 | apibest/pomerium | /internal/urlutil/query_params.go | Go | go | 1,158 | permissive | package urlutil // import "github.com/pomerium/pomerium/internal/urlutil"
// Common query parameters used to set and send data between Pomerium
// services over HTTP calls and redirects. They are typically used in
// conjunction with a HMAC to ensure authenticity.
const (
QueryCallbackURI = "pomerium_callback_u... |
2509dc18048db6825ec4c2c1e39f4575c3a149b2 | fd58db5f3a3452def3eeebcba770e33b098e2108 | timstclair/godepq | /pkg/deps_test.go | Go | go | 5,081 | permissive | /*
Copyright (c) 2013-2016 the Godepq Authors
Use of this source code is governed by a MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
package pkg
import (
"go/build"
"regexp"
"testing"
"github.com/stretchr/testify/assert"
)
var (
// Expected import layout... |
ac0942482b309df64f85d833523a4e297ce35144 | 6d8a522552c54372bf665a8b0e5239e27e0516fd | sanshirookazaki/AtCoder | /abc182/b.go | Go | go | 573 | no_license | package main
import "fmt"
func main() {
var n int
fmt.Scan(&n)
listMap := map[int]int{}
for i := 0; i < n; i++ {
var a int
var list []int
fmt.Scan(&a)
d := divlist(a)
list = append(list, d...)
for _, v := range list {
listMap[v] += 1
}
}
fmt.Println(max(listMap))
}
func divlist(n int) []int {
... |
37dfb3ee15d5b470444da94287c294851f1378ca | ee443c43e4409ef21169082e1e7b820135a42c54 | cha63506/emgo | /egpath/src/stm32/hal/raw/fsmc/f40_41xxx--fsmc_bank4.go | Go | go | 573 | permissive | // +build f40_41xxx
// Peripheral: FSMC_Bank4_Periph Flexible Static Memory Controller Bank4.
// Instances:
// FSMC_Bank4 mmap.FSMC_Bank4_R_BASE
// Registers:
// 0x00 32 PCR4 PC Card control register 4.
// 0x04 32 SR4 PC Card FIFO status and interrupt register 4.
// 0x08 32 PMEM4 PC Card Common memory s... |
ea5d6dc55015dbb997799000744d5ef43295c807 | cfc85058d83ce771cc4077c8eb4f3064945393e8 | HiramGao/leetcode-go | /31/31.go | Go | go | 476 | no_license | package main
import "fmt"
func nextPermutation(nums []int) {
n := len(nums)
i := n - 2
for i >= 0 && nums[i] >= nums[i+1] {
i--
}
if i >= 0 {
j := n - 1
for j >= 0 && nums[i] >= nums[j] {
j--
}
nums[i], nums[j] = nums[j], nums[i]
}
reverse(nums[i+1:])
}
func reverse(nums []int) {
for i, n := 0, ... |
1846e3c60e2b9c73b2ce3a90b2aeccd58894a5ef | 92b4fef121b24108f09497d974652b552b7dead2 | andymcc/cluster-logging-operator | /pkg/generators/forwarding/fluentd/source.go | Go | go | 1,798 | permissive | package fluentd
import (
"fmt"
"strings"
logforward "github.com/openshift/cluster-logging-operator/pkg/apis/logging/v1alpha1"
"github.com/openshift/cluster-logging-operator/pkg/constants"
"k8s.io/apimachinery/pkg/util/sets"
)
func (engine *ConfigGenerator) generateSource(sources sets.String, appNs sets.String) ... |
a25ab13adaa897efda24754460bdcf1de6e68071 | 1a77bcde610370c7e14c9b567065e564b9e84a47 | hoojaoh/parrot | /parrot-api/vendor/github.com/bjarneh/latinx/part1.go | Go | go | 13,624 | permissive | // Copyright 2011 bjarneh@ifi.uio.no. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package latinx
// ISO 8859-1
// Generated from http://unicode.org/Public/MAPPINGS/ISO8859/8859-1.TXT
func newISO_8859_1Converter() *Converter {
conv... |
a08c608cbff9140d759e5c0a4b5de03e753070dc | 218d5f72dd386fe0288e6e2926cbbeac09f013e4 | bpkgoud/pulumi-azure-native | /sdk/go/azure/eventgrid/v20170615preview/getEventSubscription.go | Go | go | 1,250 | permissive |
package v20170615preview
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupEventSubscription(ctx *pulumi.Context, args *LookupEventSubscriptionArgs, opts ...pulumi.InvokeOption) (*LookupEventSubscriptionResult, error) {
var rv LookupEventSubscriptionResult
err := ctx.Invoke("azure-native:eventgr... |
7c7b6824f5a33923f0fbdfa7bc0376b09ae29de1 | ce5bc7002ca6412cf8dc37c1a6d653e8210c5b19 | shd123456789/algorithm008-class01 | /Week_04/跳跃游戏||.go | Go | go | 392 | no_license | // 时间复杂度为O(n) 空间复杂度为O(1)
func jump(nums []int) int {
res,end,maxPos := 0,0,0
for i := 0; i < len(nums) - 1; i++ {
maxPos = max(maxPos, nums[i] + i)
if end == i {
end = maxPos
res++
}
}
return res
}
func max (n1 int, n2 int) int {
if n1 > n2 {
... |
68355f944f88f97a55e53d581da43eb8b78f9546 | f49d2eeab8ab1c330ab315f5d3edb69dbd9102bc | Nepomuceno/msgraph | /src/model_inline_object_995.go | Go | go | 1,953 | no_license | /*
* OData Service for namespace microsoft.graph
*
* This OData service is located at https://graph.microsoft.com/v1.0/
*
* API version: 1.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package msgraph
import (
"encoding/json"
)
// InlineObject995 struct for InlineObject995
type Inli... |
743fe660db12be020fd4d60fecde9d7614459766 | 9022f7f212bec14e36cbbeadb6bc2d584f9cdd85 | 644894524/ksc | /vendor/github.com/antchfx/xmlquery/node.go | Go | go | 5,677 | permissive | package xmlquery
import (
"bytes"
"encoding/xml"
"fmt"
"strings"
)
// A NodeType is the type of a Node.
type NodeType uint
const (
// DocumentNode is a document object that, as the root of the document tree,
// provides access to the entire XML document.
DocumentNode NodeType = iota
// DeclarationNode is the... |
d9e9269840ccbbc35314a12dd60384d379c7edeb | 5c8cdf754cc4a1cf5ca34024c570a3144e09b2ad | solarknight/simple_go | /channel.go | Go | go | 869 | permissive | package main
import (
"fmt"
"time"
)
func tryChannel() {
fmt.Println()
// basicChannelUsage()
closeChannel()
}
func basicChannelUsage() {
ch1 := make(chan string)
ch2 := make(chan int)
defer close(ch1)
defer close(ch2)
go func() {
ch1 <- "Hello, world!"
}()
go func() {
ch2 <- 1
}()
go func() {
... |
e4c27620c334935c62a1eededa7fa421c47d6895 | a0f83337210e800ae8174c0ba997ba5d10d34fd2 | kaibing1/jvmgo | /src/ch10/instructions/constants/const.go | Go | go | 2,286 | no_license | package constants
import (
"jvmgo/ch10/instructions/base"
"jvmgo/ch10/rtda"
)
// Push null
type ACONST_NULL struct{ base.NoOperandsInstruction }
func (self *ACONST_NULL) Execute(frame *rtda.Frame) {
frame.OperandStack().PushRef(nil)
}
// Push double
type DCONST_0 struct{ base.NoOperandsInstruction }
func (self ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.