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 |
|---|---|---|---|---|---|---|---|---|
6c945e70596380a9b5560969d73ee585a794e9ae | b986095fedf75d5bf16f9fd7d8e6ab33cdbdbf91 | sgtest/monorepo-test-3 | /kubernetes-6/pkg/kubectl/resource/visitor.go | Go | go | 20,140 | permissive | /*
Copyright 2014 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, ... |
fda3c3edb2c82ee81104f2d59c3409f74f828e2a | 0b8ef34018703e1c10e40873a88192069cbfad0c | Nikscorp/datadog-mock | /app/sink.go | Go | go | 1,744 | permissive | // Copyright (c) 2017-2018, Jan Cajthaml <jan.cajthaml@gmail.com>
//
// 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 require... |
47e714bf10293a7fe59640d64f45e59fe118763a | 8232f7b5ab7fb1fc199ee312b3e266ab1b814aa2 | psds01/go_by_examples | /functions/functions.go | Go | go | 2,069 | no_license | // simple usage if functions
package main
import "fmt"
// sytnax: FUNC funcName(argName TYPE, ..., )return TYPE {... RETURN XX}
func addTwoNumbers(a int, b int) int {
// explicit return
return a + b
}
func subtractTwoNumbers(a, b int) int {
return a - b
}
// broadcast type in case of multiple arguments of the ... |
ab03cdf6044400b07dfa47193a293dbd84637c53 | 5b577ec61550c1bc71924ee5fb4871d6c3c64251 | tancredosouza/go | /tmq/infrastructure/serverRequestHandler.go | Go | go | 3,063 | no_license | package infrastructure
import (
"../buffers"
"../locks"
"../persist"
"log"
"net"
"strconv"
)
type ServerRequestHandler struct {
ServerHost string
ServerPort int
connectionInfo map[string] net.Conn
}
var listener net.Listener
func (srh *ServerRequestHandler) Initialize() {
srh.StartListening()
srh... |
2d78173cfbbc18649fb3ae4f80440d49ac106d4b | 9aa01c434d3c3772dde385ef16ea76bde4c7f117 | jingshanglu/tidb | /executor/index_merge_reader_test.go | Go | go | 7,482 | permissive | // Copyright 2019 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... |
09927395f52910e0715b272258f347a7acd62fe4 | f232001c91bb0b9b64fcd1388881ebdb591c7bd4 | portableHEAD/blockatlas | /api/endpoint/transaction.go | Go | go | 3,940 | permissive | package endpoint
import (
"errors"
"net/http"
"github.com/gin-gonic/gin"
"github.com/trustwallet/blockatlas/pkg/blockatlas"
"github.com/trustwallet/golibs/types"
)
// @Summary Get Transactions
// @ID tx_v2
// @Description Get transactions from the address
// @Accept json
// @Produce json
// @Tags Transactions
/... |
17a81bf356ca2df5407eadee4f78a90dd005ff4d | 1045b71de78fcce67da482b2372cbda60adf6105 | dawikur/dragon | /body/scale/core/status.go | Go | go | 7,700 | permissive | // Copyright 2017, Dawid Kurek, <dawikur@gmail.com>
package core
import (
"bytes"
"strconv"
"syscall"
"github.com/dawikur/dragon/body"
"github.com/dawikur/dragon/config"
)
func getStatusMark(retVal int) body.Mark {
if retVal == 0 {
return config.Core.Status.OK
}
if retVal > 128 {
return config.Core.Stat... |
6ba65504fcebbee37050bc96ba91609d3a5fe543 | ae9ad52e820042c061eeefe93a454e8d12dfd069 | etcd-io/etcd | /server/lease/lessor_test.go | Go | go | 17,959 | permissive | // Copyright 2015 The etcd 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 t... |
80a3183cac0555107ef8f67edb78424e3fdfb27e | a00faa70192e670099e92ddef7af8283daf33efd | marknewmail/cockroach | /sql/sqlbase/table.go | Go | go | 37,686 | permissive | // Copyright 2015 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
9de637c428ce1051f0180c7313a2a5daaea5a6bc | e09040cc1d1e427444dd8d14edcbe19da0c68ce8 | yourant/flyfish | /pkg/net/cs/cs_test.go | Go | go | 2,256 | no_license | package cs
//go test -tags=bio -covermode=count -v -coverprofile=coverage.out -run=.
//go tool cover -html=coverage.out
import (
//"errors"
"fmt"
//"github.com/sniperHW/flyfish/pkg/buffer"
flynet "github.com/sniperHW/flyfish/pkg/net"
//"github.com/sniperHW/flyfish/pkg/net/pb"
flyproto "github.com/sniperHW/flyfis... |
fcf84857c1598b871432dd6eecf52b882aaaaf64 | 96e7eaf8d7d71d15eaf83efe156ad96f8e92d5cd | wan3574489/go-cache-server | /goRedis/main.go | Go | go | 608 | no_license | package main
import (
"flag"
"goRedis/Cache"
"goRedis/cluser"
"goRedis/http"
"goRedis/tcp"
"log"
)
func main() {
typ := flag.String("type","inmemory","cache type")
node := flag.String("node","127.0.0.1","node address")
clus := flag.String("cluster","","cluster address")
port := flag.Int("port",7946,"node p... |
f190590fec7ec35b3863ac43c635c3a6873f03a5 | e4c0275104d76125b0f287a29afd15ed95d63b90 | sounishnath003/Assets-Scanner-Network | /gorun/src/main.go | Go | go | 1,053 | no_license | package main
import (
"fmt"
"net"
"os/exec"
"strconv"
"strings"
"sync"
"time"
)
var activeIp []string
var wg sync.WaitGroup
func main() {
host := "192.168.0."
for i := 1; i < 100; i++ {
wg.Add(1)
ip := host + strconv.Itoa(i)
go fn1(ip)
}
fmt.Println("Workers: Waiting for workers to finish...")
... |
20415459b1c54fbb8709334a3cbd344dca960137 | 36e15f18705f6a4a30ba3b20a4a41935a9edc313 | drk0-not-d0nn13/mailwhale | /service/spf.go | Go | go | 813 | permissive | package service
import (
"errors"
conf "github.com/muety/mailwhale/config"
"net"
"strings"
)
type SpfService struct {
config *conf.Config
}
func NewSpfService() *SpfService {
return &SpfService{
config: conf.Get(),
}
}
func (s *SpfService) Validate(domain string) error {
spfRecords, err := findSpfRecords(... |
0bb1d2c61159e79edc6ded07adea378b3a97bbe0 | abf10795ba39f97543715036b7ee9332f01d9ccc | projectcalico/calico | /felix/dataplane/linux/mock_iptables_for_test.go | Go | go | 2,483 | permissive | // Copyright (c) 2017 Tigera, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appli... |
82bba757bd994a3eb3b3486570b448389cad4689 | cdff94093def74c40bd0ed8d3255996056409411 | smklein/tailscale | /net/packet/ip6.go | Go | go | 771 | permissive | // Copyright (c) 2020 Tailscale Inc & 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 packet
import (
"fmt"
"inet.af/netaddr"
)
// IP6 is an IPv6 address.
type IP6 [16]byte
// IP6FromNetaddr converts a netaddr.IP to an I... |
dc1c80a7de7e191b4b74ac4e364e922ae9200b3b | 16a840a1ab2fc1f706b254a2e36e2fd24aeb0607 | 6freeair2016/nocalhost | /internal/nhctl/app/application.go | Go | go | 18,705 | permissive | /*
* Tencent is pleased to support the open source community by making Nocalhost available.,
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the... |
2800d957a6b2123c0ff2a83f9ae41e3b88274d3c | c7eebda328f88ad4147bf57a97ecebfa63f7539a | qingcloudhx/contrib | /trigger/tcpudp/metadata.go | Go | go | 1,157 | permissive | package tcpudp
import (
"flogo/core/data/coerce"
)
type Settings struct {
Network string `md:"network"` // The network type
Host string `md:"host"` // The host name or IP for TCP server.
Port string `md:"port,required"` // The port to listen on
Delimiter string `md:"delimiter"` // ... |
6dbfc4758f7e4e23a6a0de5c2c926ff2da2a56ea | 39d024261ce43ba0c927d76e6a36536062372d16 | pombredanne/goneoquestions | /neoquestions.go | Go | go | 1,755 | no_license | package main
import (
"flag"
"fmt"
"bytes"
"strconv"
"sync"
"time"
"encoding/binary"
"encoding/json"
"crypto/rand"
"net/http"
)
var (
consumer_key = flag.String("consumer_key", "mTicOMGrYaaEZzj89waDg", "Consumer Key")
consumer_secret = flag.String("consumer_secret", "m9EwKCoGqCsNnA2EGoV... |
103ce1198a7d384c647689b146832e0e663b628d | f085d3d2c454ee388a34519be09c9175de99144a | vallerion/amadeus-golang-sdk | /service/10_search.go | Go | go | 1,529 | permissive | package service
import (
"github.com/tmconsulting/amadeus-golang-sdk/client"
"github.com/tmconsulting/amadeus-golang-sdk/structs/fare/informativeBestPricingWithoutPNR/v12.4/request"
"github.com/tmconsulting/amadeus-golang-sdk/structs/fare/informativeBestPricingWithoutPNR/v12.4/response"
"github.com/tmconsulting/am... |
252ba517a856c01126506ccadff9f5c0887ad53f | bb690045d6db4f8b9eb72dcc3d71cb08b4fd5655 | KalyanAkella/go-algo | /ctci/build_order/main.go | Go | go | 1,665 | no_license | package main
import (
"container/list"
"fmt"
"math"
)
type Node struct {
val interface{}
children []*Node
inDegree uint
status Status
}
type Graph struct {
nodes []*Node
}
type Status uint
const (
NONE Status = 0
PARTIAL = 1
COMPLETED = 2
)
func buildOrderBasedOnDFS(g *Graph... |
9fdc2f7f8651d5bbe26e1b69d3f20b7d543a8b55 | 0691908d5a3e6774577adb443ed824fd85893111 | SmokeGameplayxD/yagpdb | /rolecommands/rolecommands.go | Go | go | 10,175 | permissive | // rolecommands is a plugin which allows users to assign roles to themselves
package rolecommands
import (
"fmt"
"github.com/Sirupsen/logrus"
"github.com/jonas747/discordgo"
"github.com/jonas747/yagpdb/bot"
"github.com/jonas747/yagpdb/common"
"github.com/jonas747/yagpdb/docs"
"github.com/jonas747/yagpdb/rolecom... |
5235752a1a680fe8f4cdfc1d1855498a20e72f0c | 40f7e7aa318980cebe228c4ebb40ee4f90b77238 | fkcs/Go-Data-Structure-Algorithm | /dp/lt63.go | Go | go | 1,035 | no_license | package dp
// 不同路径,有障碍
/*
一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。
机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。
现在考虑网格中有障碍物。那么从左上角到右下角将会有多少条不同的路径?
*/
func uniquePathsWithObstacles(obstacleGrid [][]int) int {
m, n := len(obstacleGrid), len(obstacleGrid[0])
dp := make([][]int, m)
for i := 0; i < m; i++ {... |
f8b7d85ffa6608d9fe5586142b09d81d278b139c | 3387718d0c6bf6fe1d27c4edd8c4047aadeec157 | djigoio/AnimalCrossing-NH-Encyclopedia | /main.go | Go | go | 1,601 | no_license | package main
// Licensing
// Nookipedia's text content is released under a CC BY-SA 3.0 license.
// When using Nookipedia's text in your application, we request that you follow the terms of the license by citing Nookipedia as the source
// of the information, and linking back to the article's history when possible.
/... |
c18a2205343b08d5b5974ca1d5db6da4cb9019d3 | 44845c15954e9b2c1493c4e5e45a1fdb18039448 | rdelao/boomer | /runner.go | Go | go | 3,670 | permissive | package boomer
import (
"fmt"
"log"
"os"
"runtime/debug"
"time"
)
const (
stateInit string = "ready"
stateHatching string = "hatching"
stateRunning string = "running"
stateStopped string = "stopped"
)
const (
slaveReportInterval time.Duration = 3 * time.Second
)
// Task is like locust's task.
// whe... |
07c9e186839fc648d6fbf6075116d3481d5a12a7 | 384b0fe978b51a05eac828377c2f1f0a68703d79 | nanovms/ops | /fs/mkfs.go | Go | go | 18,980 | permissive | package fs
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"os"
"path/filepath"
"strconv"
"strings"
"unicode"
"github.com/go-errors/errors"
)
const sectorSize = 512
const sectorsPerTrack = 63
const heads = 255
const maxCyl = 1023
const regionFilesystem = 12
const partitionEntrySize = 16
const klogDumpSize... |
db5df7e17249787e1acc4f65c6eb1748e5fdd2ec | 5533614a4c69b04d43dae8335dde3272dda1d7eb | Miserlou/levant | /vendor/github.com/hashicorp/nomad/command/namespace.go | Go | go | 1,341 | permissive | package command
import (
"github.com/hashicorp/nomad/api/contexts"
"github.com/mitchellh/cli"
"github.com/posener/complete"
)
type NamespaceCommand struct {
Meta
}
func (f *NamespaceCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
}
func (f *NamespaceCommand) Sy... |
bc8755a6d62858de1e15b6a0d95980d1d6fc9963 | d35b5d4fa485eb3653a2f74394bf07a40ffbb969 | SirGFM/go-chat-i-guess | /conn_test.go | Go | go | 3,169 | permissive | package go_chat_i_guess
import (
"sync/atomic"
"time"
)
// A simple mock connection, used to test the chat server without an actual
// HTTP connection.
//
// Although `channel` and `user` may use the `Conn` API to use this
// connection, tests must access this structure directly to simulate
// interactions.
/... |
7ccc9b13bf0965aa9d022c96c7c37ce8328f7524 | 1bbb1d70ae9ecfa7a8f8b2b61636162f516739ef | mlmhl/compiler | /gdync/interpreter/clog/clog.go | Go | go | 1,151 | no_license | package clog
import (
"io"
"os"
gio "github.com/mlmhl/goutil/io"
gerror "github.com/mlmhl/compiler/gdync/errors"
"fmt"
)
type Logger struct {
output io.Writer
}
func NewLogger(outputFile string) (*Logger, error) {
var err error
var output io.Writer
if outputFile == "stdout" {
output = os.Stdout
} else ... |
9df202783de8b32ac123081f90e47d3fc35bf414 | 5239dfd50f6c0c03b065fc19483abe86c9efa480 | aruneli/convoy | /ebs/ebs.go | Go | go | 19,363 | permissive | package ebs
import (
"code.google.com/p/go-uuid/uuid"
"fmt"
"github.com/Sirupsen/logrus"
"github.com/rancher/convoy/convoydriver"
"github.com/rancher/convoy/util"
"net/url"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"sync"
"time"
. "github.com/rancher/convoy/logging"
)
const (
DRIVER_NAME ... |
37de57a3e252f474c248c96acf211ae01e678854 | afc0bec2c8ba0a8e9342fadd8e449b7e59cae4ee | uk-gov-mirror/ministryofjustice.opg-sirius-user-management | /internal/server/edit_my_details_test.go | Go | go | 6,505 | no_license | package server
import (
"errors"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/ministryofjustice/opg-sirius-user-management/internal/sirius"
"github.com/stretchr/testify/assert"
)
type mockEditMyDetailsClient struct {
count int
saveCount int
lastCtx sirius.Context
lastRe... |
5363715b2c8f4c3ca7708ce73b1e3ed3d073cd0d | 800543a44b5ab130d1221beefbee0ac8bd610bda | mikehelmick/AdventOfCode2019 | /day08/main.go | Go | go | 1,472 | permissive | package main
import (
"bufio"
"fmt"
"log"
"os"
)
const width = 25
const height = 6
const pixels = width * height
// layers are 25*6 = 150 pixels
type layer struct {
data [pixels]int32
zeros int
ones int
twos int
}
func (l *layer) Summary() {
for _, v := range l.data {
switch v {
case 0:
l.zeros++... |
f7500d3a0153ab44215de0a95dda3466df4dc070 | b6640cdc92151a55071922ddb362668b1aa53111 | DebraDuggan/influxdata | /plugins/inputs/logparser/logparser.go | Go | go | 7,192 | permissive | // +build !solaris
package logparser
import (
"fmt"
"log"
"reflect"
"strings"
"sync"
"github.com/influxdata/tail"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal/globpath"
"github.com/influxdata/telegraf/plugins/inputs"
// Parsers
"github.com/influxdata/telegraf/plugins/inputs/... |
a2aae6129502c4364205c209e17eb0f2020e2e84 | 316053c234911ffc358fce2c5fa06ae5ecc400d9 | reenvs/go-gin-gorm | /common/middleware/oplog.go | Go | go | 4,087 | no_license | package middleware
import (
"encoding/json"
"iptv/common/constant"
"iptv/common/logger"
"iptv/common/util"
"time"
"github.com/gin-gonic/gin"
)
/*
Warning: keep this consistent with ams/model's OperationLog
*/
type OperationLog struct {
Id uint32 `gorm:"primary_key" json:"id"`
AppId uin... |
4b6ae61b1a009015888d830404fd36f94d7c96da | e50d81521c98e75814f4ffdcb05c403a964a5b9d | garslo/app-bot | /bot/event_proxy.go | Go | go | 6,009 | no_license | package bot
import (
"log"
"github.com/Philipp15b/go-steam"
)
type eventProxy struct {
eventChan <-chan interface{}
ChatMsgEventChan chan *steam.ChatMsgEvent
ConnectedEventChan chan *steam.ConnectedEvent
FriendListEventChan chan *steam.FriendListEvent
FriendStateEvent... |
f6e1db0061789a61a0b1ceee7447fb63dd70f23c | 3e05b49f6fae187e0a787da23067768d64cae07f | EllisDon-Aegean/eventhorizon | /eventstore/memory/eventstore.go | Go | go | 7,952 | permissive | // Copyright (c) 2014 - The Event Horizon 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... |
4185ba27cd01f34a1cdf952b8a89085818ea1593 | 4fca13d2fdb171ea1ec9828a02d2cf5d910cad88 | kimitzu/kimitzu-go | /api/utils.go | Go | go | 2,124 | permissive | package api
import (
"net/url"
"strconv"
"strings"
"github.com/kimitzu/kimitzu-go/pb"
)
type TransactionQuery struct {
OrderStates []int `json:"states"`
SearchTerm string `json:"search"`
SortByAscending bool `json:"sortByAscending"`
SortByRead bool `json:"sortByRead"`
Limit ... |
cdf8fb76d2a918c337f0b04cb96ce920c8c17966 | 3ea32852a9581d31df52520fdd15ac0deba333ca | soroushj/sqlc | /internal/sql/ast/row_expr.go | Go | go | 204 | permissive | package ast
import ()
type RowExpr struct {
Xpr Node
Args *List
RowTypeid Oid
RowFormat CoercionForm
Colnames *List
Location int
}
func (n *RowExpr) Pos() int {
return n.Location
}
|
6f8dd8bd4e7379b5e8758d42ac777af7f7c33351 | 4b847ae90ff846abcfd8d008639860ed9c2b6c16 | thijsheijden/go-driver | /v2/arangodb/collection.go | Go | go | 1,141 | permissive | //
// DISCLAIMER
//
// Copyright 2020-2021 ArangoDB GmbH, Cologne, Germany
//
// 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 re... |
bb67328b5b89153ed106f872de5b5ae250f036cf | ffb99a0bc4bb22c296ee74174df16fd3750d3357 | hongzhen-ma/kube-ovn | /test/e2e/framework/expect.go | Go | go | 6,998 | permissive | /*
Copyright 2014 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, sof... |
070a4fedf03fb5d680db0190a55931100b908d39 | 0d6ee0db8d40ddbd413fb48902a78f071daa1ce4 | shaseley/libphonelabgo | /inputgestures.go | Go | go | 6,380 | no_license | package libphonelabgo
import (
"errors"
"fmt"
"math"
)
type TouchScreenEvent struct {
What int `json:"what"`
Timestamp int64 `json:"timestamp"`
TraceTime float64 `json:"tracetime"`
X float64 `json:"x"`
Y float64 `json:"y"`
Code int `json:"code"`
}
func (event *TouchScreen... |
0fc573d647c36b061dc569ba3ca600b3f9c79f20 | 8ae1b8105309b857e71557648fdfabac94752f0a | Altalogy/terratest | /test/gcp/terraform_gcp_ig_example_test.go | Go | go | 2,813 | permissive | //go:build gcp
// +build gcp
// NOTE: We use build tags to differentiate GCP testing for better isolation and parallelism when executing our tests.
package test
import (
"fmt"
"testing"
"time"
"github.com/gruntwork-io/terratest/modules/gcp"
"github.com/gruntwork-io/terratest/modules/retry"
"github.com/gruntwo... |
4a37068e643cd24b4c59baa22f3e1a80c373a6f6 | f04a00407caf6397120ca73a6fc1ec8d23e58c07 | kubevirt/containerized-data-importer | /vendor/github.com/vmware/govmomi/vim25/debug/file.go | Go | go | 1,536 | permissive | /*
Copyright (c) 2014 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed t... |
3fac5420ad57c85d40dbbeae1e0d792ec9383f8b | 28af6059f88c2bae194dd449da6c087102b361b4 | nerdynick/trafficcontrol | /traffic_ops/client/profile.go | Go | go | 1,289 | permissive | /*
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
distributed unde... |
56be4edb04903f8c7e2c33a7317ea4bdd50f8ad7 | 2d164415c68a20cf8cc769b14aec426ccc80da9b | NeoTim/skia-buildbot | /golden/go/diffstore/net_diffstore_test.go | Go | go | 3,432 | permissive | package diffstore
import (
"context"
"net"
"net/http/httptest"
"testing"
"cloud.google.com/go/storage"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.skia.org/infra/go/firestore"
"go.skia.org/infra/go/gcs/gcsclient"
"go.skia.org/infra/go/httputils"
"go.skia.org/infra/go/test... |
b733864d74f332697de5269639889a3e1ffd50e4 | 38bfcfb9e18e040844c6eae1965d26af4363e13e | walesey/kombustion | /parsers/resources/rds_optiongroup.go | Go | go | 2,081 | permissive | package resources
import (
yaml "github.com/KablamoOSS/yaml"
"github.com/KablamoOSS/kombustion/types"
"log"
"fmt"
)
type RDSOptionGroup struct {
Type string `yaml:"Type"`
Properties RDSOptionGroupProperties `yaml:"Properties"`
Condition interface{} `yaml:"Condition,o... |
560ea14a6df626246828741ddeb8050a718d186f | 1af29a3ca3d58431be5c7bb6d07aadf640dcc45a | RBSystems/av-control-api | /drivers/log.go | Go | go | 1,118 | permissive | package drivers
import (
"log"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
// P is a plain zap logger
var Log *zap.SugaredLogger
// Config is the logger config used for P
var Config zap.Config
func init() {
Config = zap.Config{
Level: zap.NewAtomicLevelAt(zap.InfoLevel),
Development: false,
Sampl... |
43e4db8cc07df2ebd3f3f82160b20cf7c1962fcd | ecdddd696f31e5739aa90722e2a1b3464dcb6b7c | aruaru0/golang_myatcoder | /PM9/210320/F/main.go | Go | go | 2,048 | no_license | package main
import (
"bufio"
"fmt"
"math"
"os"
"sort"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)
func out(x ...interface{}) {
fmt.Fprintln(wr, x...)
}
func getI() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
... |
c6c9b9842e31f3e3a6f17656f183470ac5234b7e | 4243a5d5bef02824a31d65e007fe8d0cfef69a2a | rannoch/cldr | /resources/locales/mas/calendar.go | Go | go | 1,942 | permissive | package mas
import "github.com/rannoch/cldr"
var calendar = cldr.Calendar{
Formats: cldr.CalendarFormats{
Date: cldr.CalendarDateFormat{Full: "EEEE, d MMMM y", Long: "d MMMM y", Medium: "d MMM y", Short: "dd/MM/y"},
Time: cldr.CalendarDateFormat{Full: "h:mm:ss a zzzz", Long: "h:mm:ss a z", Medium: "h:mm:... |
4e0f05d093389c29444da044b4ba5b086a8da974 | 798652941ce587ea964269c4840f8c20e6316a21 | cloudxo/awscost | /cloudwatch/cloudwatch.go | Go | go | 1,368 | permissive | package cloudwatch
import (
"sync"
"time"
"github.com/evalphobia/aws-sdk-go-wrapper/cloudwatch"
"github.com/evalphobia/aws-sdk-go-wrapper/config"
)
var cwOnce sync.Once
var cwCli *cloudwatch.CloudWatch
func getOrCreateCloudWatchClient() (*cloudwatch.CloudWatch, error) {
var err error
cwOnce.Do(func() {
cwCl... |
fc8e234af36b8ff2a6f23277bcbca0813509a962 | fa195ea15202532d616efc126126ef4a5ac005b8 | forging2012/aliyun-go | /clients/ccc/list_users_of_skill_group.go | Go | go | 3,484 | no_license | package ccc
import (
"encoding/json"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)
type ListUsersOfSkillGroupRequest struct {
requests.RpcRequest
InstanceId string `position:"Query" name:"InstanceId"... |
41b64be670f06040af19ee2dbc551ae5fdad6007 | 7bb50440586eaf15b9f2d26390ccda5f8614d85b | anstones/golang-space | /workspace/writefile/gowrite.go | Go | go | 979 | no_license | // 并发写入文件
package main
import (
"fmt"
"math/rand"
"os"
"sync"
)
func produce(data chan int, wg *sync.WaitGroup ) {
n := rand.Intn(999)
data <- n
wg.Done()
}
func consume(data chan int, done chan bool) {
f, err := os.Create("C:\\Users\\Administrator\\Desktop\\oeasy\\data\\mine\\Project\\Go_Space\\src\\writ... |
9dd0f5e422efdc067e97e4306049283bf32841c9 | aa8ae2098503de8ec39d36e613d5276519411045 | fenwuyaoji/milvus | /internal/datacoord/server_test.go | Go | go | 27,797 | permissive | // Copyright (C) 2019-2020 Zilliz. 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 la... |
df73be6eb40760a8acc98095f015946b925ca5a2 | 0c7e6b0494fcf46b2a403680e5c5d475ddfb8d85 | kangxiaoning/hello | /learning/channel/factory.go | Go | go | 395 | no_license | package main
import (
"fmt"
"sync"
)
// channel factory
type receiver struct {
sync.WaitGroup
data chan int
}
func newReceiver() *receiver {
r := &receiver{
data: make(chan int),
}
r.Add(1)
go func() {
defer r.Done()
for x := range r.data {
fmt.Println("recv:", x)
}
}()
return r
}
func main() ... |
81953d832e0c6545efc6a0defe126064f346e08a | 3f3b8cfcc976bd8b45c18a49a2a7ff7d09063bbd | peterhuene/external-dns | /provider/provider.go | Go | go | 1,476 | permissive | /*
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, ... |
da37c995a744b4cb857f27eddbb463adeafc06a2 | 5f5517dc31aa766bfb9374c2ab75df625062d603 | matrixorigin/matrixone | /pkg/vm/engine/disttae/cache/table_guard_test.go | Go | go | 3,206 | permissive | // Copyright 2021 - 2023 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 agr... |
1b7f2a746eb443c15b0c324692fe725bbcd100e2 | 68b9fb138d89a93f8dd890cfa5eca92461c9152b | isabella232/gql | /gql/builtin_reduce.go | Go | go | 7,180 | permissive | package gql
import (
"context"
"sync"
"github.com/grailbio/gql/hash"
"github.com/grailbio/gql/marshal"
"github.com/grailbio/gql/symbol"
)
func (t *reduceTable) Len(ctx context.Context, mode CountMode) int {
if mode == Approx {
return 10000
}
t.lenOnce.Do(func() { t.len = DefaultTableLen(ctx, t) })
return ... |
a7354d6dd2595036099b793c9e59abf4fc099e8d | b7e9cf5d6f4a509e1105176cbb8403edadd2be87 | KateGo520/postgres-operator | /pgo/api/policy.go | Go | go | 4,957 | permissive | package api
/*
Copyright 2018 - 2020 Crunchy Data Solutions, 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 applicabl... |
8b57d4e8554a9473f73512ef89d15d6197571846 | 4cdf60b8708fee6b0b3d6fc5d49d3c9210d6bb88 | paltolaguirre/formula | /executor/executor.go | Go | go | 4,228 | no_license | package executor
import (
"errors"
"fmt"
"github.com/xubiosueldos/conexionBD/Concepto/structConcepto"
"math"
"reflect"
"time"
"github.com/jinzhu/gorm"
"github.com/xubiosueldos/conexionBD/Function/structFunction"
"github.com/xubiosueldos/conexionBD/Liquidacion/structLiquidacion"
)
type Executor struct {
db ... |
6256d726250beff753402fbac13ef373b118c92f | 03ae13796e21eefeabaccd33be51e0316bb9540b | CharlesGriswold/spirt | /spirt.go | Go | go | 1,326 | permissive | package main
import (
//~ "bytes"
"bufio"
"fmt"
"github.com/mitchellh/go-wordwrap"
"golang.org/x/crypto/ssh/terminal"
"log"
"math/rand"
"os"
"strconv"
"strings"
"time"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
var f string
var n int
if len(os.Args) == 1 {
fmt.Println("Usage: " + os.A... |
641bb9c4ba0f8a28625428cd826c5f6224ef668f | 36f33e27273652f5c02869cd7f2f181846ba79e0 | anschwa/cicd-go-app | /main.go | Go | go | 906 | permissive | package main
import (
"encoding/json"
"log"
"net/http"
"os"
"time"
)
const Version = "v1.0.1"
var (
Port string = "4242"
BuildInfo string = ""
)
type Status struct {
Build string
Env string
Version string
}
type handler struct{}
func NewHandler() *handler {
return &handler{}
}
func (h *hand... |
47f933b65beb9ac3cc512e076486850416801269 | 6218e1f6c4cc35dec044f64fa50edee5683945b5 | DataDog/opentelemetry-collector | /receiver/scraperhelper/scrapercontroller_test.go | Go | go | 13,559 | 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 ag... |
af3921ef175cd78517eccb9b3005035a5dac761c | c9de39fd69930c2553af6640b23da880591e1157 | hazbo/gresh | /leyra.go | Go | go | 2,265 | no_license | package main
import (
"archive/zip"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"strings"
"gopkg.in/leyra/color.v1"
)
// TODO: We'll probably not use the master branch for this eventually
const url = "https://github.com/leyra/leyra/archive/master.zip"
type leyra struct {
url string
archive string
}
fu... |
70b0a82061ba1e86d9c5dc5b7db3509746bab2aa | 35f3a6a24b3f8eaeea6de097f75ecb1b4ca1d142 | sergivb01/unfurl-worker | /old/client.go | Go | go | 1,771 | no_license | package old
import (
"context"
"fmt"
"io"
"net"
"net/http"
"net/url"
"time"
)
var client = &http.Client{Transport: &http.Transport{
DialContext: func(ctx context.Context, network, addr string) (conn net.Conn, err error) {
dialer := &net.Dialer{
Timeout: time.Duration(3) * time.Second,
}
return dialer... |
602ddc303ab3d958e43c456af9b91ebcc88cedab | d43e43dd0f1bce539537bbc640636db9fd065531 | armsnyder/aoc2020 | /day25.go | Go | go | 737 | permissive | package main
import (
"io"
"github.com/armsnyder/aoc2020/aocutil"
)
var _ = declareDay(25, func(_ bool, inputReader io.Reader) interface{} {
keys := aocutil.ReadAllInts(inputReader)
key0LoopSize := day25CrackLoopSize(keys[0])
return day25MakeEncryptionKey(keys[1], key0LoopSize)
})
func day25CrackLoopSize(publi... |
e51daa2dae5e917d56bbca14cb6eb3a941ea4328 | 5574757d254818a4f649d4d08a48946a63715286 | captdeaf/rollpoker | /gofuncs/ranks.go | Go | go | 4,956 | no_license | package rollpoker
import (
"sort"
"strconv"
)
// This file contains Hand Ranking methods.
//
// In poker, suit is worthless within a rank, so we consider each card a half-byte.
const (
// 0x075432 is a 7, 5, 4, 3, 2 of any suit, the leading 0 means 'high card'
HIGHCARD = "0"
// 0x1EE432 is a pair of aces, with 4, ... |
ad3bb2d0713116b13513fb0c859be71409f6bc50 | 1fdfc72d7c455e65a5e6ca9b3547a8948361e0d1 | fmbahrt/tlaloc | /distance_metrics/distance_metrics_test.go | Go | go | 2,679 | no_license | package distance_metrics //perhaps make own package for tests
import "testing"
//t.Errorf
//t.Fatalf - stops execution
// Use testing table (tt)
// Use Subtest
var euclidDistNoSqrtTest = []struct{
name string
vector1 []float32
vector2 []float32
distance float32
errors bool
}{
{"Identical ve... |
8bfd8f7b22a19c2eaaacb53eb35669c5742140bc | 99af36a85df020633302ee5adeadc328714eb9ce | yashbhutwala/aws-operator | /service/controller/v26/resource/drainfinisher/create.go | Go | go | 5,701 | permissive | package drainfinisher
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/autoscaling"
corev1alpha1 "github.com/giantswarm/apiextensions/pkg/apis/core/v1alpha1"
"github.com/giantswarm/microerror"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"gith... |
5f672a520af50979beccbedb0801d38942894bb3 | b1617e501e3b33bd8c13eaedad66f36ada37ad57 | grafana/agent | /component/pyroscope/ebpf/ebpf_linux_test.go | Go | go | 4,920 | permissive | //go:build linux
package ebpf
import (
"context"
"fmt"
"os"
"testing"
"time"
"github.com/grafana/agent/component"
"github.com/grafana/agent/component/pyroscope"
"github.com/grafana/agent/pkg/util"
ebpfspy "github.com/grafana/pyroscope/ebpf"
"github.com/grafana/pyroscope/ebpf/sd"
"github.com/grafana/river"... |
3a630d075ecb4a222ca4be4cdab75d09fe19848e | 787adc57452c7d170fd00c1b41d12366494b53db | johnbirdau/pulumi-azure-native | /sdk/go/azure/netapp/v20200501/account.go | Go | go | 7,524 | 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 v20200501
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// NetApp account resource
type Account ... |
efb6792d8e61121458416cdbc49912f0a667b3a2 | 30f91e2c178c0be9368e39a5b80870368fe81cfd | iharvarabyeu/influxdb | /chronograf/organizations/servers_test.go | Go | go | 8,583 | permissive | package organizations_test
import (
"context"
"fmt"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/influxdata/influxdb/v2/chronograf"
"github.com/influxdata/influxdb/v2/chronograf/mocks"
"github.com/influxdata/influxdb/v2/chronograf/organizations"
)
// IgnoreField... |
a91d88c0abd648f76ef3e5457da31683f4bf9435 | e748948e02a9730f01577b340fc9dcd5e666976c | zangdale/One-question-per-day | /oneq.go | Go | go | 2,259 | permissive | package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os/exec"
"runtime"
"strings"
)
var openBrowser bool
func init() {
flag.BoolVar(&openBrowser, "ob", false, "open browser")
}
func main() {
flag.Parse()
fmt.Println("Hello BuGuai !!! ")
url := "https://leetcode-cn.com/grap... |
57725c196e6f6ab9a92a94f5c4ba5fe1be0447e3 | 2a25b441fec5c61b21e5c902a9698ec3f7299012 | moul/gofakeit | /game_test.go | Go | go | 2,404 | permissive | package gofakeit
import (
"fmt"
"testing"
)
func ExampleGamertag() {
Seed(11)
fmt.Println(Gamertag())
// Output: PurpleSheep5
}
func ExampleFaker_Gamertag() {
f := New(11)
fmt.Println(f.Gamertag())
// Output: PurpleSheep5
}
func TestGamertag(t *testing.T) {
for i := 0; i < 100; i++ {
g := Gamertag()
if... |
db574b491dcdb1a8e34f626dddd19f3f262b503d | 30729792a90d0509af1254f921d67318f7a3aef5 | gaohf/tidb | /rset/rsets/where.go | Go | go | 5,354 | permissive | // Copyright 2014 The ql Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSES/QL-LICENSE file.
// Copyright 2015 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in complia... |
a72557b9f783fb02926f37cb170f29fba17edf38 | 994c70e227e1eab161ed5a725b7fddb4aa11374d | czcorpus/klogproc | /klogproc.go | Go | go | 5,739 | permissive | // Copyright 2017 Tomas Machalek <tomas.machalek@gmail.com>
//
// 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 appli... |
bd5870654c6a246015d116d2994055d44ee47734 | c05e2c995a10199a6fcaa1aef623c00ab0f0947e | authhwang/the-way-to-go-exercise-record | /demo/6.7/varnumpar.go | Go | go | 330 | no_license | package main
import "fmt"
func main() {
x := min(1, 3, 2, 0)
fmt.Printf("The mininum is: %d\n", x)
slice := []int{7,9,3,5,1}
x = min(slice...)
fmt.Printf("The mininum is: %d\n", x)
}
func min(s ...int) int {
if len(s)==0 {
return 0
}
min := s[0]
for _, v := range s {
if v < min {
min = v
}
}
re... |
73b249435a613b82d64ea33e9c3eed23fae811e9 | 2a673a662312023dc7dd47386f14cb0646e20534 | isabella232/kpt | /thirdparty/cli-utils/printers/json/printer.go | Go | go | 551 | permissive | // Copyright 2020 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package json
import (
"github.com/GoogleContainerTools/kpt/thirdparty/cli-utils/printers/printer"
"k8s.io/cli-runtime/pkg/genericclioptions"
"sigs.k8s.io/cli-utils/pkg/common"
"sigs.k8s.io/cli-utils/pkg/print/list"
)
func NewPrinter... |
d16d5c65d0b4df0211fc36d997be3ed0cfa0599a | 8359fbfc2983be248d8ca08daa0067eb0e22d9db | antonioofdz/libs | /frontmatter/frontmatter.go | Go | go | 2,260 | permissive | package frontmatter
import (
"bufio"
"fmt"
"io"
"io/ioutil"
"strings"
"github.com/golang/protobuf/proto"
"gopkg.in/yaml.v2"
"libs.altipla.consulting/errors"
)
// Unmarshal reads the input and parses the frontmatter into data returning the
// content. If data is a proto.Message it will use Protobuf Text, othe... |
f730a7378e51a48d913a4672d632869ac031dd7d | 8dac99a5a940409cb13fc458cf58af1384799d81 | ubik86/revel | /harness/app.go | Go | go | 3,072 | permissive | package harness
import (
"bytes"
"errors"
"fmt"
"github.com/ubik86/revel"
"io"
"os"
"os/exec"
"time"
)
// App contains the configuration for running a Revel app. (Not for the app itself)
// Its only purpose is constructing the command to execute.
type App struct {
BinaryPath string // Path to the app execut... |
e2d874f67c294ffe64ce00dd1951a3f4365db9ce | 0fa2e7aaf5f1dec3a318b28f83df69e0cfe7dd22 | robbrockbank/calico | /kube-controllers/tests/fv/config_test.go | Go | go | 10,054 | permissive | // Copyright (c) 2020 Tigera, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appli... |
3b47dc67f96b808a9bf81c68721cf64cc80b1ec8 | 8dbd16bfb5c43302991ad6ffdee178dae627849d | rangilin/glowing-dangerzone | /post_test.go | Go | go | 4,029 | permissive | package main
import (
"fmt"
"html/template"
"io/ioutil"
"os"
"path/filepath"
"testing"
"time"
)
func TestCreatePost(t *testing.T) {
t.Parallel()
title := "Folder's name"
date := time.Now().Format(ISO8601Date)
dir := createTmpFolder(t)
NewPostCreator(dir).Create(title)
postDir := filepath.Join(dir, "fo... |
c51490bd0a80035f08353cd2b4593425ec9767bc | 58a513777b7cd5e5eac35042eb39c685a2cfa1de | penghuiping/go-learn | /sysio/fileIO.go | Go | go | 1,680 | no_license | package sysio
import (
"bufio"
"fmt"
"io"
"io/ioutil"
"os"
)
func readFile(filename string) {
//读取文件
file, err := os.Open(filename)
if err != nil {
fmt.Println("出错啦,", err)
return
}
buf := make([]byte, 100)
reader := bufio.NewReader(file)
for {
size, error := reader.Read(buf)
if error == io.EOF {
... |
920327c9abf27022d4708dd0c4c5da54b81d8785 | dc9921e7eaacc2f66a015b6e3f15a26f82edbd67 | dourvaris/rai | /rai.go | Go | go | 732 | permissive | package rai
import (
"encoding/hex"
"github.com/frankh/crypto/ed25519"
"strings"
)
type BlockHash string
type Account string
type Work string
type Signature string
func (hash BlockHash) ToBytes() []byte {
bytes, err := hex.DecodeString(string(hash))
if err != nil {
panic(err)
}
return bytes
}
func (sig Sig... |
5e0b1e63246ac40ec9632bb76278fd733a960ed5 | fa9ebf16032df9dea8fe0d8709365abefed2e2d9 | WilkerAlves/banking-auth | /domain/login.go | Go | go | 1,411 | no_license | package domain
import (
"database/sql"
"github.com/WilkerAlves/banking-lib/errs"
"github.com/WilkerAlves/banking-lib/logger"
"github.com/dgrijalva/jwt-go"
"strings"
"time"
)
const TokenDuration = time.Hour
type Login struct {
Username string `db:"username"`
CustomerId sql.NullString `db:"customer_i... |
8b1aedbc462b5eebaddd5a694d21dc38ca34a4b5 | 18e3f1f5f72b701f6d9cd28abd7ac20b5a30ca12 | difince/edgex-go | /internal/security/secrets/command/import/import_test.go | Go | go | 5,541 | permissive | //
// Copyright (c) 2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed ... |
70c56d1a4f57078c774a156845fac815018524e6 | 109f9fb2657c20df9cedd3817293ac3dbfd3fc66 | killingv5/killing | /src/seckill/productinfo_test.go | Go | go | 844 | no_license | package seckill
import (
"fmt"
"helpers/iowrapper"
"testing"
"time"
)
func TestHello22(t *testing.T) {
fmt.Println("hello")
var client *iowrapper.RedisClient = &iowrapper.RedisClient{Servers: []string{"127.0.0.1:6379"}}
client.Init()
t2, _ := time.Parse(TIMEFORMAT, "2016-04-29 12:00:00")
t3, _ := time.Parse... |
2713565cbcc771d7b2d046ca584524dcec8f845b | 06f78c64fabda241517bca36345b0d356368e44c | jeevers/gopass | /action/delete_test.go | Go | go | 1,854 | permissive | package action
import (
"bytes"
"context"
"flag"
"io/ioutil"
"os"
"testing"
"github.com/justwatchcom/gopass/store/secret"
"github.com/justwatchcom/gopass/utils/ctxutil"
"github.com/justwatchcom/gopass/utils/out"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
)
func TestDelete(t *testing.T) {... |
61dc35c3dc2cf5bf5792a8432df2ac08b84ecc7f | 6907491579d3b3c11a16ed3bfe5a4ffd78cbd9c5 | openshift/ci-tools | /vendor/github.com/openshift-eng/openshift-goimports/main.go | Go | go | 690 | permissive | /*
Copyright © 2020 Corey Daley <cdaley@redhat.com>
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... |
516a860f8bbf1cfb03a9b38cbd59082b2e2df65b | 6fdcd7d0fb4f4281f036d9b4deb1ae218b6ee529 | Groestlcoin/lntxbot | /handle_callback.go | Go | go | 18,310 | permissive | package main
import (
"fmt"
"math/rand"
"strconv"
"strings"
"time"
lightning "github.com/fiatjaf/lightningd-gjson-rpc"
"github.com/go-telegram-bot-api/telegram-bot-api"
)
func handleCallback(cb *tgbotapi.CallbackQuery) {
u, t, err := ensureUser(cb.From.ID, cb.From.UserName)
if err != nil {
log.Warn().Err(... |
87ad345e5650e7b3c7cd5746614e8bd700eef4c3 | 8364d03a0648b84aebbcc1396c594a22422c5d8f | sandeeplulla/golang-code | /essentials/12_defer.go | Go | go | 338 | no_license | //defer is a garbage collector in go. it can be used to clean up any resource. it will be called even if exception occurs
package main
import "fmt"
func cleanup(name string) {
fmt.Printf("CLeaning up %s\n", name)
}
func main() {
defer cleanup("A")
defer cleanup("B") //defer calls are made in reverse order
fmt.Pr... |
bc4cce0e9f372db6561f93dd48ba28ce9d78c3b0 | 06aa5edf584eff3c85d6129c40feddcc0bb03f58 | jiandongquan/simgo | /_examples/bank/main.go | Go | go | 1,191 | permissive | package main
import (
"fmt"
"math/rand"
"time"
"github.com/fschuetz04/simgo"
)
const (
NCounters = 1
NCustomers = 10
MeanArrivalInterval = 10
MaxWaitTime = 16
MeanTimeInBank = 12
)
func customer(proc simgo.Process, id int, counters *Resource) {
fmt.Printf("[%5.1f] Customer ... |
50a34db66140d8cb52c4c00dd90e886a63d8887d | 00dcecaa398a082d7251b56590e81bd4a483543d | rusik69/rws | /pkg/client/storage/storage.go | Go | go | 3,707 | no_license | package storage
import (
"bytes"
"fmt"
"github.com/loqutus/rws/pkg/client/conf"
"io/ioutil"
"net/http"
"strings"
)
type File struct {
Name string
Host string
Size uint64
Replicas uint64
}
func Upload(name string) (string, error) {
data, err := ioutil.ReadFile(name)
if err != nil {
fmt.Print... |
3b65b8d2d164881f152cca4f2575c998553e3506 | 42592c799077de71e69b4267503841a12a2a7fad | goarne/blog | /article/service.go | Go | go | 2,089 | no_license | //CRUD services.
package article
import (
"github.com/goarne/blog/config"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
//The stateless servicefacade for CRUD services on articles.
//It uses the Mongodb wrapper mgo for communicating with Mongdb
type Service interface {
Create(f *Article) error
Update(f *Article) er... |
93fd1fa371bff531dcacee2b7296d2b2f3c537a1 | 13c58eea77fc2b0c3bcc3299977d258219f2c54b | mackerelio/go-check-plugins | /check-memcached/lib/check-memcached.go | Go | go | 1,272 | permissive | package checkmemcached
import (
"os"
"time"
"github.com/bradfitz/gomemcache/memcache"
"github.com/jessevdk/go-flags"
"github.com/mackerelio/checkers"
)
var opts struct {
Host string `short:"H" long:"host" default:"localhost" description:"Hostname"`
Port string `short:"p" long:"port" default:"11211" desc... |
8f81b869cea96a26bf99ebd7cd866eb723eab2a9 | 68b63e7e71a363fd342efc405af19e6de22b8560 | sbangari/hcsshim | /internal/hcsoci/resources_wcow.go | Go | go | 5,353 | permissive | // +build windows
package hcsoci
// Contains functions relating to a WCOW container, as opposed to a utility VM
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/Microsoft/hcsshim/internal/log"
hcsschema "github.com/Microsoft/hcsshim/internal/schema2"
"github.com/Microsoft/hcsshim/internal... |
02ecd5591afe1447e349c41000970840f164f509 | 143f9b6237647c629fa5414dd40256e2c7bffc27 | zyiou/antrea | /pkg/apis/stats/v1alpha1/doc.go | Go | go | 847 | permissive | // Copyright 2020 Antrea 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 ... |
b5f6b12dd537ff69e8e3c15b652622fd40a9ee7d | fcc7498483444ba91fa76dab318dc03cba707b2e | flybeta1988/MyGo | /src/app1/reflect/main.go | Go | go | 2,929 | no_license | package main
import (
"fmt"
"reflect"
)
type UserModel struct {
table string
}
type User struct {
Id int `json:"id" gorm:"id2"`
Name string `json:"name" gorm:"gname"`
Age int `json:"age"`
password int `json:"password"`
}
func main() {
//test1()
//test2()
test3()
//test4()
//test5()
}
func test5() {
a... |
5744c5f1e7c4c804e7bbcdd650bcc4f7d4b8fc0e | 3ee9b16159fe32cc39d840b241a9b541fca8dfdb | peilii/v6d | /go/vineyard/pkg/client/ds/blob.go | Go | go | 1,236 | permissive | /** Copyright 2020-2021 Alibaba Group Holding Limited.
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... |
30f3dc9e52b3e37d6dea54399d8bfe2cee6b82d7 | c7a0b56f4f4564d3eb42f3262f6d662c10c5004c | BarbUk/pilgo | /fs/fsutil/os_driver.go | Go | go | 2,709 | permissive | package fsutil
import (
"io/ioutil"
"os"
"path/filepath"
"github.com/andybalholm/crlf"
"github.com/gbrlsnchs/pilgo/fs"
"golang.org/x/text/transform"
)
// NOTE(gbrlsnchs): Declaring this variable here might prevent concurrent file reads, since
// this is a stateful transformer used between reads and reset at th... |
03401a483d92977042a65cf5735f077b520c8bf3 | 04af80ee06cb8e4a34e4bab028dafaa979d43003 | almanalfaruq/alfarpos-backend | /script/ExcelReader/main.go | Go | go | 612 | no_license | package main
import (
"flag"
"fmt"
"github.com/360EntSecGroup-Skylar/excelize"
)
func main() {
var excelFile, sheetName string
flag.StringVar(&excelFile, "excelfile", "", "path to excel file")
flag.StringVar(&sheetName, "sheetname", "", "sheet name of excel file")
flag.Parse()
if excelFile == "" {
panic("... |
14e145d47a0947d246e10a326bcd1054e8bb71d5 | 528071abaf1d270e257bc9dec3d252b401a648a0 | friendsofgo/go-architecture-examples | /contexts-architecture/users/cmd/users-api/internal/server/http/handlers.go | Go | go | 1,965 | no_license | package http
import (
"fmt"
"net/http"
"github.com/friendsofgo/go-architecture-examples/contexts-architecture/kit/errors"
"github.com/friendsofgo/go-architecture-examples/contexts-architecture/users/cmd/users-api/internal/server/http/jwt"
"github.com/friendsofgo/go-architecture-examples/contexts-architecture/use... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.