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 |
|---|---|---|---|---|---|---|---|---|
9232f06cfc89c3f4f6e55310d4abc6c6dbf6ed5d | 7f18965d3de575fe251b12bb59e4fae7a75d05a2 | eryozkn/learning-go | /archive/volkan.io/examples/trees/001_tree_depth.go | Go | go | 379 | permissive | package main
import "fmt"
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func max(x int, y int) int {
if x < y {
return y
}
return x
}
func maxDepth(root *TreeNode) int {
if root == nil {
return 0
}
return 1+max(maxDepth(root.Left), maxDepth(root.Right))
}
func main() {
node := Tr... |
edb86e03876ccb64342663cc223a190f5514422f | 74b73ec4f90a76402c159b938e79e6882676463a | apsdsm/spriteSlice | /main.go | Go | go | 2,273 | no_license | package main
import (
"fmt"
"image"
"image/png"
"os"
"path"
"strconv"
"strings"
)
func main() {
if len(os.Args) < 4 {
fmt.Println("usage: spriteSplice [imagename] [tile width] [tile height]")
os.Exit(0)
}
// get args
pathToImg := os.Args[1]
tileW, _ := strconv.Atoi(os.Args[2])
tileH, _ := strconv.A... |
f2e7d896fe46a7fa7547a08e8a70cdfdcba22b64 | 510ca886433d022f9bccef70514aaff3d85add97 | guanqun/cockroach | /sql/plan.go | Go | go | 10,593 | 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... |
800f576341e132c605df918a58cbadc32505dfc3 | 3a236f1d4fd442ecf5b3f7bdb3f141c8ef7052a5 | GLYASAI/mysql-operator | /pkg/controllers/cluster/controller.go | Go | go | 23,326 | permissive | // Copyright 2018 Oracle and/or its affiliates. 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 requ... |
2c230810e2aacb717276e05e0ecf0fe3fc807f89 | 3952bbecab1f78b00d8f8b7428ff5c1c05bd8d8e | bcbchain/thirdparty | /github.com/muesli/cache2go/cachetable.go | Go | go | 8,708 | permissive | /*
* Simple caching library with expiration capabilities
* Copyright (c) 2013-2017, Christian Muehlhaeuser <muesli@gmail.com>
*
* For license see LICENSE.txt
*/
package cache2go
import (
"log"
"sort"
"sync"
"time"
)
// CacheTable is a table within the cache
type CacheTable struct {
sync.RWMutex
// ... |
9fa9a58e40a74800889725c549635fd1fc85d31d | f79824bdce36475b40cc924d5e97873508d8452a | imjenal/flamingo_romancalc | /internals/romancalculator/romanconverter_test.go | Go | go | 2,033 | no_license | package romancalculator
import "testing"
func TestToRoman(t *testing.T) {
tests := []struct {
name string
number int
roman string
}{
{
name:"when number is 0",
number:0,
roman: "",
},
{
name:"when number is 1",
number:1,
roman: "I",
},
{
name:"when number is 1993",
number:199... |
cb3a90a575da02cd12a7cc0c294fe908ef2126ce | 0ad905c311f2c9c623d1f2692a30d0791f4575cd | Charlo270398/tfg | /golang-web/cliente-golang/routes/clinica.go | Go | go | 6,347 | no_license | package routes
import (
"bytes"
"encoding/json"
"html/template"
"log"
"net/http"
util "../utils"
)
//form añadir especialidad desde admin
func addClinicaFormGadminHandler(w http.ResponseWriter, req *http.Request) {
session, _ := store.Get(req, "userSession")
// Check if user is authenticated
if auth, ok := ... |
75fe27cc31a4d54bcaeaa2fa94a5588aac0d765d | b38af70dc93684935a080f266089ef57ee8643f6 | QOSGroup/litewallet | /litewallet/client/config/toml.go | Go | go | 1,969 | permissive | package config
import (
"bytes"
"os"
"text/template"
"github.com/spf13/viper"
)
const defaultConfigTemplate = `# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml
###############################################################################
### ... |
d093e46ceeeb83713e86916c57fda645653809b6 | 4d7b3d8bfdb69ed879b0ed34574a43171cebc253 | alejolesor/Api-Marvel | /cmd/ApiMarvel/main.go | Go | go | 544 | no_license | package main
import (
"log"
"github.com/Api-Marvel/internal/services"
"github.com/Api-Marvel/internal/databases"
"github.com/Api-Marvel/internal/routes"
_ "github.com/go-sql-driver/mysql"
)
func main() {
//gorm.Open("mysql", "lagash:.a@vMztxya.hS6b@tcp(db4free.net:3306)/marketplacelag?charset=utf8&parseTime=... |
e294fceeb4853068522b0871d4f46e3130b4e6d2 | 122743c446082f98342994d358a8da96e99276ce | zzzhangjian/go_ece | /app/model/sys_user/sys_user_entity.go | Go | go | 3,122 | no_license | // ==========================================================================
// This is auto-generated by gf cli tool. You may not really want to edit it.
// ==========================================================================
package sys_user
import (
"database/sql"
"github.com/gogf/gf/database/gdb"
"githu... |
b261f0da6f230b5316e4b4a171e3cfd4e2a829b5 | 4c6214ca918d964a491209a65c3169ddd681efdd | strickyak/c2go | /ast/paren_expr.go | Go | go | 695 | permissive | package ast
import (
"fmt"
"github.com/elliotchance/c2go/program"
)
type ParenExpr struct {
Address string
Position string
Type string
Children []Node
}
func parseParenExpr(line string) *ParenExpr {
groups := groupsFromRegex(
"<(?P<position>.*)> '(?P<type>.*?)'",
line,
)
return &ParenExpr{
Addr... |
553952fe7245cd6468e4ce4413f519691a61a454 | 3b3ff332c634385f58946906bc48fe8867a09506 | Hats-Wang/rook | /pkg/operator/chubao/cluster/master/master_status_test.go | Go | go | 1,078 | permissive | package master
import (
"encoding/json"
"fmt"
"testing"
)
func Test_getStatus(t *testing.T) {
contents := `
{
"code": 0,
"msg": "success",
"data": {
"dataNodeStatInfo": {
"TotalGB": 22225,
"UsedGB": 0,
"IncreasedGB": 0,
"UsedRatio": "0.000"
},
"metaNodeStatInfo": {
... |
eedda69bd1dde0de78d5ffd28ecd54ef0fccad5e | 07c436f67a4a9a0262cbd6f4ab1d028c273d3423 | aboutmoon/block-v4 | /utils.go | Go | go | 419 | no_license | package main
import (
"bytes"
"encoding/binary"
"fmt"
"os"
)
func IntToByte(num int64) []byte {
// func Write(w io.Writer, order ByteOrder, data interface{}) error {
var buffer bytes.Buffer
err := binary.Write(&buffer, binary.BigEndian, num)
CheckErr("IntToByte",err)
return buffer.Bytes()
}
func CheckErr(p... |
595c2e09cc20dd84262e79777265b7fb9d6515b2 | 27a09254eccceedfbb70f4f1c123109f37dbf1de | roca/GO | /pluralsight/go-testing/code7/1_initial/src/poms/ctrl/purchaseOrder.go | Go | go | 1,040 | no_license | package ctrl
import (
"encoding/json"
"net/http"
"strconv"
"github.com/GOCODE/pluralsight/go-testing/code7/1_initial/src/poms/model"
"github.com/gorilla/mux"
)
type PurchaseOrderController struct{}
func (poc *PurchaseOrderController) GetOrder(w http.ResponseWriter, r *http.Request) {
vars := mux... |
401b7e3ea5f0e3fc092529abf18e5d194bf8395f | 6881ed5314c04db7cfe85e9ac8ab9effc247a7eb | WooodHead/gitconvex-server | /tests/git_ls_files_test.go | Go | go | 1,505 | permissive | package tests
import (
"fmt"
"github.com/libgit2/git2go/v31"
git2 "github.com/neel1996/gitconvex-server/git"
"github.com/stretchr/testify/assert"
"os"
"path"
"testing"
)
func TestListFiles(t *testing.T) {
lsFileChan := make(chan *git2.LsFileInfo)
var repoPath string
var r *git.Repository
cwd, _ := os.Getwd... |
b3014d2dafac452e69a16d77f5800f830a58c853 | f625824600f309913b24657e7c8beeb7ea1a38bf | Uzama/golang-practice | /composite_types/slice/main.go | Go | go | 1,129 | no_license | package main
import "fmt"
func main() {
var a []int
var b = []int{1, 2}
a = b
c := b
c = append(c, 8)
e := a
a = append(a, 10)
a[0] = 80
c[0] = 9
c = append(c, 89)
c = append(c, 89)
b[1] = 9000
f := c[1:5]
f = append(f, 90)
f[4] = 23
f[0] = 0
c = append(c, 876)
f = append(f, 33)
f[4] = -3
... |
fd7c3ed62532e801eaee87ef769ec2eb9db62381 | e8685548f09bce1fb608c7b42f8d39614d524426 | Lapinskas/roadrunner | /service/health/service_test.go | Go | go | 6,741 | permissive | package health
import (
"encoding/json"
"io/ioutil"
"net/http"
"testing"
"time"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
"github.com/spiral/roadrunner/service"
rrhttp "github.com/spiral/roadrunner/service/http"
"github.com/stretchr/testify/assert"
)
type testCfg struct {
health... |
239156b269f77fe41914d22a69505937be781ef1 | 183c6b8e7235f692322ac898d2735ca60fa166cc | git-connected/containerd | /integration/util/util_windows.go | Go | go | 5,114 | permissive | /*
Copyright The containerd 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... |
b8c3b2c36aa9476f06c396ac1a515bd289450f68 | 2a8ba94f320945cc2ac05b8ab53fdf20df1a7857 | cortex-media/lorawan-stack | /pkg/networkserver/grpc_deviceregistry.go | Go | go | 14,890 | permissive | // Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// 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
//
// Un... |
5a851f25900b53fc3a67f7df11a7803313a0847a | c43b9c6132a03980a6a8bdd309582f049055b580 | alexisvisco/graphql-proxy-grpc | /internal/virtual/field.go | Go | go | 1,340 | no_license | package virtual
import (
"github.com/alexisvisco/graphql-proxy-grpc/internal/errorx"
changecase "github.com/ku/go-change-case"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/reflect/protoreflect"
)
type Field struct {
Name Name
Type Type
}
func createField(field *protogen.Field, des... |
2da48b41600f9321875c4166b57d8d46ca25b8fe | 77333399814522a6198619fc5b824016c03c0e41 | teng-lin/delve | /proctl/threads_darwin.go | Go | go | 2,011 | permissive | package proctl
// #include "threads_darwin.h"
import "C"
import (
"fmt"
"unsafe"
)
type OSSpecificDetails struct {
thread_act C.thread_act_t
}
func (t *ThreadContext) Halt() error {
var kret C.kern_return_t
kret = C.thread_suspend(t.os.thread_act)
if kret != C.KERN_SUCCESS {
return fmt.Errorf("could not susp... |
d3925613931eebc985eb9d4038b911d87dbcc93a | d0cc321ab8738da52376e6168cd56cff7b0a0115 | kiki-ki/go-test-example | /internal/testutil/handler.go | Go | go | 1,600 | no_license | package testutil
import (
"bytes"
"context"
"encoding/json"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/go-chi/chi/v5"
"github.com/stretchr/testify/assert"
)
type AssertResponseWant struct {
StatusCode int
Body string
}
func AssertResponse(t *testing.T, got *http.Response... |
587c2b23d86452e131b5c802a23ebf7736cff9db | a17e09d1f036d4ca2872bcd5cc9d3c3fd03287fe | predix-analytics/conda-buildpack | /src/python/pyfinder/manage_py_finder_test.go | Go | go | 3,175 | permissive | package pyfinder_test
import (
"io/ioutil"
"os"
"path/filepath"
. "python/pyfinder"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("ManagePyFinder", func() {
var (
tempDir string
finder ManagePyFinder
err error
)
BeforeEach(func() {
tempDir, err = ioutil.TempDir("", "... |
f9d697d2f05defdb856261ff1f8f72c5bfeded70 | 9b85813a03b2295bb0be01c4521b53aba8625f91 | tlfmonster/erupe-1 | /network/mhfpacket/msg_mhf_cancel_guild_scout.go | Go | go | 767 | permissive | package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
)
// MsgMhfCancelGuildScout represents the MSG_MHF_CANCEL_GUILD_SCOUT
type MsgMhfCancelGuildScout struct {
AckHandle uint32
InvitationID uint32
}
// Opcode returns the ID associated with this packet type.
func (... |
e04c59a6e4ea21e63c3e8451822e0c597d8a511b | bf3872c0b2316507a74d1208920db29ae2dfd0e3 | centrifuge/go-substrate-rpc-client | /rpc/system/properties_test.go | Go | go | 933 | permissive | // Go Substrate RPC Client (GSRPC) provides APIs and types around Polkadot and any Substrate-based chain RPC calls
//
// Copyright 2019 Centrifuge GmbH
//
// 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 th... |
8900dda7ba1c34c9ce65403b31e5c187f36bc00f | cdfc1b4a5f407d3c372502a38b65c1015d197f19 | mantishK/xendit-go | /example/cardlesscredit/main.go | Go | go | 1,445 | permissive | package main
import (
"fmt"
"log"
"os"
"time"
"github.com/joho/godotenv"
"github.com/xendit/xendit-go"
"github.com/xendit/xendit-go/cardlesscredit"
)
func main() {
godotenvErr := godotenv.Load()
if godotenvErr != nil {
log.Fatal(godotenvErr)
}
xendit.Opt.SecretKey = os.Getenv("SECRET_KEY")
createPayme... |
5f7ee61a73d1f6f5fc9c1cde361e6b652ad8eea5 | da82647b0cfe881b7b7cb7ca640d76f6d19367d5 | rainzm/onecloud | /pkg/multicloud/objectstore/objectstore.go | Go | go | 17,120 | permissive | // Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
4a1195cf420ad398f14767aae19310cc21f54d38 | f58636a48e7791d1478f0b4d27c824db068a9516 | miraikeitai2020/backend-file-proxy | /scripts/keys/keyGen.go | Go | go | 666 | no_license | package main
import (
"crypto/rand"
"crypto/sha256"
"encoding/hex"
"fmt"
"log"
"time"
)
const (
KEY_DIGIT = 32
)
var (
secret string
)
func init() {
base := sha256.Sum256([]byte(time.Now().String()))
secret = hex.EncodeToString(base[:])
}
func main() {
public, err := makePublicKey()
if err != nil {
l... |
96d3b13d3e953c5928a58c182b226b5b281e5e3f | c98753005f82c7fac5db7f9f1759950ffef07a14 | codelieche/cronjob | /backend/worker/register.go | Go | go | 2,967 | permissive | package worker
import (
"errors"
"fmt"
"os"
"github.com/levigross/grequests"
"github.com/codelieche/cronjob/backend/common/datamodels"
"github.com/codelieche/cronjob/backend/common"
)
// 注册节点信息到master
type Register struct {
Info *datamodels.Worker // Worker节点的信息
//Name string `json:"name"` // 节点的名称... |
2bbb57a7fb666495e78379f14f5ff7a2203ec1d6 | eb3faf44346f3fb80682c73850df0ed66ace780d | cafeliker/harbor | /src/core/config/config_test.go | Go | go | 9,644 | permissive | // Copyright 2018 Project Harbor 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 agr... |
2605338b6655e0b182428e935f7daa9e85961fb0 | ea9a4fa0256896d0e08f2bf66d002237344408ef | huasxiaopeng/golang-examples | /09异常处理/024错误处理.go | Go | go | 979 | no_license | package main
import "fmt"
/**
Go提供的recover机制:由运行时抛出,或者开发者主动触发的panic,可以使用defer和recover实现错误捕捉和处理,让代码在发生崩溃后允许继续执行。
在其他语言里,宕机往往以异常的形式存在,底层抛出异常,上层逻辑通过try/catch机制捕获异常,没有被捕获的严重异常会导致宕机,
捕获的异常可以被忽略,让代码继续执行。Go没有异常系统,使用panic触发宕机类似于其他语言的抛出异常,recover的宕机恢复机制就对应try/catch机制
panic和defer的组合:
有panic没有recover,程序宕机
有panic也有recover,程序不会... |
8a1e2a13fd5d43f795bdb97270f42ca2de612027 | fcc78a559b90d4de04ef052b830c966abe9f4c7e | knative/eventing | /vendor/knative.dev/pkg/webhook/psbinding/psbinding.go | Go | go | 11,488 | 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... |
442aba0845a93d6b5cd68dcad876cddd69c2bd36 | f5d576aad4a0cd5f55ee65a0a5e811842ce841cb | patdhlk/raytracer | /Raytracing/ball.go | Go | go | 2,523 | permissive | //Package Scene
package scene
import (
objects "de/vorlesung/projekt/raytracer/SceneObjects"
)
//a ball implementation
type Ball struct {
sphere *objects.Sphere
color *objects.Vector
diffuse float64
specularIntensity float64
specularPower float64
reflectivity float64
}... |
236357a91276c5e99d04b47e8205ada35255835d | 80364a47262dc89fbd94fcb7fabea2c3cfd61476 | kissthefire/fabric | /core/scc/lscc/deployedcc_infoprovider_test.go | Go | go | 4,014 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package lscc_test
import (
"testing"
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric/core/common/ccprovider"
"github.com/hyperledger/fabric/core/common/privdata"... |
abded96a5e0ff1c3ddc808bf1caa10fdddf1720f | 8a49a6f252504f2a445e6df1b356cf7dea2d1e93 | reheroad/gf | /database/gdb/gdb.go | Go | go | 18,284 | permissive | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
// Package gdb provides ORM features for popular relationship d... |
1251daee4048d0104236af126112a6cdc498b378 | b5c6a4abaed98f84ce2b4dc69d74d5b58ef98c7e | livio-a/zitadel | /internal/admin/repository/eventsourcing/handler/label_policy.go | Go | go | 3,435 | permissive | package handler
import (
"github.com/caos/logging"
"github.com/caos/zitadel/internal/domain"
"github.com/caos/zitadel/internal/eventstore/v1"
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
"github.com/caos/zitadel/internal/eventstore/v1/query"
"github.com/caos/zitadel/internal/eventstore/v1/s... |
227fa766006afa70c2bc6148efb1b67df89bc2b6 | 5e13c580c9d382c06e685db3c9ed1e1862c655ba | leanlabsio/blacksmith | /logger/entry.go | Go | go | 1,031 | no_license | package logger
import (
"fmt"
"time"
)
type LogEntry struct {
ID string `json:"id"`
Name string `json:"name"`
StartTime Timestamp `json:"start_time"`
Duration time.Duration `json:"duration"`
Event Event `json:"event"`
State string `json:"state"`
writer *... |
929a82217fd5b8a37af83f2830ef36af7a8b1b17 | 221161ad658384afc8898160d95fde81c2f4c3bb | elves/elvish | /pkg/edit/instant.go | Go | go | 1,127 | permissive | package edit
import (
"src.elv.sh/pkg/cli"
"src.elv.sh/pkg/cli/modes"
"src.elv.sh/pkg/cli/tk"
"src.elv.sh/pkg/eval"
"src.elv.sh/pkg/parse"
)
func initInstant(ed *Editor, ev *eval.Evaler, nb eval.NsBuilder) {
bindingVar := newBindingVar(emptyBindingsMap)
bindings := newMapBindings(ed, ev, bindingVar)
nb.AddNs(... |
42860a9ed11e63fd948903e62097d6c5119bb5f7 | 872c667083ec2f1f201a076b3bb55d1ea543d9a4 | mingderwang/ixo-blockchain | /x/did/client/cli/query.go | Go | go | 3,898 | permissive | package cli
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/ixofoundation/ixo-blockchain/x/did/exported"
"github.com/ixofoundation/ixo-blockchain/x/did/internal/keeper"
"github.com/ixofoundation/ixo-blockchain/x/did/internal/types"
"github.com/pkg/er... |
2716d6993a2d18c1c7b7eb5156a36bb4fb8808c0 | 1b06e7b09b26c53d28cbb232db6e69267db5930c | wzqnls/nirvana-practice | /pkg/apis/install.go | Go | go | 900 | no_license | package apis
import (
"github.com/caicloud/nirvana"
"github.com/caicloud/nirvana/definition"
"github.com/caicloud/nirvana/plugins/reqlog"
"github.com/caicloud/nirvana-practice/pkg/apis/v1alpha1/descriptors"
)
// Install configures the given Nirvana Config object with the API Descriptor.
func Install(config *nirv... |
43cfc18110ae8a1379c78c228a5a6b7252c391bb | f20ac28d01e380799f88cda5b753fbb882053a6c | subham-deepsource/clockify-cli | /cmd/suggestions.go | Go | go | 3,410 | permissive | package cmd
import (
"fmt"
"strings"
"github.com/lucassabreu/clockify-cli/api"
"github.com/lucassabreu/clockify-cli/cmd/completion"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
func suggestWithClientAPI(
fn func(cmd *cobra.Command, args []string, toComplete string, c *api.Client) (completion.ValidArgs,... |
dde7e503a727b541a7f339f8ecd7e368bd8ff905 | d0b8fc9a34d30ac1c394b2e85b2af94db2e9637e | wen-hemin/dm | /pkg/binlog/reader/util.go | Go | go | 5,269 | permissive | // Copyright 2020 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... |
12b6113756e1e0b3845297be5b51cbbfff0b23bb | ffde7f57b2b3aac81b352a1c39cbe7daff822779 | ytx0574/go-Demos | /LearnGoProject/demo35_DataStructure/binary_search_tree/binarySearchTree.go | Go | go | 1,551 | no_license | package binary_search_tree
import (
"fmt"
"go-Demos/LearnGoProject/demo35_DataStructure/linked_list"
)
//二叉查找树特性:
//所有左侧子节点都比根节点小, 所有右侧子节点都比根节点大
//https://zhuanlan.zhihu.com/p/37470148
func BinaryTree() (root *linked_list.BinaryNode) {
// A
// B C
//D E F G
// H
begin := int(byte('A'))
end := int(byte('... |
79ec29ca629ffb811c4de16c4765e8c7654af7c6 | 84fddcb0c1d05ac62cdf3887c54024fd9d1c3de5 | jcmanzo/hound | /vcs/git.go | Go | go | 2,377 | permissive | package vcs
import (
"bytes"
"encoding/json"
"fmt"
"io"
"log"
"os/exec"
"path/filepath"
"strings"
)
const defaultRef = "master"
func init() {
Register(newGit, "git")
}
type GitDriver struct {
Ref string `json:"ref"`
}
func newGit(b []byte) (Driver, error) {
d := &GitDriv... |
966529ec6611cb78ae000026ca67dab20e0add75 | 5edeafae2985e2124e42db3a28efd1c7ca0dec8f | mbattyani/enkit | /lib/kflags/kconfig/commandretriever_test.go | Go | go | 3,087 | permissive | package kconfig
import (
"github.com/enfabrica/enkit/lib/cache"
"github.com/enfabrica/enkit/lib/khttp/ktest"
"github.com/enfabrica/enkit/lib/logger"
"github.com/enfabrica/enkit/lib/retry"
"github.com/stretchr/testify/assert"
"io/ioutil"
"testing"
)
func TestCommandRetrieverHash(t *testing.T) {
tmpdir, err := ... |
dac809da2f82b610f7874d336b5c94eec25fb80e | 77ccdfc3ed13af5a9258df1ca69781eb699d8af5 | michel-zededa/eve | /pkg/pillar/devicenetwork/devicenetwork.go | Go | go | 16,412 | permissive | // Copyright (c) 2017 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0
package devicenetwork
import (
"crypto/tls"
"errors"
"fmt"
"github.com/eriknordmark/ipinfo"
"github.com/eriknordmark/netlink"
"github.com/lf-edge/eve/pkg/pillar/hardware"
"github.com/lf-edge/eve/pkg/pillar/types"
"github.com/lf-edge/eve... |
1c4813d09ed0b852454795f3541bd77a4b6db354 | 2d1c9bdd97f5f3a678d9c871659bff31564cb465 | kurkop/gojobs | /internal/jobs/storage/inkube/jobsKube.go | Go | go | 3,063 | no_license | package inkube
import (
"context"
"log"
"sync"
"github.com/kurkop/gojobs/internal/jobs"
"k8s.io/client-go/kubernetes"
batchv1 "k8s.io/api/batch/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type goJobsRepository struct {
goJobs map[string]jobs.GoJob
client *kubernetes.Clientset
}
var (
goJobsOnce ... |
6d294093054a820dd8736b06600c86167da305ea | 30545088674b37b9211672ebe28863be977c27d1 | jag-123/Robot-Bartender | /backend/main.go | Go | go | 4,396 | no_license | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"os/user"
"path/filepath"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
"golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/api/sheets/v4"
)
... |
4e5adb0ac201626f492fe91fb0900e37beef916b | f781dd44f0f50dc3d9c2d92415bb5d493d1ed71b | immunant/android_build_soong | /android/package_ctx.go | Go | go | 8,293 | no_license | // Copyright 2015 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... |
20d3c5d74843f0381ed1414c3003a6d036b14d03 | 2f65900186b102802035cacfb3f108a61b137392 | ntolia/kopia | /internal/units/units.go | Go | go | 1,474 | permissive | package units
import (
"fmt"
"strings"
)
var base10UnitPrefixes = []string{"", "K", "M", "G", "T"}
var base2UnitPrefixes = []string{"", "Ki", "Mi", "Gi", "Ti"}
func niceNumber(f float64) string {
return strings.TrimRight(strings.TrimRight(fmt.Sprintf("%.1f", f), "0"), ".")
}
func toDecimalUnitString(f, thousand ... |
3d45e4eb4acf3fe21058a1c4bbed68b6160d9fff | d26f21d54a2f4e80011b537f55f468941133d128 | lthibault/go-ipfs | /core/corehttp/gateway_handler.go | Go | go | 17,428 | permissive | package corehttp
import (
"context"
"fmt"
"io"
"mime"
"net/http"
"net/url"
"os"
gopath "path"
"regexp"
"runtime/debug"
"strings"
"time"
humanize "github.com/dustin/go-humanize"
"github.com/ipfs/go-cid"
files "github.com/ipfs/go-ipfs-files"
dag "github.com/ipfs/go-merkledag"
mfs "github.com/ipfs/go-mf... |
354982a29d254d4bac9fd5dad7963fbcf6f3aede | 8f23a96f17d7177a4a01b42bbda6f52f3bceed3d | kometchtech/mackerel-agent-plugins | /mackerel-plugin-fluentd/lib/fluentd.go | Go | go | 4,830 | permissive | package mpfluentd
import (
"crypto/md5"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net/http"
"os"
"regexp"
"strings"
mp "github.com/mackerelio/go-mackerel-plugin-helper"
)
// FluentdMetrics plugin for fluentd
type FluentdMetrics struct {
Target string
Tempfile string
pluginType strin... |
edbb5ae1f152bf0578e224b527131c61ad9360ba | b532751bb1a7d846692eb63498501df4b2df38c0 | krishtalyo/letsEncryptHandler | /main.go | Go | go | 736 | no_license | package main
import (
"crypto/tls"
"log"
"net/http"
"golang.org/x/crypto/acme/autocert"
)
func main() {
certManager := autocert.Manager{
Prompt: autocert.AcceptTOS,
HostPolicy: autocert.HostWhitelist("tdirect.msk.ru"), //Your domain here
Cache: autocert.DirCache("./certs"), //Folder f... |
a1cf64cea8fdf6b358b1907f12c11a640e3ba5c3 | 69ae7ea1984f52c64ca7f9b7bd70419181c6d79b | NoelToby/skia | /infra/bots/gen_tasks.go | Go | go | 58,448 | permissive | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package main
/*
Generate the tasks.json file.
*/
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"regexp"
"runti... |
5c2016fc9c4d7df71a0b49192c9bf43fe896cb1e | 0d55b98342fe6167e3ea563503e626eabc15c969 | huaweicloud/huaweicloud-sdk-go-v3 | /services/ugo/v1/model/model_check_permission_response.go | Go | go | 439 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// CheckPermissionResponse Response Object
type CheckPermissionResponse struct {
HttpStatusCode int `json:"-"`
}
func (o CheckPermissionResponse) String() string {
data, err := utils.Marshal(o)
if err != nil {
return... |
8a1718e0f98238e1481b7f42b293f2453587490c | 70a6af60aa6a740bfcf025c3f42cf1e20eaaf289 | ldsink/LeetCode | /76-minimum-window-substring.go | Go | go | 1,073 | permissive | package main
func minWindow(s string, t string) string {
tr := []rune(t)
characters := make(map[rune]int)
for _, r := range tr {
characters[r] += 1
}
position := make(map[rune][]int)
sr := []rune(s)
for i, r := range sr {
if characters[r] == 0 {
continue
}
position[r] = append(position[r], i)
}
i... |
9bac575799536791af05c9dadcc76ad18827b995 | 9a111abf17cf91686057cb3d68306ce3458f0993 | threkk/go-vs-php-benchmark | /go/main.go | Go | go | 4,920 | no_license | package main
import (
"fmt"
"os"
"runtime"
"sort"
"sync"
"time"
)
const corpusRoute = "./corpus"
const xRoute = "./corpus-x"
var numCPU = runtime.NumCPU()
var lock = sync.RWMutex{}
var xs []string
var corpus []Tuple
var err error
func indexOf(arr []string, element string) int {
for index, value := range arr... |
af08f2a1c2f3529cd6bb0cd3d75a1c44a9912c71 | 5ecd61097a4a4a0fdcdc9c890300d2d1229ee936 | mairin/libpod | /test/e2e/mount_test.go | Go | go | 13,508 | permissive | package integration
import (
"os"
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman mount", func() {
var (
tempdir string
err error
podmanTest *PodmanTestIntegration
)
BeforeEach(fu... |
0e8ff879d6e617a03598bfea93919eddec32d8ea | c96507daabe5d8ce9e787ecf2273bcde092bb666 | jbrette/runtime | /virtcontainers/sandbox.go | Go | go | 64,193 | permissive | // Copyright (c) 2016 Intel Corporation
// Copyright (c) 2020 Adobe Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
package virtcontainers
import (
"context"
"fmt"
"io"
"math"
"net"
"os"
"strings"
"sync"
"syscall"
"github.com/containerd/cgroups"
"github.com/containernetworking/plugins/pkg/ns"
"github.c... |
6883cfd1b23f3b190b12733a251d5e39d866b124 | e1ccb36fd5563f9ed354396cd6151a753532db1e | han4235/onecloud | /pkg/multicloud/huawei/host.go | Go | go | 7,922 | permissive | // Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
8711853983a5ed62f5e5ee99c98a38d03003ac4b | 997e1c7f4fc20bf1a0235283cfce8d9135c9cc24 | phos-tou-kosmou/leaderboard-bk | /vendor/github.com/simagix/keyhole/mdb/oplog.go | Go | go | 1,433 | permissive | // Copyright 2019 Kuei-chun Chen. All rights reserved.
package mdb
import (
"context"
anly "github.com/simagix/mongo-ftdc/analytics"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
// OplogStats stores oplog stats
type OplogStats struct {
Lo... |
9f548165a9bf0301897fd18f29a03b469ad6ba10 | 436dcdc69907e19cd253f476e434c751f05e53fc | krishnasrinivas/minio-fs | /routers.go | Go | go | 3,218 | permissive | /*
* Minio Cloud Storage, (C) 2015 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 applicable la... |
76350510e44e783d48188dd6fc1570fa808599e6 | e8ed5aef68eb306c9510dd8cc915eefc14ad66c5 | bigkevmcd/kustomapp-api | /internal/cmd/root.go | Go | go | 1,201 | permissive | package cmd
import (
"log"
"os"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
const (
pathFlag = "path"
)
func init() {
cobra.OnInitialize(initConfig)
}
func logIfError(e error) {
if e != nil {
log.Fatal(e)
}
}
func initConfig() {
viper.AutomaticEnv()
}
func ... |
255ef495cb34798076acc6fa3ad6f9811ecef410 | 5d04cd78c4f6c5bf72555d3717e60f2e3832b575 | bRRRITSCOLD/bookstore_items-api | /domain/items/items_dao.go | Go | go | 2,528 | no_license | package items_domain
import (
elasticsearch_client "bookstore_items-api/clients/elasticsearch"
queries_domain "bookstore_items-api/domain/queries"
"encoding/json"
"fmt"
"strings"
errors_utils "github.com/bRRRITSCOLD/bookstore_utils-go/errors"
)
const (
ITEMS_ELASTICSEARCH_INDEX = "items"
ITEM_ELASTICSEARCH... |
65d4c7433f483e2349c4ae0d16f7fbd85f6a4cd5 | 2f4c14339f031f1c90870dfafaa74fcdbadf968c | BrandonEchols/common-go-utils | /routing/JwtAuthenticator.go | Go | go | 11,466 | no_license | package routing
import (
"crypto/rsa"
"errors"
"strings"
"encoding/base64"
"fmt"
jwtgo "github.com/dgrijalva/jwt-go"
)
var EXPIRED_TOKEN_ERR error = errors.New("expired")
var MISSING_TOKEN_ERR error = errors.New("missing")
var WITHHELD_TOKEN_ERR error = errors.New("withheld")
const RSA_PUB_BEG_COMMENT = "----... |
6743a45b693eab0806bf2c684494d052f665b062 | 4c3c4d1eababb4c1181a6b1e224f1966ffd1d359 | shimmeringbee/controller | /state/gateway_mux.go | Go | go | 3,006 | permissive | package state
import (
"context"
"github.com/shimmeringbee/da"
"github.com/shimmeringbee/da/capabilities"
"sync"
"time"
)
type GatewayMapper interface {
Gateways() map[string]da.Gateway
Capability(string, da.Capability) interface{}
Device(string) (da.Device, bool)
GatewayName(da.Gateway) (string, bool)
}
va... |
26fce97cde53a79d1b68c408b5cbc70c7866c335 | 14dc7937faa01c32857cfe87789eb9a79e32c7a5 | hunterhawk/gopl-exercises | /sandbox/ch1/fetch/fetch.go | Go | go | 536 | no_license | // Fetch prints the content found at a URL.
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
for _, url := range os.Args[1:] {
if !strings.HasPrefix(url, "http://") {
url = "http://" + url
}
resp, err := http.Get(url)
if err != nil {
fmt.Fprintf(os.Stderr, "fetch: %v\n", ... |
99d83dd43eeddb9f1cb928fe8aacd32f88a8c54b | f9b63a38d9cb03431e7c28e26561a6753f440371 | go-hep/hep | /hbook/ntup/ntcsv/ntcsv.go | Go | go | 2,520 | permissive | // Copyright ©2017 The go-hep 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 ntcsv provides a convenient access to CSV files as n-tuple data.
//
// Examples:
//
// nt, err := ntcsv.Open("testdata/simple.csv")
// if err ... |
41aa77c88085fb8db356accafaefabd1f88a5d61 | abda23d2788fad974b9e06dea4da3ae8a5329b0c | seka/mutexmaps | /mutexmultimap/mutexmultimap_test.go | Go | go | 3,899 | permissive | package mutexmultimap
import (
"reflect"
"testing"
)
func TestMutexMultiMapNew(t *testing.T) {
m := New(1)
if !m.IsEmpty() {
t.Fatal("length should be 0:", m.Len())
}
}
func TestMutexMultiMapClear(t *testing.T) {
m := New(1)
m.Put("a", "value")
if l := m.Len(); l != 1 {
t.Fatal("invalid length:", l)
}
... |
0af6eb0cc2efb17b218862dd0fa7ae9dba5d2238 | 9c997791c7191e439973af0a5b1f51c62b45735a | TIERS/rclgo-msgs | /logging_demo/srv/ConfigLogger.gen.go | Go | go | 1,477 | permissive | /*
This file is part of rclgo
Copyright © 2021 Technology Innovation Institute, United Arab Emirates
Licensed under the Apache License, Version 2.0 (the "License");
http://www.apache.org/licenses/LICENSE-2.0
*/
/*
THIS FILE IS AUTOGENERATED BY 'rclgo-gen generate'
*/
package logging_demo_srv
/*
#cgo LDFLAGS: -L/o... |
287be7ae2bc4db26d5f4f3fd807413558dc1e392 | 29f4bb586088588661e014893b608158b18cbafb | A-tilol/atcoder | /abc/179/a/main.go | Go | go | 1,428 | no_license | package main
import (
"bufio"
"fmt"
"io"
"log"
"os"
"strconv"
)
func main() {
s := readString()
if s[len(s)-1] == 's' {
fmt.Println(s + "es")
} else {
fmt.Println(s + "s")
}
}
var readString func() string
func init() {
log.SetFlags(log.Lshortfile)
readString = newReadString(os.Stdin)
}
func newRead... |
d0788dbf963e9b40b7e2d2c4b5d87615b98f367b | 8c8a41cb880e2d44daf2573c31e16b503715dbe6 | phpyandong/opentaobao | /model/tmallservice/AlibabaServicecenterSpserviceorderQueryResult.go | Go | go | 557 | permissive | package tmallservice
// AlibabaServicecenterSpserviceorderQueryResult
type AlibabaServicecenterSpserviceorderQueryResult struct {
// 分页数据
ResultData *Paged `json:"result_data,omitempty" xml:"result_data,omitempty"`
// 是否成功
Success bool `json:"success,omitempty" xml:"success,omitem... |
f0c7bcb80f5318b033936da9d93d82815f8c66ac | cfca46689b292596c1f4affaac2ea430954129ea | isabella232/nmcd | /database/ldb/operational_test.go | Go | go | 16,579 | permissive | // Copyright (c) 2013-2014 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package ldb_test
import (
"bytes"
"compress/bzip2"
"encoding/binary"
"io"
"os"
"path/filepath"
"strings"
"testing"
"github.com/melange-app/nmcd/chaincfg"
"git... |
7ac4634b4fbfb78e0fa32d077fec6ba2cfc661d6 | c9bd0f70daa09a51b9cf4f8dbbbb8304b9f79e74 | morrell/pulumi-azure-native | /sdk/go/azure/keyvault/v20200401preview/vault.go | Go | go | 5,484 | 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 v20200401preview
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource information with exte... |
ef864ec8589b745b714123270ab9bd198a10e05e | f8db4f0198d799657ad7b70626e032082e76067f | openshift/installer | /terraform/providers/ibm/vendor/github.com/softlayer/softlayer-go/services/compliance.go | Go | go | 2,358 | permissive | /**
* Copyright 2016 IBM Corp.
*
* 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... |
fcb89b3f0b5e4dd5577f7fba7c5a22b16864f3f9 | a0d4c36f487f009387f08baeafc76af3db0308be | brianbianco/poynt | /handlers.go | Go | go | 3,106 | no_license | package main
import (
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"io"
"net/http"
"os"
"strconv"
"strings"
)
func HomeHandler(w http.ResponseWriter, r *http.Request) {
fmt.Println("Home Handler...")
w.Header().Set("Content-Type", "application/json")
data := make(map[string]string, 2)
data["service"] =... |
edac0a58a673dfdbbd50bac8427cc14e5a04bbb9 | 4ef9ef34c1347403ab74c06c3bf6702ee4615253 | kopia/kopia | /cli/command_logs_cleanup.go | Go | go | 1,417 | permissive | package cli
import (
"context"
"time"
"github.com/pkg/errors"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/repo/maintenance"
)
type commandLogsCleanup struct {
maxTotalSizeMB int64
maxCount int
maxAge time.Duration
dryRun bool
}
func (c *commandLogsCleanup) setup(svc appServ... |
e1ffc3533c68650a61eb8d8ac08f6558893c28d3 | 85950213643eed6dcf122381c6b18ab41e4c94c6 | zgfh/service-catalog | /test/integration/framework.go | Go | go | 6,392 | 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, ... |
90de1dbda18691a0b17e03bf895f107207f96f3a | 1a317d6034e2d28da60c49c6e90630e22c1d8096 | tejas-p-shah/Wall-E | /controllers/user_controller.go | Go | go | 1,953 | no_license | package controllers
import (
"html/template"
"log"
"net/http"
"sort"
"github.com/gorilla/mux"
"github.com/tejas-p-shah/Wall-E/model"
"github.com/tejas-p-shah/Wall-E/services"
)
func GetUserProfile(w http.ResponseWriter, r *http.Request) {
tokenStatus, claims := validate_token(w, r)
if !tokenStatus {
redi... |
5b57f6418bc3a94ff92c2377c83975d43f808b01 | 47540cd398c5b070d4841212a2213c13457da596 | becosuke/tasks-api | /application/grpc/controller/task/task.go | Go | go | 4,601 | no_license | package task
import (
"context"
"google.golang.org/grpc"
service "github.com/becosuke/tasks-api/domain/service/task"
"github.com/becosuke/tasks-api/logger"
pbmessage "github.com/becosuke/tasks-api/protogen/message/task"
pbservice "github.com/becosuke/tasks-api/protogen/service/task"
)
type Server struct{}
fu... |
6734fb6dc1c396b606573c379327b657638ca918 | 7a44bb50fb4a9c4abc0600eea59e4a44da5fb8fe | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/web/latest/getWebAppSiteExtension.go | Go | go | 2,497 | 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 latest
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func LookupWebAppSiteExtension(ctx *pulumi.Context, args *LookupWebAppSiteExtensionArgs, op... |
06458948b3ec770d60fa4631df95a9eeccb99785 | 8f2995a95b754d9a14e43d3327a2bc39334137e8 | AntoineDao/aecdelta-go-server | /go/model_project_role_1.go | Go | go | 223 | no_license | /*
* aecdeltas
*
* The AEC Deltas OpenAPI Spec
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type ProjectRole1 struct {
Role string `json:"role"`
}
|
223a192f39df9051dc3668bc75fcac82172e4c99 | af757d54536849706c4353cc6baced6b124bbdf0 | woniu123456/boringssl | /util/fipstools/acvp/acvptool/subprocess/subprocess.go | Go | go | 6,658 | permissive | // Copyright (c) 2019, Google Inc.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS... |
76eef919e715c79052051f84c47750d70be4fb76 | 9483d082f9131bfffe188cf8d07cba948abd391a | ldeng7/ginx | /ginx/route.go | Go | go | 1,715 | permissive | package ginx
import (
"net/http"
"github.com/gin-gonic/gin"
)
type ICreateController interface {
Create(*G)
}
type IListController interface {
List(*G)
}
type IGetController interface {
Get(*G)
}
type IUpdateController interface {
Update(*G)
}
type IDeleteController interface {
Delete(*G)
}
func AddRoute... |
af1eedfd125f7a9e7a171396f84ffaf6f58e6492 | c7e4c722264af2da3f076fab30e2bdb55deb63c7 | wiliyam/golangapi | /web/routes/v1/guest/deleteHandler.go | Go | go | 1,721 | no_license | package guest
import (
"context"
"fmt"
"golangapi/library/mongodb"
dbmodel "golangapi/models"
"net/http"
"time"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
// "github.com/gin-gonic/gin"
)
//SignInHanlder Guest godoc
// @Summary guest login api
... |
9ac72560744f6e8764f40b845a906a835fa8e587 | 607e38b2bc8afafd037b2a8056595bc196020056 | mzky/dm | /security/zze.go | Go | go | 3,989 | no_license | /*
* Copyright (c) 2000-2018, 达梦数据库有限公司.
* All rights reserved.
*/
package security
import (
"crypto/md5"
"errors"
"fmt"
"reflect"
"unsafe"
)
type ThirdPartCipher struct {
encryptType int // 外部加密算法id
encryptName string // 外部加密算法名称
hashType int
key []byte
cipherCount int // 外部加密算法个数
//inne... |
3974eee1270176ca2ba3d6eb694f434925ac16cb | 2569624f43d9d4ba71daa7fda15f3deb161604f3 | kchodnicki/Projects | /go/src/practice/lis/lis.go | Go | go | 349 | no_license | package main
import "fmt"
func lis(arr []int) []int {
lis := []int{}
for range arr {
lis = append(lis, 1)
}
for i := range arr {
for j := 0; j < i; j++ {
if arr[i] > arr[j] && lis[i] < lis[j]+1 {
lis[i] = lis[j] + 1
}
}
}
return lis
}
func main() {
arr := []int{10, 22, 9, 33, 21, 50, 41, 60, ... |
caae6dcce5ad2fc2e3e257ee79ba994a25395957 | 9e666df9813bba538919c7fde364dcaf6d4aa980 | truetech/hover-ddns | /hover-ddns.go | Go | go | 8,278 | permissive | package main
import (
"errors"
"flag"
"fmt"
"io/ioutil"
"net"
"os"
"os/signal"
"syscall"
"github.com/dschanoeh/hover-ddns/hover"
"github.com/dschanoeh/hover-ddns/publicip"
"github.com/miekg/dns"
"github.com/robfig/cron/v3"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
)
type Config struct {
User... |
c01cc2946155d3f0c667816a0bee7d6e06776351 | 817e2c916dd253b3c62ae66ac760afa46f6eceee | olFi95/go-opencl | /examples/examples.go | Go | go | 678 | permissive | package examples
import "github.com/MasterOfBinary/go-opencl/opencl"
// getFirstDevice returns the first available OpenCL device of type deviceType.
func getFirstDevice(deviceType opencl.DeviceType) opencl.Device {
platforms, err := opencl.GetPlatforms()
if err != nil {
panic(err)
}
for _, platform := range pl... |
51ecd5a7bb0c57bd4fac91484645d5e29a6e584c | 338003eb92de98d7f4db374d95bab59764e721c9 | DataDog/pupernetes | /pkg/setup/setup.go | Go | go | 15,469 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2018 Datadog, Inc.
package setup
import (
"context"
"fmt"
"net"
"net/http"
"os"
"path"
"path... |
bd99ffe1b14d35481de5202216b022bd445682ee | b2dd0a9d75c3fd956a36a5d54d00b9026167536d | mnhkahn/cyeam_post | /parser/cyparser.go | Go | go | 619 | permissive | package parser
import (
"cyeam_post/models"
// "fmt"
. "cyeam_post/logs"
"github.com/astaxie/beego/httplib"
)
type CyParser struct {
RegParser
NormalParser
}
func (this *CyParser) ParseHtml(post *models.Post) ([]string, error) {
Log.Info(post.Link)
// post.Link = this.GetUrl(post.Link)
req := httplib.Get(po... |
28ebbc3335d0c8481ae551b67b783ff8b6e84f15 | d613312fc2663a4fb659eda64503f449f30b7ade | bfayenke/flux2 | /cmd/flux/check.go | Go | go | 5,136 | permissive | /*
Copyright 2020 The Flux 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, softwar... |
586868cc9afe3f686729873a2bd8a2059eca8629 | d6ad04d48e9910ec4d0f2ef77ef260b31f9d1da0 | andrebq/exp | /chipmunk/helloworld_test.go | Go | go | 1,186 | permissive | package chipmunk
import (
"testing"
)
func TestHelloWorld(t *testing.T) {
t.Logf("This is the helloworld from Chipmunk docs.")
t.Logf("No output is required, this should just compile and run.")
gravity := V(0, -100)
space := NewSpace()
space.SetGravity(gravity)
defer space.Free()
ground := NewSegmentShape(... |
06c67ace210abf9c0ade95aca9d074be7b62658b | a12c54816776ab2281fbfc1fbd72937943a0e7a0 | tensor-programming/go-tutorial-12 | /static/test/main.go | Go | go | 4,087 | no_license | package main
import (
"html/template"
"net/http"
"strings"
"github.com/asaskevich/govalidator"
"github.com/gorilla/mux"
"github.com/gorilla/securecookie"
)
var cookieHandler = securecookie.New(
securecookie.GenerateRandomKey(64),
securecookie.GenerateRandomKey(32))
var router = mux.NewRouter()
func indexPa... |
3251e15ebdcf942c6582ba8e66bb8d605918b037 | f4c20506c72f69d5c98d7ac79357060b3de6b20f | zaiji100/gh-ost | /go/logic/migrator.go | Go | go | 54,806 | permissive | /*
Copyright 2016 GitHub Inc.
See https://github.com/github/gh-ost/blob/master/LICENSE
*/
package logic
import (
"fmt"
"io"
"math"
"os"
"strings"
"sync/atomic"
"time"
"errors"
"github.com/fatih/color"
"github.com/github/gh-ost/go/base"
"github.com/github/gh-ost/go/binlog"
"github.com/github/gh-ost/g... |
558cdbda7be52ccbc75ff3fe753643f9e815bc59 | 46b5e2eaab46164da9122363c907d5c65238d6c8 | marbindrakon/origin | /pkg/router/controller/factory/factory.go | Go | go | 15,954 | permissive | package factory
import (
"fmt"
"sort"
"time"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
utilwait "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
"k8s... |
097b2cb36037b0d2a31182197fe578d4f0d0dca3 | 40f161aee43d72dc28ced82a70d97c7d4cc10dfb | Sunset-/galaxy | /model/task.go | Go | go | 1,382 | no_license | package model
import (
"bytes"
"dyzs/galaxy/logger"
"encoding/csv"
"io"
)
const TASK_STATUS_NEW = 0
const TASK_STATUS_RUNNING = 1
const TASK_STATUS_STOP = 2
const TASK_STATUS_DELETED = 99
type Task struct {
ID string `json:"id"`
Name string `json:"name"`
Repository string `json:"repository"`
... |
7ffa3eedb850b5a05b019980791bef874f060e10 | 89d265af4d3d41998e4d47ff2f5cdcc4bf65b786 | apache/dubbo-go | /protocol/protocolwrapper/mock_protocol_filter.go | Go | go | 1,520 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
96470c5d55d5fbd434858cf6a2051b642b7028b4 | c179695f0693bdc9106236088a98f960fcdb632e | mesosphere-backup/edgelb-kubernetes | /vendor/github.com/AsynkronIT/protoactor-go/actor/local_context.go | Go | go | 11,237 | permissive | package actor
import (
"errors"
"time"
"github.com/AsynkronIT/protoactor-go/log"
"github.com/emirpasic/gods/stacks/linkedliststack"
)
type localContext struct {
message interface{}
parent *PID
self *PID
actor Actor
supervisor SupervisorStrategy
prod... |
1fedec291fd986ed83b8f7752c08e8e8f7651f69 | 46684ecf06f0e897573a9243dfbb3e8b89883a51 | FirmaChain/tendermint | /blockchain/v0/pool.go | Go | go | 15,920 | permissive | package v0
import (
"errors"
"fmt"
"math"
"sync"
"sync/atomic"
"time"
cmn "github.com/tendermint/tendermint/libs/common"
flow "github.com/tendermint/tendermint/libs/flowrate"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/types"
)
/*
e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.