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 |
|---|---|---|---|---|---|---|---|---|
01efebf8c9cec97fba62e7eac413f513b40a0273 | ce0f86b4d6c54e149caff6705be9b43fa233829a | kamaroyl/algorithms-3412 | /hw1_main.go | Go | go | 1,223 | no_license | package main
import (
"hw1/BucketSort"
"hw1/BubbleSort"
"hw1/FileHandler"
"hw1/QuickSort"
"flag"
"fmt"
"time"
)
const(
BUBBLE_SORT = iota
QUICK_SORT = iota
BUCKET_SORT = iota
)
func runTime(fp func([]int), arg []int) {
start := time.... |
f952831ad610b54f826ee6c6231ec31b751e77d4 | 59be1597f75f97106621df10be6d18e251274eae | kubernetes/ingress-gce | /pkg/fuzz/helpers.go | Go | go | 17,646 | 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, ... |
30e658b6817b8861192fac1504f8d5848c2a6d41 | a2719179aa38cd89de12221207568394ccf7ee3a | sjsafranek/SkeletonMQ | /handlers.go | Go | go | 4,221 | no_license | package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/schollz/jsonstore"
)
type Job struct {
Message string `json:"message,omitempty"`
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
}
var Queues = map[string]chan Job{}
var KeySt... |
5668e334d4b5158f93ae33a75a487943331c0d05 | 778daac6f82783b67422cc731f98bf099becf4da | fd/forklift | /static/gopkg.in/fd/go-cli.v1/cli/execute.go | Go | go | 5,035 | no_license | package cli
import (
"fmt"
"os"
"reflect"
"strconv"
"strings"
)
type context_t int
const (
ctx_env context_t = 1 + iota
ctx_arg
)
func Main(args []string, environ []string) {
if args == nil {
args = os.Args
}
if environ == nil {
environ = os.Environ()
}
env := new_environment(args, environ)
exec ... |
5ef3fd3356b3c4ba3044b8bd2d9e995eadfb7c70 | 730878a561b8835844ec5741a86bab54ae81728f | jmlrt/go-snippets | /useragent/useragent.go | Go | go | 600 | permissive | // Source: https://stackoverflow.com/questions/13263492/set-useragent-in-http-request
package main
import (
"io/ioutil"
"log"
"net/http"
)
const url = "http://httpbin.org/user-agent"
const useragent = "Go-spider-bot/3.0"
func main() {
client := &http.Client{}
req, err := http.NewRequest("GET", url, nil)
if e... |
1fc88d2a31731dd927ab189c7de4466c93571627 | 0cfaa9ea10f0a4fb11b2e428618524281c6eef0b | hegemone/kore-poc | /koredata-goa/vendor/github.com/goadesign/goa/goagen/utils/signal_lin.go | Go | go | 217 | permissive | // +build !windows,!appengine
package utils
import (
"os"
"syscall"
)
var defaultSignals = []os.Signal{
syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGQUIT,
syscall.SIGTERM,
syscall.SIGUSR1,
syscall.SIGUSR2,
}
|
e4e798bea4e28e64b294b0d4d59a9591921ccac3 | 0bf5b347973f599ed5c55fb0c7ddc5db57b6e2d3 | ysoftman/codingtest | /leetcode/ysoftman_common.go | Go | go | 3,992 | no_license | /*
local 에서 테스트를 위해 공통으로 필요한 함수들을 모아 둠
*/
package main
import (
"fmt"
"strconv"
)
func printMatrix(matrix [][]int) {
m := len(matrix)
n := len(matrix[0])
for i := 0; i < m; i++ {
for j := 0; j < n; j++ {
fmt.Printf("%2v", matrix[i][j])
if j != n-1 {
fmt.Printf(",")
}
}
fmt.Println()
}
}
type... |
146d488f50b0693ff5c9b1922d867a56b7029d1d | 03a67e5db36e46ee7dfeb0d3ca98142e4898321a | shiyicode/judge | /vendor/github.com/docker/docker/cli/command/image/trust.go | Go | go | 12,553 | permissive | package image
import (
"encoding/hex"
"encoding/json"
"fmt"
"io"
"path"
"sort"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/cli/trust"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/re... |
aa87bff4d05efe503f4c7f3fee2d472fd8332c67 | 850c0de8446c4d4c3e9ca978ba78dedb62e356b4 | zimmski/tavor | /executor/keydriven/parse.go | Go | go | 759 | permissive | package keydriven
import (
"io/ioutil"
"strings"
)
// ReadKeyDrivenFile reads in a key driven file.
// A key driven file has the following format: Each lines holds one command. A command is defined by its key and parameters which are separated by a tabulator. The line ends with a new line character.
func ReadKeyDri... |
1d7551913a47517eecc71c3f1f827694a1264095 | b94a4c9ea266b5c7ee454354ebff5c2a08548a64 | piotrjaromin/gojenkins | /build.go | Go | go | 11,773 | permissive | // Copyright 2015 Vadim Kravcenko
//
// 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... |
6d15a5b1bb166af740a04b820a09c0f75f4601ab | 2f8f0951dbb0b44e1216f6d1218eb551e087c7c3 | conlini/hackerrank | /algorithms/bitmanipulation/lonelyinteger/main.go | Go | go | 291 | no_license | package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func main() {
s := bufio.NewScanner(os.Stdin)
s.Scan()
strconv.Atoi(s.Text())
var xor int
s.Scan()
for _, v := range strings.Split(s.Text(), " ") {
temp, _ := strconv.Atoi(v)
xor ^= temp
}
fmt.Println(xor)
}
|
8579fbf8b64329145b6b9429568e4dc204504fa6 | 4ca09ec7bd3f2433a2da5fcd85a777dd92fdfcc3 | akeboshi/go_language_traning | /src/ch02/ex01/tempconv/conv.go | Go | go | 810 | no_license | //Copyright (c) 2016 by akeboshi. All Rights Reserved.
package tempconv
// CToF は摂氏の温度を華氏へ変換します
func CToF(c Celsius) Fahrenheit { return Fahrenheit(c*9/5 + 32) }
// CToK は摂氏の温度を絶対温度へ変換します
func CToK(c Celsius) Kelvin { return Kelvin(c + 273.15) }
// FToC は華氏の温度を摂氏へ変換します
func FToC(f Fahrenheit) Celsius { return Celsiu... |
cd54248d9dabc86eb8b892b00cf317696ba9ae05 | 62136f351e89a5750330feedd25226bc85558e09 | lxlyh/FastBinaryEncoding | /projects/Go/proto/test/FinalModelVectorByte.go | Go | go | 3,463 | permissive | // Automatically generated by the Fast Binary Encoding compiler, do not modify!
// https://github.com/chronoxor/FastBinaryEncoding
// Source: FBE
// Version: 1.6.0.0
package test
import "errors"
import "../fbe"
import "../proto"
// Workaround for Go unused imports issue
var _ = errors.New
var _ = fbe.Version
var _ =... |
2a48bad791b96bd132358c17eb0ff8ef9b744432 | 48061653b2c62aad2bc3428ccd064d1c467733cd | sourcegraph/sourcegraph | /enterprise/cmd/precise-code-intel-worker/internal/worker/handler_test.go | Go | go | 10,466 | permissive | package worker
import (
"context"
"io"
"os"
"strings"
"testing"
"time"
"github.com/cockroachdb/errors"
"github.com/google/go-cmp/cmp"
"github.com/sourcegraph/sourcegraph/cmd/frontend/backend"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"
uploadstoremocks "github.com/sou... |
ce02cc099b08ffbff8018f3efb79fb99c2aa7fd7 | 115435a7689e73813670cb7a9bd23df9c9af2ade | toby3d/telegram | /bot.go | Go | go | 8,078 | permissive | package telegram
import (
"bytes"
"io"
"log"
"mime/multipart"
"net"
"path"
"path/filepath"
"strings"
"time"
json "github.com/json-iterator/go"
"github.com/kirillDanshin/dlog"
http "github.com/valyala/fasthttp"
)
// Bot represents a bot user with access token getted from @BotFather.
type Bot struct {
*Us... |
310021c6676cdb0766120f943fa267fa94847cc7 | aa119fbc7b0dbcdf61cd3455293b1c3200016a74 | erdii/kubermatic | /pkg/provider/datacenter_test.go | Go | go | 3,804 | permissive | /*
Copyright 2020 The Kubermatic Kubernetes Platform contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law ... |
5620a6c118685da89a81810abc38c3d39a50a476 | 0a38fdcfafa83f961435b704a028ee26d6dae369 | sulaimantok/adventure-with-the-golang | /Control Flow/switch.go | Go | go | 604 | no_license | package main
import "fmt"
func main() {
n := 4
switch n {
case 0:
fmt.Println("is zero")
fallthrough //if case matches, all following conditions will be executed as well
case 1:
fmt.Println("is <= 1")
fallthrough
case 2:
fmt.Println("is <= 2")
fallthroug
case 3:
fmt.Println("is <= 3")
fallthroug... |
f395124eca551f8618c0a74a4374c875c50ea7ea | 50ec0c195237c6612fb93027211a5983d336c476 | allen13/golerta | /vendor/gopkg.in/dancannon/gorethink.v2/encoding/cache.go | Go | go | 7,227 | permissive | // This code is based on encoding/json and gorilla/schema
package encoding
import (
"reflect"
"sort"
"sync"
"time"
)
// A field represents a single field found in a struct.
type field struct {
name string
nameBytes []byte // []byte(name)
equalFold func(s, t []byte) bool
tag bool
index ... |
a035d4dc15cd7b74d8421eb13a22920143369253 | 986fd2b188e1fefc5bf2a00badd2046aba511f82 | mishudark/vili | /templates/templates.go | Go | go | 1,963 | permissive | package templates
import (
"bytes"
"text/template"
"github.com/airware/vili/kube/yaml"
)
var service Service
// Service is a template service that returns controller and pod templates for given
// environments
type Service interface {
Deployments(env, branch string) ([]string, error)
Deployment(env, branch, na... |
433bc97c7aaf8273c4318598f69758f24a49d9cf | d9c55c4d2c291b1f8117a3a10e0f65305981bfc6 | duesee/der-ascii | /cmd/der2ascii/oid_names.go | Go | go | 11,211 | permissive | // Copyright 2016 The DER ASCII Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by ... |
2d583e26290afe2c417911e4cea1874c9b4eef66 | 2ea9a58ce493d02373ca560a9ce0bd9768b57d13 | gopheracademy/gccms | /content/page.go | Go | go | 1,802 | permissive | package content
import (
"fmt"
"github.com/ponzu-cms/ponzu/management/editor"
"github.com/ponzu-cms/ponzu/system/item"
)
type Page struct {
item.Item
Address string `json:"address"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Content string `json:"content"`
}
type PageListResult struct... |
3d2f42ba606b896f7886c6eaf1c73ff10ef66fd1 | 55425f57cc607f570002a558093ae33d6ff7de53 | Lykathia/jfrog-cli-go | /artifactory/utils/prompt/promptutils.go | Go | go | 4,527 | permissive | package prompt
import (
"errors"
"github.com/jfrog/jfrog-cli-go/artifactory/utils"
"github.com/jfrog/jfrog-cli-go/utils/config"
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"github.com/jfrog/jfrog-client-go/utils/io/fileutils"
"github.com/jfrog/jfrog-client-go/utils/prompt"
"github.com/spf13/viper"
"os"... |
45ab16d6e959f965e414fe84faec18442816b603 | 0a582c61fab8df343e2bd13cf49ea15e8e5c8676 | wal-g/wal-g | /testtools/mock_logging.go | Go | go | 958 | permissive | package testtools
type callingFatalOnErrorFuncStats struct {
FatalOnErrorCallsCount int
Err error
}
type callingPrintFuncStats struct {
PrintLnCallsCount int
PrintMsg string
}
type InfoLoggerMock struct {
Stats *callingPrintFuncStats
}
func (loggerMock InfoLoggerMock) Println(v ...i... |
ba4ad392e7876792bb402649faaf9c043d98cde0 | c6b49b43f21b14258542a668e9839f694d46952a | aytrack/tidb | /br/cmd/br/backup.go | Go | go | 4,435 | permissive | // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0.
package main
import (
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/tidb/br/pkg/gluetikv"
"github.com/pingcap/tidb/br/pkg/summary"
"github.com/pingcap/tidb/br/pkg/task"
"github.com/pingcap/tidb/br/pkg/trace"
"github.com/pingc... |
88aa5b1b16fd835f7605a760ea183d8ef690757a | 6f272db92ed0b6aaf14c60e500ef1e57fb9f6e29 | AaronFriel/pulumi | /sdk/go/common/util/archive/archive.go | Go | go | 7,504 | permissive | // Copyright 2016-2018, Pulumi 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... |
3db40e0e7053d740392b45a4f41f2dda0c43223f | 70aa38f4793cb92c6ddf51df7da0789457da1c5c | smartcontractkit/chainlink | /core/services/ocr2/plugins/mercury/integration_test.go | Go | go | 22,696 | permissive | package mercury_test
import (
"context"
"crypto/ed25519"
"encoding/hex"
"errors"
"fmt"
"io"
"math"
"math/big"
"math/rand"
"net"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"sync/atomic"
"testing"
"time"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethe... |
44a936a87c67f03487115a892383308914e44e3e | 1091708efbad3d9d2aecbb8cd7aa8fdefe5b3c8c | pztrn/urtrator | /database/database_object.go | Go | go | 3,072 | permissive | // URTrator - Urban Terror server browser and game launcher, written in
// Go.
//
// Copyright (c) 2016-2020, Stanslav N. a.k.a pztrn (or p0z1tr0n) and
// URTrator contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the... |
13a3ae18f76b71af7f3d7d88fb1d539e17cd09aa | dc808409b53eddb17e7f5cc701a73e2c1367ef6e | nextid00/origin | /pkg/image/api/register.go | Go | go | 2,205 | permissive | package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqual... |
d5ba6c639f1cb90920a3219e26a8cfb34440152a | 2be6857db47c86c5a4d1b8474c3de140dfdc387f | amenzhinsky/go-memexec | /memexec_linux_test.go | Go | go | 412 | permissive | //go:build linux
package memexec
import (
"os/exec"
"testing"
)
func TestGenLinux(t *testing.T) {
e := exec.Command("go", "run", "../cmd/memexec-gen", "/usr/bin/python3")
e.Dir = "testdata"
_ = runCommand(t, e)
e = exec.Command("go", "run", ".", "-c", "print(42)")
e.Dir = "testdata"
if have := runCommand(t,... |
826a1a3be738151296a333567fa9b29abf332f10 | c32c6d3ee5adf373232afc737e532053d14c4ea7 | lkgGitHub/study-golang | /leetcode/01array/removeDuplicates/main_test.go | Go | go | 1,285 | no_license | /* 数组、指针
双指针的精髓就在控制两个指针的移动
给定一个排序数组,你需要在 原地 删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。
不要使用额外的数组空间,你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。
*/
package removeDuplicates
import (
"fmt"
"testing"
)
// 删除排序数组中的重复项
func TestRemoveDuplicates(t *testing.T) {
tests := []struct {
nums []int
length int
}{
{[]int{}, 0},
{[]i... |
2b57b2c033888ccd14c6266ad37cc269c8305c9a | 8140e669973600299c3b3f205294914c7616c240 | dryproject/drycop | /drycop/cmd/init.go | Go | go | 3,024 | permissive | /* This is free and unencumbered software released into the public domain. */
package cmd
import (
"fmt"
"os"
"os/exec"
log "github.com/Sirupsen/logrus"
"github.com/dryproject/drycop/drycop/enum"
"github.com/dryproject/drycop/drycop/util"
"github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
)
// InitC... |
b79b871e434337f0fea36ef386313abec3b298b0 | f5493442daa301bf2b2348d943dddd8c5a7cf22f | singlemonad/lsmdb | /util/file_test.go | Go | go | 698 | no_license | package util
import (
"testing"
"unsafe"
"github.com/stretchr/testify/assert"
)
func TestFile(t *testing.T) {
file, err := OpenWriteOnlyFile("test.txt")
assert.Equal(t, nil, err)
defer file.Close()
//defer file.Remove()
//s1 := []byte("123")
n, err := file.WriteBinary(int32(1))
assert.Equal(t, nil, err)
... |
e857840b8bcf2b51ec508e3783585a0971839f49 | ae2413cf7ba20ed431c14ecd1f4cbcc3999949a5 | jirawan-chuapradit/GoLearn | /loops/main.go | Go | go | 1,867 | no_license | package main
import (
"fmt"
// "os"
// "strconv"
"strings"
)
func main() {
// for statement
// var sum int
// for i := 1; i< 1000; i++{
// sum+= i
// }
// fmt.Println(sum)
// i := 0
// sum = 0
// for i < 5 {
// sum += i
// i++
// }
// fmt.Println(sum)
// var (
// sum int... |
7c17a56bf3a8c6f3c524ab37d30d4d478317568e | 4d406a33d42e42693b6ee573371a5b5171e57580 | yinzara/sealed-secrets | /cmd/controller/controller.go | Go | go | 10,086 | permissive | package main
import (
"crypto/rsa"
"fmt"
"log"
"time"
"k8s.io/apimachinery/pkg/runtime"
apiv1 "k8s.io/api/core/v1"
corev1 "k8s.io/api/core/v1"
apiequality "k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtimeserializer "k8s.io/api... |
1aaf8e05275e140376094bfbdf86d121570025d1 | a1c5824fe9df5e0747e46cabc7cf1b322db1a540 | kubernetes-sigs/cluster-api-provider-gcp | /api/v1beta1/gcpclustertemplate_conversion.go | Go | go | 775 | permissive | /*
Copyright 2022 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, ... |
22e0b759c7635696cf02056cd189ada9a0e160b6 | de9e3ab96a769d08556d7ad950d48cf4a3f8e6cf | thought-machine/finance-messaging | /iso20022/camt/FIToFIPaymentCancellationRequestV01.go | Go | go | 3,831 | permissive | package camt
import (
"encoding/xml"
"github.com/thought-machine/finance-messaging/iso20022"
)
type Document05600101 struct {
XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:camt.056.001.01 Document"`
Message *FIToFIPaymentCancellationRequestV01 `xml:"FIToFIPmtCxlReq"`
}
func (... |
23ec242221d3931e9a1c657b4ae4ec04d16226b3 | 556a6085013f985b8c95be5d3a08f8a3f4749d17 | petrhosek/xz | /format_test.go | Go | go | 3,326 | no_license | // Copyright 2014-2021 Ulrich Kunitz. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package xz
import (
"bytes"
"testing"
)
func TestHeader(t *testing.T) {
h := header{flags: CRC32}
data, err := h.MarshalBinary()
if err != nil {
t.... |
994d64dd0f0d5e0af65b72e26784bbbaaa3bbdcf | 303e31a21def211a0a227c7bec8501f2f87c2d9e | vseledkin/golda | /bin/lda.go | Go | go | 1,831 | no_license | package main
import (
"log"
"flag"
"fmt"
"os"
".."
)
const (
model = "model"
)
var input, cwd string
var t int // number of topics
func main() {
modelCommand := flag.NewFlagSet(model, flag.ExitOnError)
modelCommand.StringVar(&input, "input", "", "text file one document per line")
modelCommand.IntVar(&t, "t... |
8969dc92aed4527e6b1d6945769152d0c99ede34 | 74efb1a2564a1bf240e6ea970d3c1ec9efca785a | programming-kubernetes/pizza-apiserver | /vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes/testing/fixtures.go | Go | go | 6,284 | permissive | package testing
import (
"fmt"
"net/http"
"testing"
th "github.com/gophercloud/gophercloud/testhelper"
fake "github.com/gophercloud/gophercloud/testhelper/client"
)
func MockListResponse(t *testing.T) {
th.Mux.HandleFunc("/volumes/detail", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "G... |
13e17c8fabbad328ad4839b6c8b04a5c191e31eb | 2f61bc22fb3f8136c7931c1ace858171c5c69a66 | turingchain2020/plugin | /plugin/dapp/echo/executor/exec_local.go | Go | go | 1,602 | permissive | package executor
import (
"fmt"
"github.com/turingchain2020/turingchain/types"
echotypes "github.com/turingchain2020/plugin/plugin/dapp/echo/types/echo"
)
// ExecLocal_Ping 交易执行成功,将本消息对应的数值加1
func (h *Echo) ExecLocal_Ping(ping *echotypes.Ping, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.... |
56b45e8d36eb0b2d7698b9c323d9b00961831848 | 1c6d8cc4b38e24f65bda7e645e1a8ea2939f57b8 | Yizong98/test-infra | /tools/prow-auto-bumper/getversion_test.go | Go | go | 8,630 | permissive | /*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
2da76a288a67f9d02a29ea7c36871636343d5c52 | 74d7a6d2f694d65bf9a8fdc48aa502620f17c6ea | Shambu999/fdb-kubernetes-operator | /controllers/suite_test.go | Go | go | 10,564 | permissive | /*
* suite_test.go
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2018-2019 Apple Inc. and the FoundationDB project 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... |
16c06bf3a3b0b9363c9594aa58764301ce509273 | ffca746f8321a5b96a2babb163de9fedec531521 | acprimer/JVM-in-go | /src/ch06/instructions/stack/swap.go | Go | go | 290 | no_license | package stack
import (
"ch06/instructions/base"
"ch06/rtda"
)
type SWAP struct {
base.NoOperandsInstruction
}
func (self *SWAP) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
val1 := stack.PopSlot()
val2 := stack.PopSlot()
stack.PushSlot(val1)
stack.PushSlot(val2)
}
|
bc019457d326be9612d7f64c2f83b95b4652121b | b012aad5306099b378b848697e7aab46e5ba4c5d | jwcastillo/covid19-at | /prometheus.go | Go | go | 1,537 | permissive | package main
import (
"fmt"
"io"
"strings"
)
type metrics []metric
type metric struct {
Name string
Tags *map[string]string
Value float64
}
type CovidStat struct {
location string
infected uint64
deaths uint64
}
type Exporter interface {
GetMetrics() (metrics, error)
Health() []error
}
func writeMe... |
c8ef8c2f8674614cfcae06860ee9b40d0000bd54 | 9c5bc9e1ef8f76baaaf1ed23e89db6fc92fc7464 | Gabitchov/kuma | /pkg/xds/bootstrap/generator_test.go | Go | go | 4,352 | permissive | package bootstrap_test
import (
"context"
"io/ioutil"
"path/filepath"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
mesh_proto "github.com/Kong/kuma/api/mesh/v1alpha1"
. "github.com/Kong/kuma/pkg/xds/bootstrap"
bootstrap_config "github.com/Kong/ku... |
a30cc9998e45cd72ba3e29eb4484356943e0281e | c04e4ecb797239b1d21091dde03af743dc902a7c | rodrigoaraujoti/curso-golang-leonardoMouraLeitao | /testes/matematica/matematica.go | Go | go | 368 | no_license | package matematica
// AULA79 - TESTE UNITARIO BASICO
import (
"fmt"
"strconv"
)
// Media calcula a media dos valores
func Media(numeros ...float64) float64 {
total := 0.0
for _, num := range numeros {
total += num
}
media := total / float64(len(numeros))
mediaArredondada, _ := strconv.ParseFloat(fmt.Sprintf... |
4de4d833481a9fd282a1436207865e25f3e975d4 | b3e796f7851d63b152533851fe63187ea95792e9 | kubeam/kubeam | /common/api.go | Go | go | 2,487 | permissive | package common
import (
"github.com/go-chi/render"
"net/http"
)
// ResponseData contains the actual data for the perticular API.
// e.g. for iksm operation it has all the namespace info
type ResponseData struct {
//Deploymentgroup *ArgoCdAppRepoResponse `json:"deploymentgroup,omitempty"`
}
// AsyncStatus represen... |
699792ed07f26a5aed390109c62e0537fcf5264e | 2da9613ed8e0da62fdf083b9195adc5a28fd9624 | gitter-badger/go-proxy-2 | /main/server/main.go | Go | go | 1,053 | no_license | package main
import (
"fmt"
"github.com/zhuozl/go-proxy/common"
"github.com/zhuozl/go-proxy/server"
"log"
"net"
)
var version = "master"
const (
configPath = "server.conf"
defalutPort=1111
)
func main() {
log.SetFlags(log.Lshortfile)
// 默认配置
config := &common.Config{
ListenAddr: fmt.Sprintf(":%d", defa... |
da528581b3c1489590158f539ae1f2d270741e80 | 42b24a6fdf0c65b89cd469cd57f32ec74897c9ee | belvid/minio | /cmd/config-migrate_test.go | Go | go | 8,604 | permissive | /*
* Minio Cloud Storage, (C) 2016, 2017 Minio, 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 applica... |
0d2df42c4f2bd67277ffd98637694681e10d9822 | 7f54ee79dbcbe09edeaf5b2d9042736b324f8b91 | akif999/go-compare_and_update | /compare.go | Go | go | 575 | no_license | package compare
type bar struct {
foos []foo
}
type foo struct {
id int
val int
}
func CompareAndUpdate(src, comparision *bar) (*bar, error) {
// make map of comparision
idMap := make(map[int]int, 100000)
for _, f := range comparision.foos {
idMap[f.id] = f.val
}
// compare and update v... |
3be1f3172494caacb27162e2c1a45d9fb7729480 | 140dda047c9c069fcd55d4ab5df6f77dace6281e | flike/elasticell | /vendor/github.com/Workiva/go-datastructures/btree/immutable/node.go | Go | go | 12,488 | permissive | /*
Copyright 2014 Workiva, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distr... |
e72dc8d93b1f6b458904dae542e027f8780b4665 | fc2dc106cc93468a79fab721399026b496b6f726 | jirenugo/go-licenses | /licenses/find_test.go | Go | go | 2,790 | permissive | // Copyright 2019 Google 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... |
bf53260c90c97f7290ad05a2687d325fe1a9e34b | a46f0d2f096f68108df79ca2f97c918944c5d987 | fanghongbo/ops-hbs | /cache/host.go | Go | go | 1,709 | permissive | package cache
import (
"github.com/fanghongbo/dlog"
"github.com/fanghongbo/ops-hbs/common/model"
"sync"
)
var HostCache = NewHostMeta()
type HostMeta struct {
sync.RWMutex
Data map[string]int64
}
func (u *HostMeta) GetID(hostname string) (int64, bool) {
var (
id int64
exist bool
)
u.RLock()
defer u... |
d56efc5a4a30fd4f273888fd4cc32d906c7bd963 | aceee30c49d0a631e2d336afa28fa905e3505466 | divinerapier/learn-kubernetes | /pkg/securitycontext/fake.go | Go | go | 1,477 | 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, ... |
88fddb79de40c6d59c6d9a17f78f59732be1b81b | b1c9b781c9deb6c45828466ab87193e48a19e0aa | rsamban/cf-mgmt | /configcommands/update_space_test.go | Go | go | 14,976 | permissive | package configcommands_test
import (
"errors"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotalservices/cf-mgmt/config"
"github.com/pivotalservices/cf-mgmt/config/fakes"
. "github.com/pivotalservices/cf-mgmt/configcommands"
)
var _ = Describe("given update orgs config command", func() ... |
98296d5e16d51a4d0bafa8c5be5ef3e64e4008a3 | 182f8d011f58f30dbbb81c50fe5496d59b135c5d | inteI-cloud/kubevirt | /pkg/virt-controller/watch/drain/evacuation/evacuation.go | Go | go | 16,642 | permissive | package evacuation
import (
"fmt"
"math"
"sync"
"time"
k8sv1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"
virtconfig "kubevirt.io/kubevirt/pkg/virt-config"... |
290f74477b85c897d1cf137a01ee66ba5d4bc524 | 9b6cf6de90e0c8d17060c2c31319e46b83c66a70 | cerkas/blog-go | /config/mongo.go | Go | go | 505 | no_license | package config
/*import (
"gopkg.in/mgo.v2"
)*/
/*type Session struct {
session *mgo.Session
}*/
/*
func NewSession(url string) (*Session,error) {
session, err := mgo.Dial(url)
if err != nil {
return nil,err
}
return &Session{session}, err
}
func(s *Session) Close() {
if s.session != nil {
s.session.Close()
... |
c84a651c2e7deb63019bf9ffa02c0c9062fba7c3 | cbf73a08ae0b48700702e92c6076b4938eed281a | isgasho/core-1 | /types/options.go | Go | go | 2,387 | permissive | package types
// DeployOptions is options for deploying
type DeployOptions struct {
Name string // Name of application
Entrypoint *Entrypoint // entrypoint
Podname string // Name of pod to deploy
Nodename string // Specific nodes to deploy, if given, must b... |
2eb8e28834442f85183b4f22991669a9cf42a7e6 | 6ae1b5ebc4a2d54362148f45e1cd0a7fb106b206 | topfreegames/kubernetes-kops | /pkg/apis/kops/v1alpha3/componentconfig.go | Go | go | 71,499 | 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, ... |
9742f3ed754aaa87ca9b1dd03c22ee691130f4fb | 4dbc4e510eb41cc46fd5154146c7d6873662d33b | LOZORD/aoc2020 | /day4/main.go | Go | go | 4,209 | permissive | package main
import (
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"regexp"
"strconv"
"strings"
"github.com/golang/glog"
)
var (
part2Flag = flag.Bool("part2", false, "Activate part 2 logic.")
)
func main() {
flag.Parse()
if err := doMain(os.Stdin, os.Stdout); err != nil {
glog.Errorf("error: %v", err)
}
}
co... |
b12f84794869a798bc34456bf083ff70067dc2d3 | cea5ccd2622dd75a5821d3dd296a50f46fd9a8ba | moosq/ntt | /tests/tests.go | Go | go | 2,952 | permissive | // Package test provides interfaces for running TTCN-3 test cases.
package tests
import (
"context"
"errors"
"time"
"github.com/nokia/ntt/project"
)
// A Runner runs one or multiple jobs and emits Events
type Runner interface {
Run(context.Context) <-chan Event
}
// Job describes the test or control function t... |
cf110f99fcc6fbbf439c689364521ec3b5a775c1 | 17f3909c280dbc352ae741de503c061dc4ba6788 | AbhilashJN/blockchain-remittances-BE | /onboarding/onboarding.go | Go | go | 4,446 | no_license | package onboarding
import (
"fmt"
"log"
"github.com/AbhilashJN/blockchain-remittances-BE/account"
"github.com/AbhilashJN/blockchain-remittances-BE/transaction"
"github.com/AbhilashJN/blockchain-remittances-BE/utils"
"github.com/stellar/go/build"
"github.com/stellar/go/clients/horizon"
"github.com/stellar/go/k... |
be477c9db21d7342bf105b12cc70a350ad85016d | 127b6ed70cd8f0a3dd8cfcb736fcb867e917598e | carter115/dcs-sched | /worker/main.go | Go | go | 1,054 | no_license | package main
import (
"context"
"dcs-sched/worker/config"
"dcs-sched/worker/controller"
"flag"
"fmt"
"github.com/carter115/gslog"
"os"
"runtime"
)
func init() {
// 加载配置
configFiel := flag.String("config", "./config/config.yaml", "configure file")
flag.Parse()
if err := config.InitConfig(*configFiel); err... |
96f71699a34f4926a3c80c5d1e85f1c3f5214e25 | 92d96bf488a6ebdbcab91397d3a3b2661d5c5b4e | smsufyian/networking | /pkg/prober/prober_test.go | Go | go | 10,264 | permissive | /*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
4e323a2005fcaa2cfb8aefc8e92efea27b5a24ca | d654cfc1dd2096c68b73cb6809ab4258731e1872 | ZachT1711/golang-samples | /healthcare/fhir_store_get.go | Go | go | 1,422 | permissive | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
5c42aa9a27c0eb16fc44750f2f90bcfe8eb803ed | 3196eb72e722ea7683d1c9dde9493261f0597070 | phoreproject/btcd | /blockchain/checkpoints.go | Go | go | 9,000 | 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 blockchain
import (
"fmt"
"time"
"github.com/phoreproject/btcd/chaincfg"
"github.com/phoreproject/btcd/chaincfg/chainhash"
"github.com/phoreproject/btcd/t... |
67ca365f859e3d534e62b8c9912998fbfd990fa9 | f98a171e22c36582580b9644a1f5598b9cb217e8 | EGT-Ukraine/dataloaden | /example/slice/user.go | Go | go | 601 | permissive | //go:generate go run ../../dataloaden.go -keys int -slice github.com/vektah/dataloaden/example.User
package slice
import (
"strconv"
"time"
"github.com/vektah/dataloaden/example"
)
func NewLoader() *UserSliceLoader {
return &UserSliceLoader{
wait: 2 * time.Millisecond,
maxBatch: 100,
fetch: func(keys ... |
2374eb5158864be3a98916b9f1bdd1f12d2cdcb2 | d9005aa0ab17f653a37d41325c15651ab0b79df2 | saiyan86/azure-container-networking | /cnm/network/network_test.go | Go | go | 5,926 | permissive | // Copyright 2017 Microsoft. All rights reserved.
// MIT License
package network
import (
"bytes"
"encoding/json"
"fmt"
"net"
"net/http"
"net/http/httptest"
"os"
"testing"
"github.com/Azure/azure-container-networking/cnm"
"github.com/Azure/azure-container-networking/common"
"github.com/Azure/azure-contain... |
0c0015ac8ae3a7532808669aa1866cc4f89be2e3 | c82dee5abf05e151c7b41989da3f8f02416d6871 | CodeTest-StudyGroup/Code-Test-Study | /yeonghan/baekjoon/가르침.go | Go | go | 1,042 | no_license | package main
import (
"bufio"
"fmt"
"os"
)
var (
r = bufio.NewReader(os.Stdin)
w = bufio.NewWriter(os.Stdout)
n, k int
s []string
visit [30]bool
ans = 0
)
func test() int {
cnt := 0
for i := 0; i < n; i++ {
check := true
for j := 0; j < len(s[i]); j++ {
if !visit[s[i][j]-'a'] {
c... |
48eb55c9aedeb00d63fd4a7772a239faa3537b83 | 7cbd0b0ad675f247525bf369cc910328fb63f48a | Daio-io/surf-cams | /app/surfcam/handler.go | Go | go | 526 | no_license | package surfcam
import (
"github.com/gin-gonic/gin"
"gopkg.in/mgo.v2/bson"
"strconv"
"surf-cams/app/db"
)
// GetCamByID handler
func GetCamByID(c *gin.Context) {
session := db.Connect()
defer session.Close()
spotid, err := strconv.ParseInt(c.Param("id"), 10, 64)
col := session.DB("").C("webcams")
result :=... |
541226ac980638f9d35d23212e78c4659dbc78b9 | b7f19f549f2c88f34a8bcded2550e50b9bb1504a | sx0404/engine | /loader/gltf/khr_materials_common.go | Go | go | 3,221 | permissive | package gltf
import (
"su/engine/material"
"su/engine/math32"
"su/engine/texture"
)
// loadMaterialCommon receives an interface value describing a KHR_materials_common extension,
// decodes it and returns a Material closest to the specified description.
// The specification of this extension is at:
// https://gith... |
f297ad4820f3e30efb074c32ecaa65dd961fa21f | ef76279752dcc74156203a739884eeedb901772b | GoogleCloudPlatform/declarative-resource-client-library | /unstructured/google/dataproc/alpha/workflow_template.go | Go | go | 174,922 | permissive | // Copyright 2023 Google LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
f52b06d0d1a850be607e8b2e8c36a1a9928b3d5d | bbced76d5ed77d910cc1b6d117444fe07f405b77 | GoogleCloudPlatform/k8s-config-connector | /pkg/clients/generated/apis/networksecurity/v1beta1/register.go | Go | go | 2,917 | permissive | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wr... |
5716f60ca33ce4292ee27a6be012e199fb9b61b6 | ec42a36a00312ea18b469dd81ba5d39d7bae3fa6 | zdnscloud/g53 | /randomdomain_test.go | Go | go | 580 | no_license | package g53
import (
"math/rand"
"strings"
"testing"
"time"
ut "github.com/zdnscloud/cement/unittest"
)
func TestRandomName(t *testing.T) {
rand.Seed(time.Now().UnixNano())
maxDuplicateCount := 2
names := make(map[string]int)
duplicateCount := 0
for i := 0; i < 1000; i++ {
n := RandomNoneFQDNDomain()
... |
24a5ac1f908a980ecd30404b2ea5fed2e71538e2 | 945a07f775874fbe11e17fc85eddd4553bcfeb5a | 492258027/ziyun | /study/websocket/server.go | Go | go | 1,415 | no_license | package main
import (
"flag"
"github.com/gorilla/mux"
"github.com/gorilla/websocket"
"log"
"net/http"
"net/url"
)
var addr = flag.String("addr", "192.168.73.3:5360", "http service address")
func main() {
flag.Parse()
log.SetFlags(0)
h := mux.NewRouter()
h.HandleFunc("/Echo", Echo)
//http.ListenAndServe("1... |
0f160d0b28a03117a6c878b921129fcffb13ae5d | 73fc303246c08ba836dd5c1d96d06bec2808c0d9 | sameer2209-arm/maestro | /vendor/github.com/armPelionEdge/devicedb/bucket/bucket.go | Go | go | 1,092 | permissive | package bucket
import (
"context"
"errors"
. "github.com/armPelionEdge/devicedb/data"
. "github.com/armPelionEdge/devicedb/merkle"
)
var ENoSuchBucket = errors.New("No such bucket")
type Bucket interface {
Name() string
ShouldReplicateOutgoing(peerID string) bool
ShouldReplicateIncoming(... |
c57bc709941bcf0aef4018a94b9e76f9ad0c38c9 | 0f674f34526c3b918b3c8f922454ae95febafcfc | VividCortex/stripe-go | /bitcoinreceiver/client.go | Go | go | 3,440 | permissive | // Package bitcoinreceiver provides the /bitcoin/receivers APIs.
//
// Note that this entire package is deprecated. Please use the new sources API
// instead.
package bitcoinreceiver
import (
"fmt"
stripe "github.com/VividCortex/stripe-go"
"github.com/VividCortex/stripe-go/form"
)
// Client is used to invoke /bit... |
e1965a7a12692d86e3296d9125d6fcd6c5d55a21 | 77536a61c1730d0bac6b43904ce4a8e6ddd55608 | tossisop/vitess | /go/vt/vtgate/engine/primitive.go | Go | go | 4,560 | permissive | /*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... |
1d967603ad23216fd7005ee9ef725c173ed92193 | 0457193d961d1bc0b5f0fd00f40059e5567b431d | IceiceFire/reborn | /Godeps/_workspace/src/github.com/reborndb/go/redis/resp/encoder_test.go | Go | go | 2,244 | permissive | // Copyright 2015 Reborndb Org. All Rights Reserved.
// Licensed under the MIT (MIT-LICENSE.txt) license.
package resp
import (
"strconv"
. "gopkg.in/check.v1"
)
func (s *testRedisRespSuite) TestItos(c *C) {
for i := 0; i < len(imap)*2; i++ {
n, p := -i, i
c.Assert(strconv.Itoa(n), Equals, itos(int64(n)))
... |
d362d8b677d0408c8a7c52db44ced758a7c0e457 | 0fd15015fcb20a8608eb4ea748f45a06386f5858 | ipfs/go-datastore | /null_ds.go | Go | go | 2,939 | permissive | package datastore
import (
"context"
dsq "github.com/ipfs/go-datastore/query"
)
// NullDatastore stores nothing, but conforms to the API.
// Useful to test with.
type NullDatastore struct {
}
var _ Datastore = (*NullDatastore)(nil)
var _ Batching = (*NullDatastore)(nil)
var _ ScrubbedDatastore = (*NullDatastore)(... |
442743e34a030c9aa5e2d5f946e6b28d4b7f7a48 | 2f94bcc197f4ade27d5067733ec0b88400852c3e | vegh1010/test | /pkg/util/util.go | Go | go | 2,702 | no_license | package util
import (
"crypto/rand"
"database/sql"
"fmt"
"strings"
"time"
"github.com/google/uuid"
"github.com/jmoiron/sqlx"
"github.com/vegh1010/test/pkg/wrappederror"
)
// GetUUID returns a unique identifier
func GetUUID() string {
uuidByte, _ := uuid.NewRandom()
uuidString := uuidByte.String()
return uu... |
b4d83763939d06da34cd130497e93d014b7adb87 | d3c42837b7a099b5f81b8a9331c41da119e3e121 | VETER1309/goshimmer | /packages/tangle/payload_test.go | Go | go | 1,859 | permissive | package tangle
import (
"runtime"
"sync"
"testing"
"github.com/iotaledger/goshimmer/packages/tangle/payload"
"github.com/iotaledger/hive.go/async"
"github.com/iotaledger/hive.go/identity"
"github.com/iotaledger/hive.go/kvstore/mapdb"
"github.com/stretchr/testify/require"
"github.com/panjf2000/ants/v2"
)
fu... |
a79a3699d1d3430af04897608d3b9db53fcc7035 | fcb7e72ad06e07f6acd3f9f70f6f8f318893a928 | UsrBinLuna/mold-pineapple-bot | /main.go | Go | go | 2,198 | no_license | package main
import (
"flag"
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"github.com/bwmarrin/discordgo"
)
// Variables used for command line parameters
var (
Token string
gid string
/*chname []string
nchname string*/
ChannelType string
)
// channel types
const (
ChannelTypeGuildText discordg... |
4a5b14982663bdd2264513dec94a2442e96ac712 | 1dd6ce6753648b2a694f89ffd64c7cb02c54b3b5 | anlsergio/go_crud | /db/db.go | Go | go | 528 | no_license | package db
import (
"database/sql"
_ "github.com/go-sql-driver/mysql" // MySQL implicit connection driver
)
// Connect open up the database connection
func Connect() (*sql.DB, error) {
connectionString := "devbook:AReallyStrongPassword@/devbook?charset=utf8&parseTime=True&loc=Local"
db, err := sql.Open("mysql",... |
3dea0d02fd351010fc99f14d7e513ab810383a4c | 01a2161a7093d64a74328d98fccfebb9e0b9d000 | brpaz/go-api-sample | /test/testutil/http.go | Go | go | 493 | permissive | package testutil
import (
appHttp "github.com/brpaz/go-api-sample/internal/http"
"github.com/brpaz/go-api-sample/internal/validator"
"github.com/labstack/echo/v4"
"go.uber.org/zap"
http "net/http"
"net/http/httptest"
)
func CreateEchoTestContext(req *http.Request, rec *httptest.ResponseRecorder) echo.Context {
... |
7d400d5b02c5a6d19f88ded120f56715535db8b1 | d4d761f92033eb98444553a2c3b39fbf0e5f6197 | sturdy-dev/sturdy | /api/pkg/users/enterprise/cloud/service/module.go | Go | go | 857 | permissive | package service
import (
service_analytics "getsturdy.com/api/pkg/analytics/service"
"getsturdy.com/api/pkg/di"
transactional "getsturdy.com/api/pkg/emails/transactional/module"
service_jwt "getsturdy.com/api/pkg/jwt/service"
"getsturdy.com/api/pkg/logger"
service_onetime "getsturdy.com/api/pkg/onetime/service"
... |
7f9c474bbfa5705442342cd1182668d44b76af5a | 0ec0929b4dcd74ecd9ddfa0db6d21dc2b614a939 | infracloudio/torpedo | /vendor/github.com/libopenstorage/openstorage/config/config.go | Go | go | 1,563 | permissive | package config
import (
"fmt"
"io/ioutil"
"os"
"gopkg.in/yaml.v2"
"github.com/libopenstorage/openstorage/volume"
"go.pedge.io/dlog/logrus"
)
const (
Version = "v1"
GraphDriverAPIBase = "/var/lib/osd/graphdriver/"
UrlKey = "url"
MgmtPortKey = "mgmtP... |
7afe1510763aeff512369f90ce638734857caa8d | 924269bc848c67e471660889eea62c6a0dbc70f5 | codezork/merge | /pkg/handler/handler.go | Go | go | 367 | no_license | package handler
import (
"github.com/merge/pkg/interval"
)
type Handler interface {
StartInterval()
EndInterval()
IntervalData(interval.Data) error
Splitter()
}
type VoidHandler struct{}
func (h VoidHandler) StartInterval() {}
func (h VoidHandler) EndInterval() {}
func (h VoidHandler) IntervalData() error {r... |
c5ddcc505d10d656f790de298ddc22dc79c7d2dd | 36bed587b4d4047d188f4184a3e301d9a0e4ca01 | cbsinteractive/video-transcoding-api | /provider/bitmovin/internal/status/status.go | Go | go | 2,264 | permissive | package status
import (
"fmt"
"time"
"github.com/bitmovin/bitmovin-api-sdk-go"
"github.com/bitmovin/bitmovin-api-sdk-go/model"
"github.com/bitmovin/bitmovin-api-sdk-go/query"
"github.com/cbsinteractive/video-transcoding-api/provider"
"github.com/pkg/errors"
)
// ToProviderStatus maps Bitmovin's status to the ... |
0c1b3bb8dd5f47b2bc0f2cd831ed25f1256126c5 | 37cc84e43f7a3451f5826094cc34fdfadd9c620c | Ghlens/go-dhcpd-leases | /lease.go | Go | go | 5,192 | permissive | package leases
import (
"bufio"
"bytes"
"net"
"regexp"
"strings"
"time"
)
/*
Lease format specified in man(5) dhcpd.leases
- See https://linux.die.net/man/5/dhcpd.leases or similar
A Lease contains the data specified in the following format:
172.24.43.3 {
starts 6 2019/04/27 03:24:45;
ends 6 2019/04/27 ... |
d38c700d68087f473bcfea6550d667d7fa5e03e2 | ef28d805e7464f17092e8b44c4075251d6b48c47 | HritvikM/terrascan | /test/e2e/server/server_remote_scan_test.go | Go | go | 20,439 | permissive | /*
Copyright (C) 2020 Accurics, 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 wr... |
68dbc767bc906995ed282f2dfd8becbaebf53026 | 6a8e9a08d9f401c19c24f8b871be5d5c6d8e0fec | onego-project/onego | /blueprint/ClusterBlueprint.go | Go | go | 705 | no_license | package blueprint
import "strconv"
// ClusterBlueprint to set Cluster elements
type ClusterBlueprint struct {
Blueprint
}
// CreateUpdateClusterBlueprint creates empty ClusterBlueprint
func CreateUpdateClusterBlueprint() *ClusterBlueprint {
return &ClusterBlueprint{Blueprint: *CreateBlueprint("TEMPLATE")}
}
// Se... |
2aa783aaeff1037a561b036bf501cec4adc86360 | f8e0f35c5136d5a11d54be9d27811d747842cbd2 | yroffin/cds | /engine/api/workflow/workflow_run_event.go | Go | go | 7,593 | permissive | package workflow
import (
"context"
"fmt"
"sort"
"time"
"github.com/fatih/structs"
"github.com/go-gorp/gorp"
"github.com/ovh/cds/engine/api/cache"
"github.com/ovh/cds/engine/api/event"
"github.com/ovh/cds/engine/api/repositoriesmanager"
"github.com/ovh/cds/engine/api/tracing"
"github.com/ovh/cds/sdk"
"gi... |
496d59369840a4f78674912abb7427b98a0a174d | ac59e2d667da8d97cb3b0bf2c962bb4194848fec | cbroglie/cloudprober | /rds/gcp/pubsub.go | Go | go | 5,970 | permissive | // Copyright 2018 The Cloudprober 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... |
71a8779dac1a2d9982d538a576b4ac904f5c4d0d | 231e064a78a54e3161dab52878174b23450aca92 | backwardn/go-wireless | /api/handlers.go | Go | go | 964 | permissive | package api
import (
"github.com/gin-gonic/gin"
"github.com/theojulienne/go-wireless"
)
func notImplemented(c *gin.Context) {
c.AbortWithStatus(501)
}
func json(err error) map[string]string {
return map[string]string{"error": err.Error()}
}
func listInterfaces(c *gin.Context) {
c.JSON(200, wireless.Interfaces(... |
a252508c8f45429e27d3a2b14bc2f1aee641663e | f636a365872ad58fe98a0b0c363575a330e59c62 | makem/go-stars | /src/repository/employees/employees_test.go | Go | go | 4,614 | no_license | package employees_test
import (
. "domain"
"fmt"
//. "github.com/ahmetalpbalkan/go-linq"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
e "repository/employees"
g "repository/geography"
"storage"
"testing"
"time"
)
func TestEmployee(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Employee Re... |
8eed5b148fb5bdb090629c708988c1e5c6987994 | 176026a0c911efc97e2b80e19671594e3815ae84 | Mr-ZhuXingYi/go-gin | /src/classes/User.go | Go | go | 1,010 | no_license | package classes
import (
"fmt"
"github.com/gin-gonic/gin"
"go-gin/src/Model"
"go-gin/src/goft"
)
type UserClass struct {
*goft.GormAdapter
Age *goft.Value `prefix:"user.source"`
}
func NewUserClass() *UserClass {
return &UserClass{}
}
func (this *UserClass) UserList(context *gin.Context) string {
var c int
... |
61d25bfe451c324a5411e3179feb22034e8ffdac | 5a53b1c1c29a30d712753ea6cc0a49ef0b40790f | gdm85/irc | /log.go | Go | go | 1,481 | permissive | package irc
import (
"log"
)
// Simple logger interface designed for use with logrus
// and other similar systems
type Logger interface {
Debug(args ...interface{})
Info(args ...interface{})
Warn(args ...interface{})
Error(args ...interface{})
Fatal(args ...interface{})
Print(args ...interface{})
}
// AKA Bla... |
54211d1d752db88085dc11843b955b798cf820e6 | b2658742b9088af96c1280d221d5f192767aefae | ajesse11x/pipeline | /internal/platform/gin/drain.go | Go | go | 2,857 | permissive | // Copyright © 2018 Banzai Cloud
//
// 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 ... |
e0fa572ce2758dd524ec48b44ecb5a1baf532d32 | cc580ce1e45ea2528968a9b7f0c8992ed37335fd | hurner/leetcode-go | /0883-projection-area-of-3d-shapes/main.go | Go | go | 692 | no_license | package main
import "fmt"
func projectionArea(grid [][]int) int {
if len(grid) == 0 {
return 0
}
elemCnt := len(grid) * len(grid[0])
colMaxSum := 0
rowMaxSum := 0
for i := 0; i < len(grid); i++ {
rowIMax := 0
for j := 0; j < len(grid[0]); j++ {
if grid[i][j] > rowIMax {
rowIMax = grid[i][j]
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.