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
8eedbe96b3aaa1eefd5ab76aafb1509876a84aaa
90e0319e38c35478e2a409065865e7c07f1e9c6c
google/gvisor
/pkg/sentry/fsimpl/gofer/gofer_test.go
Go
go
2,913
permissive
// Copyright 2020 The gVisor Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
53e7157b4726c359fea18bcaaf1fa2ac5ab7dd75
af8d356fc8696c3062508db5f47755f7c08c88a9
pengzhout/gpbackup
/utils/filepath.go
Go
go
6,319
permissive
package utils /* * This file contains structs and functions used in both backup and restore * related to interacting with files and directories, both locally and * remotely over SSH. */ import ( "fmt" "os" "path" "strconv" "strings" "github.com/greenplum-db/gp-common-go-libs/dbconn" "github.com/greenplum-...
134d39ab5359312fac76aca9962478ad846bce09
afc98a32afb7b7310bdcc931f4aeeee043b1eb11
phantom-rabbit/lotus
/chain/stmgr/stmgr.go
Go
go
43,527
permissive
package stmgr import ( "context" "errors" "fmt" "sync" "sync/atomic" "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" logging "github.com/ipfs/go-log/v2" cbg "github.com/whyrusleeping/cbor-gen" "go.opencensus.io/stats" "go.opencensus.io/trace" "golang.org/x/xerrors" "github.com/filecoin-proj...
c60b80320a1843408a447ce5a08064af976c1a5a
12ede2b297094121fb0bb17d3b29b993af505d82
shkelqimbehluli/go-sdk
/r2/opt_cookie.go
Go
go
393
permissive
package r2 import "net/http" // OptCookie adds a cookie. func OptCookie(cookie *http.Cookie) Option { return func(r *Request) error { r.AddCookie(cookie) return nil } } // OptCookieValue adds a cookie with a given name and value. func OptCookieValue(name, value string) Option { return func(r *Request) error {...
c2cbaf7ce2d1e2f10e6156d45ca9d66707028cef
421c8ff6c3a6eee0680b10f5c76c6dec04861f68
mithro/luci-go
/client/cmd/rpc/call.go
Go
go
4,025
permissive
// Copyright 2016 The LUCI Authors. All rights reserved. // Use of this source code is governed under the Apache License, Version 2.0 // that can be found in the LICENSE file. package main import ( "bytes" "encoding/json" "fmt" "io" "os" "strings" "github.com/maruel/subcommands" "golang.org/x/net/context" "...
3b8460fe987b6d64e2705d6c4c37d1ddb78fd629
c95fcb4fa8ed8e3a57de4a104b17265a98bc1915
mclellac/gossip
/db/postgresql/topic_test.go
Go
go
2,577
permissive
package postgresql import ( "reflect" "testing" "github.com/mclellac/gossip/db" ) func TestTopic(t *testing.T) { s, teardown := getTestStore(t) defer teardown() u1, err := s.Users().New("service1", "uid1") if err != nil { t.Fatalf("failed to create a user: %s", err) } u2, err := s.Users().New("service2",...
1dd1c27db3059d816c4847d462af82fef4366e6f
1f5463ad938324c2e0980a2edd8be30d725bb137
YAWAL/hostDog
/database/dog.go
Go
go
211
no_license
package database import ( "github.com/gofrs/uuid" ) // Dog model properties type Dog struct { DogID uuid.UUID `gorm:"primary_key"` // This is the Dog Model PK field DogName string DogOwner uuid.UUID }
9125e661899517dacae6689e03670fbea7accc20
6e4c5b1af1fd99ee3ba35d4891ec1b98f1dbcbec
rberrelleza/spago
/pkg/ml/ag/fn/dot.go
Go
go
1,724
permissive
// Copyright 2019 spaGO 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 fn import "github.com/nlpodyssey/spago/pkg/mat" var _ Function = &Dot{} // Dot is an operator to perform the dot product over two matrices. // y = x1 ...
c230e0dc5a2d4fafcc9e6595d1c108c11e6eed29
be1e194e3e880f209d3488aac48bb7dcf47f9e1f
Imodel/go
/goWork/demo/20160505/sortInt.go
Go
go
321
no_license
package main import ( "./sort" "fmt" ) func ints() { data := []int{74, 59, 238, -784, 9845, 959, 905, 0, 0, 42, 7586, -5467984, 7586} a := sort.IntArr(data) //conversion to type IntArray sort.Sort(a) if !sort.IsSorted(a) { panic("fail") } fmt.Printf("The sorted array is: %v\n", a) } func main() { ints() }...
a783864ba3276acc1eb9f224e7c8899b41bf74f8
735d8f6b8058b4af055d13ed8329a8bfb608304a
quanduong1999/huntsub-map-server
/vendor/db/mgo/table.go
Go
go
2,774
no_license
package mgo import ( "http/web" "huntsub/huntsub-map-server/x/math" "time" "gopkg.in/mgo.v2/bson" ) type IdMaker interface { Next() string } type Table struct { *UnsafeTable lastModify int } var defaultIdMaker = &math.RandStringMaker{Prefix: "def", Length: 20} func NewTable(db *Database, name string, IdMak...
a8c302786b90b2541aba0f620d7d5ed953d54dac
c55dfa79159ac63e3dc02db8dd9428f31ae09d0c
mickymiek/go-odoo
/api/ir_cron.go
Go
go
1,430
no_license
package api import ( "github.com/skilld-labs/go-odoo/types" ) type IrCronService struct { client *Client } func NewIrCronService(c *Client) *IrCronService { return &IrCronService{client: c} } func (svc *IrCronService) GetIdsByName(name string) ([]int, error) { return svc.client.getIdsByName(types.IrCronModel, n...
1769ff3e340745a1e292565314f31b3654cc642e
8cd719498d70f5398ec4efb964342e8079b01298
joncalhoun/fs_dir
/main.go
Go
go
365
no_license
package main import ( "io" "net/http" "os" ) func main() { ex2() } func ex1() { d := http.Dir(".") f, err := d.Open("stuff/thing.txt") if err != nil { panic(err) } defer f.Close() io.Copy(os.Stdout, f) } func ex2() { d := http.Dir("./stuff") f, err := d.Open("thing.txt") if err != nil { panic(err) ...
cea1aa3997d9f907abbdf9f6aba750081ca37992
9257dc49994348698fe1f94c20fa4a519132c4c3
bpkgoud/pulumi-azure-native
/sdk/go/azure/insights/managementGroupDiagnosticSetting.go
Go
go
5,702
permissive
package insights import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) type ManagementGroupDiagnosticSetting struct { pulumi.CustomResourceState EventHubAuthorizationRuleId pulumi.StringPtrOutput `pulumi:"eventHubAuthorizationRuleId"` Eve...
6a55239f2fb47a5f9b65d13d60dbfebed18784ca
257507634d93300741373bc0509e3e7bf677e718
SwordHarry/gocode
/字节跳动/81.搜索旋转排序数组2.go
Go
go
1,204
no_license
package main /** 假设按照升序排序的数组在预先未知的某个点上进行了旋转。 ( 例如,数组[0,0,1,2,2,5,6]可能变为[2,5,6,0,0,1,2])。 编写一个函数来判断给定的目标值是否存在于数组中。若存在返回true,否则返回false。 示例1: 输入: nums = [2,5,6,0,0,1,2], target = 0 输出: true 示例2: 输入: nums = [2,5,6,0,0,1,2], target = 3 输出: false 进阶: 这是 搜索旋转排序数组的延伸题目,本题中的 nums 可能包含重复元素。 这会影响到程序的时间复杂度吗?会有怎样的影响,为什么? */ fu...
419fcd773d1be1ef86f463786014aefa3ae3af83
eb726eb5939122c21e92ac629e7a9cd85580f96e
neo-technology/k8s-stackdriver
/event-exporter/sinks/stackdriver/monitored_resource_factory.go
Go
go
2,812
permissive
package stackdriver import ( sd "google.golang.org/api/logging/v2" corev1 "k8s.io/api/core/v1" ) type resourceModelVersion string const ( newTypes = resourceModelVersion("new") oldTypes = resourceModelVersion("old") ) const ( //sd.MonitoredResource Old types: gkeCluster = "gke_cluster" //sd.MonitoredResour...
8c20ed2bd5fad1e2f5208c743bcc2f9964d5149b
6f563d9d5e99f866213379f6247c7e1cdb013630
rulisastra/accelbyte-go-sdk
/samples/title-service-matchmaking/aws-lambda-functions/pkg/title-matchmaking/service/matchmaking.go
Go
go
28,247
permissive
// Copyright (c) 2021 AccelByte Inc. All Rights Reserved. // This is licensed software from AccelByte Inc, for limitations // and restrictions contact your company contract manager. package service import ( "aws-lambda-functions/pkg/constants" "aws-lambda-functions/pkg/repository" "aws-lambda-functions/pkg/reposit...
b61fe611682a189717d504d0c8ff239b83bf3ab3
d14628b9c7d9de37278610e04fd2b87128fa8ea5
frankZheng1111/hangmango-web-api
/serializer/hangman_test.go
Go
go
435
no_license
package serializer import ( "github.com/stretchr/testify/assert" db "hangmango-web-api/model" "testing" ) func TestSerializeGuessingHangman(t *testing.T) { hangman := new(db.Hangman) hangman.Id = 1 hangman.Word = "test" hangman.Hp = 1 guessingHangman := SerializeGuessingHangman(hangman) assert.Equal(t, int6...
eb2d3db52e70c3e80ffba0e7c3d4006f0e931dbd
c7e372a3cb73679b799ea34ee83ea44c1afe606f
bloodorangeio/registry_benchmark
/cmd/trace-replayer.go
Go
go
1,903
no_license
package cmd import ( "log" "strings" "github.com/spf13/cobra" "registry_benchmark/tracereplayer" "registry_benchmark/auth" registryconfig "registry_benchmark/config" ) var authOnly bool var deployment string var RegistryConfig *registryconfig.Config func init() { traceReplayerCmd.Flags().BoolVarP(&authOnly...
0004e88720a2e051e70023629da733035cae7984
bdf0568c50e840c708e453bdcb0cc2ff3b100a76
nimahkh/golang-chat
/main.go
Go
go
850
no_license
package main import ( "github.com/gin-contrib/static" "github.com/gin-gonic/gin" "github.com/nimahkh/golang-chat/controller" m "github.com/nimahkh/golang-chat/manager" ) var roomManager *m.Manager func main() { roomManager = m.NewRoomManager() router := gin.Default() router.LoadHTMLGlob("template/*") router....
59b8764fe0c6b8b91739c926f9540f70cc0eeeb1
361af5cefae68df6689afad9b934b4e6669c7e5c
dappley/go-dappley-single-server-tester
/main.go
Go
go
928
no_license
package main import ( "github.com/heesooh/go-dappley-single-server-tester/aws" "flag" "fmt" "log" ) func main() { var function, senderEmail, senderPasswd string flag.StringVar(&function, "function", "default_function", "Name of the function that will be run.") flag.StringVar(&senderEmail, "senderEmail", "de...
ba7e1b0f870cff381e418cbc9339a014bcc6be48
3f641439e3bb219b494b22d217f5e849e615bc1d
huhuyou2/win
/uxtheme.go
Go
go
5,789
permissive
// Copyright 2010 The win Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build windows package win import ( "syscall" "unsafe" ) // CheckBox parts const ( BP_CHECKBOX = 3 ) // CheckBox states const ( CBS_UNCHECKEDNORMAL ...
b4cbdcd20de90188c73eb45ea1918a463f032efb
8e867cce3aa807cdfb224cf020efbb8cbb11a910
YoungsoonLee/study-ds-algo-golang
/ds_algo/graph2/main.go
Go
go
1,492
no_license
// 친밀도 package main import ( "fmt" "sync" "github.com/golang-collections/collections/set" ) type queue struct { lock sync.Mutex q []string } func newQueue() *queue { return &queue{sync.Mutex{}, make([]string, 0)} } func (q *queue) enqueue(v string) { q.lock.Lock() defer q.lock.Unlock() q.q = append(q....
88c2c3255cbfac21c99fb8cfa6a9c433ed318fa0
fc5c273deee3596900b3cc14fbef02cc15cce72f
jasonkuhrt/oden
/go/src/oden/cmd/importer/importer.go
Go
go
1,001
permissive
package main import ( "C" "encoding/json" "fmt" "os" "oden/importer" ) type ErrorResponse struct { Error string `json:"error"` } func respondWithError(err error) string { b, err := json.Marshal(ErrorResponse{err.Error()}) if err != nil { return "{\"error\": \"Failed to encode error response as JSON\"}" }...
7e26a3d33961a4381067651cd1e3670ec229243f
22cad9f31d33423420c67143133dc08b1765fd93
mingforpc/go-nfs-client
/nfs/example/test/main.go
Go
go
4,893
permissive
// Copyright © 2017 VMware, Inc. All Rights Reserved. // SPDX-License-Identifier: BSD-2-Clause // package main import ( "bytes" "crypto/sha256" "fmt" "io" "io/ioutil" "log" "os" "strings" "github.com/mingforpc/go-nfs-client/nfs" "github.com/mingforpc/go-nfs-client/nfs/rpc" "github.com/mingforpc/go-nfs-clie...
13b56f45faa0185649fca822e49a69617f074463
b73d2d5a97b2b901dd1b23115836613ce0ad0bbc
dabasov/0chain_sc_parallel
/code/go/0chain.net/core/encryption/signature_scheme_test.go
Go
go
9,901
permissive
package encryption import ( "encoding/hex" "reflect" "testing" ) func TestIsValidSignatureScheme(t *testing.T) { t.Parallel() type args struct { sigScheme string } tests := []struct { name string args args want bool }{ { name: "Test_IsValidSignatureScheme_ed25519_TRUE", args: args{sigScheme: ...
29c393f37f3302d3e779769973c9824aa6df55c4
092ede87498f984240846385f502cb4c538e4c73
weizai118/code
/teaweb/actions/default/log/index.go
Go
go
462
permissive
package log import ( "github.com/TeaWeb/code/teamongo" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" ) type IndexAction actions.Action func (this *IndexAction) Run(params struct { Server string }) { // 检查MongoDB连接 this.Data["mongoError"] = "" err := teamongo.Test() if err != nil { this.Dat...
81ab905fe72156433580a31e8ba6a00b6ce2fb35
c4b34a6e84b9fc241628d397f1e1e76f5ce090ab
glava/lfm
/lastfm/response_test.go
Go
go
909
permissive
package lastfm import "testing" import "os" import "io/ioutil" func TestParsingOfArtists(t *testing.T) { q := ToArtists(readFile("../test-rig/top-artists.json", t)) assert("Bee Gees", q.Topartists.Artists[0].Name, t) } func TestParsingOfTracks(t *testing.T) { q := ToTracks(readFile("../test-rig/top-tracks.json", ...
33b74b0d713366fa3f0665eaa34119ba646924e9
11369abbac2964720a8de167a6235d3ed820c9f3
alecthomas/otto
/type_regexp.go
Go
go
4,047
permissive
package otto import ( "fmt" "regexp" "unicode/utf8" "github.com/alecthomas/otto/parser" ) type _regExpObject struct { regularExpression *regexp.Regexp global bool ignoreCase bool multiline bool source string flags string } func (runtime *_runtime) newRegExp...
28843c266a3fefd9a057e3c625ad627fc6991956
51dcad06aca32e73945ac2a46783e8ee6345324e
kelvinji2009/antsdk
/api/open/AlipayOpenPublicInfoQueryRequest.go
Go
go
1,652
no_license
package open import ( "github.com/kelvinji2009/antsdk/api" "github.com/kelvinji2009/antsdk/utils" ) // 服务窗基础信息查询接口 // 通过该接口查询服务窗名称、头像、欢迎语基础信息 type AlipayOpenPublicInfoQueryRequest struct { api.IAlipayRequest TerminalType string `json:"terminal_type"` TerminalInfo ...
19fa9c54a9a8d87f5bca41cc2cf8a7326a937bc6
e54e3f7f0f4834add98c6dcd2eaec0e1732461a2
asdfghjjklllllaaa/luci-go
/grpc/cmd/svcdec/main.go
Go
go
1,817
permissive
// Copyright 2016 The LUCI Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
57d3bdbfba911e7b7da086edcd44e07035f1e35c
ffd452b31ee2d0d5578c74a57761c4d8e4525577
hetznercloud/cli
/internal/cmd/network/labels.go
Go
go
1,183
permissive
package network import ( "context" "fmt" "github.com/hetznercloud/cli/internal/cmd/base" "github.com/hetznercloud/cli/internal/hcapi2" "github.com/hetznercloud/hcloud-go/v2/hcloud" ) var labelCmds = base.LabelCmds{ ResourceNameSingular: "Network", ShortDescriptionAdd: "Add a label to a Network", ShortDe...
70fc05cc522a986dfba7ed5fbe55a2c414708389
f1d432e61f0f363df67b78eb0b46a0964cffa08b
frankfanslc/epos
/collection.go
Go
go
7,385
permissive
package epos import ( "encoding/binary" "encoding/json" "fmt" "io" "log" "os" "path/filepath" "strconv" ) type Collection struct { store StorageBackend indexpath string indexes map[string]*index } type Id int64 func (db *Database) openColl(name string) *Collection { // create/open collection coll...
398c2381fec9f3599e07370788bc2947f6c2d887
dba2a10736388a7014c6dd2978f9d4fc09e96375
Global-localhost/osconfig
/e2e_tests/test_suites/inventory/inventory.go
Go
go
10,108
permissive
// Copyright 2018 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 appl...
cf31d5bf73c5542a38723f80172c19bb66c46428
d7292551c8d75e0a69a6f99dd75682c4846e89a5
UniversalCurrencySystemsLLC/cointop
/pkg/ui/view.go
Go
go
4,478
permissive
package ui import ( "fmt" "github.com/cointop-sh/cointop/pkg/gocui" "github.com/gdamore/tcell/v2" ) // IView is the view interface type IView interface { Backing() *gocui.View SetBacking(gocuiView *gocui.View) Name() string } // View is a view sruct type View struct { backing *gocui.View name string } /...
05a3e9f5f1747e01e353d7cad0ef63578072cc42
6c706fa974cb315675f8c8e6b875ec2cfff7b306
tiaguinho/pagarme-go
/plan.go
Go
go
788
permissive
package pagarme import ( "fmt" "encoding/json" ) //Plan struct type Plan struct { ApiKey string `json:"api_key"` Name string `json:"name,omitempty"` Amount int32 `json:"amount,omitempty"` Days int32 `json:"days,omitempty"` TrialDays int32 `json:"trial_days,omitempty"` PaymentMethods st...
4e4a0f8f4eca92a2ac2744031c612fa7d9db3659
b716ff639c7fb06578aa80d0b6b43a892665e898
hybridgroup/gobot
/system/digitalpin_sysfs.go
Go
go
6,165
permissive
package system import ( "errors" "fmt" "io" "log" "os" "strconv" "time" "gobot.io/x/gobot/v2" ) const ( systemSysfsDebug = false // gpioPath default linux sysfs gpio path gpioPath = "/sys/class/gpio" ) var errNotExported = errors.New("pin has not been exported") // digitalPin represents a digital pin ty...
ec4b01fc045657ef2b4b77cd7d0a3b0bb7f92f6b
377f07ff854689e94f793f48ac54a6c67da9d57f
xopenapi/uim-api-go
/examples/dialog/dialog.go
Go
go
2,593
permissive
package main import ( "encoding/json" "io/ioutil" "log" "net/http" "net/url" "strings" "github.com/xopenapi/uim-api-go" ) var api = uim.New("YOUR_TOKEN") var signingSecret = "YOUR_SIGNING_SECRET" // You can open a dialog with a user interaction. (like pushing buttons, slash commands ...) // https://api.uim.c...
46d42baa3347d24ab560119a07e3f33ce0e027fd
7c9a43bcf879abaaa2d8830ee828079de317dabd
mehulsbhatt/jasperserver-go
/client/operations/get_features_parameters.go
Go
go
1,337
no_license
package operations // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "time" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" strfmt "github.com/go-openapi/strfmt" ...
04436952359a8b4317457dc38b2b725e9dfbdbac
9af8b5e82ed297d50c755258ff10f8d596ac1e9d
vinny2020/golang-projects
/main/exercise_1_2.go
Go
go
206
no_license
package main import ( "fmt" "os" "strconv" ) //print index and arg with a line break func main() { for index, arg := range os.Args[1:] { fmt.Println(strconv.Itoa(index) + ": " + arg + "\n") } }
506d5ff2a78c510b81a7ff478f445a5750583b69
5affde45e4630b8779054c7b598632fa35c62cbe
phil-fly/poc
/docker/exp.go
Go
go
4,718
no_license
package main import ( "context" "errors" "fmt" "github.com/containerd/ttrpc" "io/ioutil" "log" "math/rand" "net" "os" "regexp" "strings" shim "github.com/containerd/containerd/runtime/v1/shim/v1" "time" ) var configJson = ` { "ociVersion": "1.0.1-dev", "process": { "terminal": false, "user": ...
9c3562a16913cc3cf59fd7876a6fdc83bdda63b1
b9655faab7f4c3e6f03e1b7df7d662d9cf932ae9
remixd-media/prebid-server
/adapters/33across/33across.go
Go
go
6,392
permissive
package ttx import ( "encoding/json" "fmt" "net/http" "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" ) type TtxAdapter struct { endpoint string } ty...
45b044fb0ff80dfe2f3d0c7f866af20208861ed9
46dd4a33ccbf8109685dbf6925764f566f836681
cloudflare/go
/test/fixedbugs/issue16804.go
Go
go
331
permissive
// compile // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 16804: internal error for math.Sqrt as statement // rather than expression package main import "math" func sqrt() { math.S...
21e6f758922b6a6f2e8498b378485942df32ee07
0750e2a2f04c2e9a7f7410bbca4fbddaade70916
koltyakov/github-notify
/lock.go
Go
go
463
permissive
package main import ( "os" "path/filepath" "github.com/nightlyone/lockfile" ) var lockfilePath = filepath.Join(os.TempDir(), appname+".lock") // lockSession locks application instance session func lockSession() error { lock, err := lockfile.New(lockfilePath) if err != nil { return err } return lock.TryLock...
c38d10c6e484266ffc92c24be604ba77bac2747e
400f8d5f090a228acddbe0ffee7b807617fce146
changyu496/go_learning
/ch5/condition/condition_test.go
Go
go
672
no_license
package condition_test import "testing" /*Go语言的条件语句支持语句*/ func TestMultiSec(t *testing.T) { if a := 1 == 1; a { t.Log("do it") } else { t.Log("No!!!") } } /*Go语言的switch可以支持多个值*/ func TestSwitchMultiSec(t *testing.T) { a := 1 for a < 5 { switch a { case 0, 2: t.Log("偶数") case 1, 3: t.Log("奇数") ...
03a1b352191f33a8f865e186875ed7fa9340a23b
86378ea5151bd7040dadfdc99942a25c201197f3
chinmaya1/gophercises
/recover/main.go
Go
go
2,736
no_license
package main import ( "bytes" "fmt" "io" "log" "net/http" "os" "regexp" "runtime/debug" "strconv" "github.com/alecthomas/chroma/formatters/html" "github.com/alecthomas/chroma/lexers" "github.com/alecthomas/chroma/styles" ) var listenAndServe = http.ListenAndServe //Handler function will handle all the r...
3a236cd133d8ab882fdd0c58797b60694cad2d2a
c98e05127996ed8a9db20527a195fa6385619923
erikcai/oci-go-sdk
/cims/tech_support_item.go
Go
go
2,530
permissive
// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. // This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei...
cabdf27946d9925eb2fdef4747b49711703f8667
0b1de9c81777e2dd32a34aa26ad990d629bd039d
Stevenwo/rwtxt
/template_render.go
Go
go
19,724
permissive
package rwtxt import ( "bytes" "compress/gzip" "crypto/sha256" "database/sql" "encoding/json" "fmt" "html/template" "image/jpeg" "io" "io/ioutil" "net/http" "net/url" "strconv" "strings" "sync" "time" "github.com/disintegration/imaging" log "github.com/cihub/seelog" "github.com/schollz/rwtxt/pkg/d...
7ab5eadd0b0db2f4a4decb16c671a7014edd9c74
8d643a885d68acc5ffb800c3e16d41ff91cf6fd7
7-Rohan/KotretanHackerRank
/problem/theHurdleRace.go
Go
go
578
no_license
package problem import ( "fmt" ) // link problem: // https://www.hackerrank.com/challenges/the-hurdle-race/problem?isFullScreen=false func hurdleRace(k int32, height []int32) int32 { // Write your code here var output int32 for _, v := range height { if v-k > output { output = v - k } } return output } ...
fc3942e58edaa8111ed6872d806745cb9f47f724
ec6b9d668affdcee43893a171b5101092684bd65
canonical/kubernetes-dqlite
/vendor/github.com/rancher/wrangler/pkg/ticker/ticker.go
Go
go
228
permissive
package ticker import ( "context" "time" ) func Context(ctx context.Context, duration time.Duration) <-chan time.Time { ticker := time.NewTicker(duration) go func() { <-ctx.Done() ticker.Stop() }() return ticker.C }
5fafb9fef2d3560298ccca7e72efb9fe2b353c8e
bf2235a576b403f26679333223daf781ff709666
fisher046/gorm-sample
/pkg/api/user_test.go
Go
go
2,017
no_license
package api import ( "fmt" "net/http" "net/http/httptest" "strings" "testing" "github.com/gin-gonic/gin" "github.com/fisher046/gorm-sample/pkg/database" ) func resetTables() { err := database.GetDB().DropTableIfExists(&database.User{}). AutoMigrate(&database.User{}).Error if err != nil { panic(err) } ...
dca8098e385146d26e25f8b604086946957c6061
a36928a6845ec58004ee023385ee5281426c1f0c
pshrhq/avalanchego
/vms/avm/base_tx_test.go
Go
go
38,909
permissive
// (c) 2019-2020, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. package avm import ( "bytes" "math" "testing" "github.com/ava-labs/avalanchego/database/memdb" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow/engine/common" "github.com/ava-labs/aval...
3dcc135fdd6f0c0e96d2f0db897ca1715cc58616
98d7e171690408f71cad9fe381eab985bb5f9d95
HirokazuKurihara/atcoder
/ABC/abc161/abc161_a/main.go
Go
go
331
no_license
package main import ( "fmt" ) // A - abc Swap // https://atcoder.jp/contests/abc161/tasks/abc161_a func main() { var a, b, c int fmt.Scanf("%d %d %d", &a, &b, &c) fmt.Println(abc161A(a, b, c)) } func abc161A(a, b, c int) (int, int, int) { var tmp int tmp = a a = b b = tmp tmp = a a = c c = tmp return...
4fff11bcf671a301e7f69b5ac5dd375bb926f40b
c5367cdd9919f3393589cb2518cf31a576209706
Alnezis/vksdk
/api/params/account_test.go
Go
go
5,318
permissive
package params_test import ( "testing" "github.com/SevereCloud/vksdk/api/params" "github.com/stretchr/testify/assert" ) func TestAccountBanBuilder(t *testing.T) { t.Parallel() b := params.NewAccountBanBuilder() b.OwnerID(1) assert.Equal(t, b.Params["owner_id"], 1) } func TestAccountChangePasswordBuilder(t...
fbb9ab5b3453f6fb9077921c0b63868ff950eb56
abb59b502e27f0cc252e14054ea8a487ecab67d3
laashub-soa/kotsadm
/pkg/snapshot/types/types.go
Go
go
1,995
permissive
package types import "time" type StoreAWS struct { Region string `json:"region"` AccessKeyID string `json:"accessKeyID"` SecretAccessKey string `json:"secretAccessKey"` // added for unmarshaling, redacted on marshaling UseInstanceRole bool `json:"useInstanceRole"` } type StoreGoogle struct { Serv...
daadf08b6ba6d53e95c11a87bf32c44301b870ee
1911f0faa23f3307b77bd4de978c06efc0c1857b
datamaskinmann/Offentlig
/Golang/nettkode/netobjects/netobjects.go
Go
go
3,246
no_license
package netobjects import ( "encoding/json" "fmt" "reflect" ) var networkableObjects = map[string]reflect.Type{ "netobjects.SetID": reflect.TypeOf(SetID{}), "netobjects.ClientDisconnected": reflect.TypeOf(ClientDisconnected{}), "netobjects.ClientConnected": reflect.TypeOf(ClientConnected{}), } ...
e56ef201ad8db3f29f59745ceb102b1df7f80e1f
2fae527342437e69d98c33613c2313fa88e62e88
Randyshu2018/bsn-sdk-go
/third_party/github.com/hyperledger/fabric/bccsp/pkcs11/ecdsa.go
Go
go
1,398
no_license
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ /* Notice: This file has been modified for Hyperledger Fabric SDK Go usage. Please review third_party pinning scripts and patches for more details. */ package pkcs11 import ( "crypto/ecdsa" "fmt" "github.com/chcp/bsn-sdk-go/third_...
1a8350857f5aab10a5bf1047685b20f1026f7bb9
3e373800471c844a2afb774ec7aa23dc7c5a3ef4
ruwanego/api
/integ/task_test.go
Go
go
2,749
no_license
package handler_test import ( "fmt" "net/http" "testing" "github.com/steinfletcher/apitest" "github.com/hiconvo/api/model" "github.com/hiconvo/api/testutil" ) func TestSendEmailsAsync(t *testing.T) { owner, _ := testutil.NewUser(_ctx, t, _dbClient, _searchClient) member1, _ := testutil.NewUser(_ctx, t, _dbC...
94e9023f6b544617b34748a580af97c09ce66e68
74e0089c52201b930daf77f63b4c46f8a37ce3a8
brymck/gke-site
/src/frontend/server/rpc.go
Go
go
743
permissive
package main import ( "context" pb "github.com/brymck/gke-site/src/frontend/server/genproto" ) func (fe *frontendServer) count(ctx context.Context) (*pb.CountResponse, error) { resp, err := pb.NewCountServiceClient(fe.countSvcConn).GetCount(ctx, &pb.CountRequest{}) return resp, err } func (fe *frontendServer) sa...
838b2ba67673544eb990cfa642bda0a05b7892f7
5dd087c370f60e5a016f67647e8e6820f636d48f
vinayvira/stack-deployment-tool
/graph/dag.go
Go
go
6,309
permissive
// // Copyright 2016 Capital One Services, 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...
68c0a70822c9bc9e41f00478a2e1a79d97a566de
aab1c7c0b1d8905970901256dfc2b596c019569a
gpldirk/video_server
/api/model/errs.go
Go
go
690
no_license
package model type Err struct { Error string `json:"error"` ErrorCode string `json:"error_code"` } type ErrResponse struct { HttpSC int Error Err } var ( ErrorRequestBodyParseFailed = ErrResponse{ HttpSC: 400, Error: Err{ Error: "Request Body Parse Failed", ErrorCode: "001", }} ErrorUserAuthFailed...
b85a995836cc4f4a8f43bb2c3053120dfd3c3557
703e5b4002fc05c537d9f6616752b300d278ea40
lwalen/goproxy
/goproxy.go
Go
go
17,386
permissive
/* Package goproxy implements a minimalist Go module proxy handler. */ package goproxy import ( "context" "encoding/base64" "errors" "fmt" "io" "io/ioutil" "log" "net/http" "net/url" "os" "path" "regexp" "strings" "sync" "time" "golang.org/x/mod/module" "golang.org/x/mod/semver" "golang.org/x/mod/su...
cc424f24cd37d39adcfdda7a8562da54b1aa8695
a842eebf9bda74458c96cc9e007bfeea0293319e
yaggytter/gogs
/modules/auth/ldap/ldap_test.go
Go
go
649
permissive
package ldap // import ( // "fmt" // "testing" // ) // var ldapServer = "ldap.itd.umich.edu" // var ldapPort = 389 // var baseDN = "dc=umich,dc=edu" // var filter = []string{ // "(cn=cis-fac)", // "(&(objectclass=rfc822mailgroup)(cn=*Computer*))", // "(&(objectclass=rfc822mailgroup)(cn=*Mathematics*))"} // var a...
10f866a316bc73b7b0e438ccf95455d704ba042d
c82e57df85ef0ece67c05c6ee7cb7cbf36347396
kubernetes/kubernetes
/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go
Go
go
751
permissive
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build linux && !appengine // +build linux,!appengine package fastwalk import ( "bytes" "syscall" "unsafe" ) func direntNamlen(dirent *syscall.Dirent)...
64a077a117c09a1b244da083ddb6fe692e75547c
7efd925d36f6bc8927be5d331e4c8452f27cca30
udistrital/api_academica
/models/razon_fin_grupo_docente.go
Go
go
4,275
no_license
package models import ( "errors" "fmt" "reflect" "strings" "github.com/astaxie/beego/orm" ) type RazonFinGrupoDocente struct { Id int `orm:"column(id);pk"` Descripcion string `orm:"column(descripcion)"` CodigoAbreviacion string `orm:"column(codigo_abreviacion)"` } func (t *RazonFinGr...
5453e9bf256620a8319c59765f5d6cdfaec44628
ca94522ccb47af5473a943f712269e3f58e0ca65
lukeenterprise/ion-go
/ion/textutils.go
Go
go
6,458
permissive
/* * Copyright Amazon.com, Inc. 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. * A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "...
26a0e1f1bcb29995c2e49fc23c693dcb5dd8bf91
56cb9facb63a11d282ee87c271d0b38ad65f20be
huuthuan-nguyen/web-development-with-go
/mgo_insert_map.go
Go
go
647
no_license
package main import ( "log" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) func main() { session, err := mgo.Dial("localhost") if err != nil { panic(err) } defer session.Close() session.SetMode(mgo.Monotonic, true) // get collection c := session.DB("taskdb").C("categories") docM := map[string]string{ "na...
1bc2f8cc470110e01f88adf602fb3d9828e0402c
1668dd742d0b72329f95ee7a540f3af53b1261c1
calvn/brokr
/vendor/github.com/calvn/go-tradier/tradier/account_gainloss.go
Go
go
441
permissive
package tradier import "fmt" // GainLoss returns the account's cost basis for accountID. func (s *AccountService) GainLoss(accountID string) (*GainLoss, *Response, error) { u := fmt.Sprintf("accounts/%s/gainloss", accountID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } ...
a7fcd1384a1c2e9b0e2d788da8f2187b6d4367b8
909d746892b50ec3d16d2ecfc824180453379a33
warrenween/atlantis
/console/bridge.go
Go
go
11,460
no_license
// Copyright 2016 The go-athereum Authors // This file is part of the go-athereum library. // // The go-athereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License...
5fcfd624e12082e4671149d06befa9cb2d50b03f
76c85fdcaf5e4010d80e017594d5420dfd7eca13
godcong/leetcode
/code/1400/1439/find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows_test.go
Go
go
462
permissive
package _1439 import ( "testing" . "github.com/godcong/leetcode/common" ) func Test_kthSmallest(t *testing.T) { type args struct { mat [][]int k int } tests := []struct { name string args args want int }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) ...
fe75a7aabe513e11798360db6a6283cfcc0caede
4da0b59e1f83eb430c01de7f212668e1b5085532
OKNoah/kube-arangodb
/deps/github.com/arangodb/go-driver/client_databases.go
Go
go
3,064
permissive
// // DISCLAIMER // // Copyright 2017 ArangoDB GmbH, Cologne, Germany // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless require...
2fe83b42695b98c77c00286b1d49d3c8c6f43a8d
46996cbe473a4246c632aa3187520e953b211c67
ptx96/capsule
/e2e/storage_class_test.go
Go
go
4,735
permissive
//+build e2e // Copyright 2020-2021 Clastix Labs // SPDX-License-Identifier: Apache-2.0 package e2e import ( "context" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" ...
c58b523af7b15affb647feb3f07c984baf4072a8
9044d6c082283f82df7029ef3b0ae2000d13888f
openshift/installer
/vendor/github.com/microsoftgraph/msgraph-sdk-go/groups/item/members/item/orgcontact/org_contact_request_builder.go
Go
go
5,092
permissive
package orgcontact import ( "context" i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models" ia572726a95efa92ddd544552cd950653dc691...
d6bea09996066cc70dc2e248d7d14827691fa132
507b9ccede8ac903bd0a598ab03f3d8fee563438
lwahomura/comparison
/fuzzy_methods/shimkevich.go
Go
go
1,424
no_license
package fuzzy_methods import ( "github.com/lwahomura/comparison/pkg" ) type Comparator struct { SubtokenLength int } // CompareWords returns similarity ratio of two words using shingles algorithm and Shimkevich-Simpson ratio. // Argument first should be a string in Russian or English. // Argument second should be ...
ab2824d56596b3fad3bde8f2a4ab0f8bbebf3d75
9e5ea10371732d5164f76b88b35ac72d72748732
vincmarz/mygo
/stdIN.go
Go
go
419
no_license
package main import ( "bufio" "fmt" "os" ) func main() { var f *os.File //file pointer f f = os.Stdin // file pointer declaration defer f.Close() // we defer the closing of that file with .Close() scanner := bufio.NewScanner(f) // return a new Scanner to read from f for scanner.Scan() { // scanner is used ...
f1fd9cc3f9da3a49398a05fd413d98a24b4e6ecf
6b88329a91618f7b8d2f54bff83b1e96e8a6cf48
go-chi/cors
/_example/main.go
Go
go
2,396
permissive
// cors example // // ie. // // Unsuccessful Preflight request: // =============================== // $ curl -i http://localhost:3000/ -H "Origin: http://no.com" -H "Access-Control-Request-Method: GET" -X OPTIONS // HTTP/1.1 200 OK // Vary: Origin // Vary: Access-Control-Request-Method // Vary: Access-Control-Request-H...
a7eea03c14ce62d3d54f2c39c03033a4edc24bea
54cde3f7a1488874d55088577cb15c690b54501d
jeromelesaux/photo
/vendor/camlistore.org/pkg/types/serverconfig/config.go
Go
go
7,006
permissive
/* Copyright 2014 The Camlistore 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,...
fa88e80b253b37c4140a49676f25f1615c642c44
0de162aad828f81bc11c6f9413606883ab5aa41d
lijingtian/chatRoom
/Common/Message/serverNotify.go
Go
go
690
no_license
package Message import ( "encoding/json" "fmt" ) /* * 服务器通知消息结构体 * NType 1- 用户状态变更通知 */ type ServerNotify struct { Type string `json:"type"` Content string `json:"content"` } func NewServerNotify()(*ServerNotify){ return &ServerNotify{} } func(this *ServerNotify) ModelInit(args []string){ this.Type = args[0...
e5dc77ed2410fd24fee5f92bf339af008c341b7a
03b2a8488ee6049ede040dd5d51901fc273a6093
subbu05/go
/src/cmd/compile/internal/types2/typexpr.go
Go
go
15,787
permissive
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements type-checking of identifiers and type expressions. package types2 import ( "cmd/compile/internal/syntax" "fmt" "go/constant" . "in...
270c26cb1e3ed0bbf1c6475e5ce8016ec617aec2
522bc8a7ec5d582a488499510b16cae91722f693
windbaggary/bhchain
/x/slashing/params.go
Go
go
1,618
permissive
package slashing import ( "time" sdk "github.com/bluehelix-chain/bhchain/types" "github.com/bluehelix-chain/bhchain/x/slashing/types" ) // MaxEvidenceAge - max age for evidence func (k Keeper) MaxEvidenceAge(ctx sdk.Context) (res time.Duration) { k.paramspace.Get(ctx, types.KeyMaxEvidenceAge, &res) return } //...
7fd680d91e3ff6319016aa63ebecd02975dabfde
cdf4144d2c806384bb9999e15d59c839853e2d11
cch123/test
/go/asm/local_var.go
Go
go
243
no_license
package main import "fmt" // 注意观察这个函数的 args 和 locals // 以及生成的汇编的 $x-y 之间的关系 func test(x []int) int { var a = 1 var b = struct{ X int }{X: 93} fmt.Println(b) return a + b.X } func main() { }
b05cafe605926c07bd76d652f3954c25f63eb699
4322fa22379ac26c05f67551407f7365a88d6a89
361709/pi-tools
/detect-presence/service/tripsservice/list_tags.go
Go
go
935
permissive
package tripsservice import ( "context" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" tripspb "github.com/mjm/pi-tools/detect-presence/proto/trips" ) func (s *Server) ListTags(ctx context.Context, req *tripspb.ListTagsReque...
b09bacf5a7092b9730369fc1e01ae540edaf53a6
e0c2fd8a0f439da3625744803f43d4e1b7fbd680
niteshexa/CloudFoundry_CLI
/command/v7/routes_command.go
Go
go
2,907
permissive
package v7 import ( "strconv" "strings" "code.cloudfoundry.org/cli/actor/v7action" "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/util/ui" ) type RoutesCommand struct { BaseCommand usage interface{} `usage:"CF_NAME routes [--org-level]"` relatedCommands interface{} `related_comma...
91266837e7844a9507e4eb012156ca0b5c74ef87
e5ffc4a28a5ff4440cab4243b84b68b41ae290cd
Myquist/6.824
/6.824/src/mr/rpc.go
Go
go
648
no_license
package mr // // RPC definitions. // // remember to capitalize all names. // import "os" import "strconv" // // example to show how to declare the arguments // and reply for an RPC. // type RequestWorkArgs struct { File string Type string } type RequestWorkReply struct { File string Type string Id int NRed...
df9e92f7d23c1304d42821d52c703bfbabcec471
3de4fda507fae1d44bba8f2cd71e7de10a10cb89
nightfury1204/pharmer
/cloud/providers/linode/cluster_actuator.go
Go
go
3,176
permissive
package linode import ( "context" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" "k8s.io/klog/klogr" "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1" linodeApi "pharmer.dev/pharmer/apis/v1alpha1/linode" clusterapi "sigs.k8s.io/cluster-api/pkg/apis/cluster/v...
bbc73ad6a32f551589f194a7354d20f7a69bf4b3
12c20eee19ab265337ed13baf3a6a803a4a0e351
WANcatServer/website
/session.go
Go
go
3,785
no_license
package main import ( "database/sql" "log" "net/http" uuid "github.com/satori/go.uuid" "golang.org/x/crypto/bcrypt" ) func getUser(w http.ResponseWriter, r *http.Request) *User { cookie, err := r.Cookie("session") if err == http.ErrNoCookie { return nil } session := cookie.Value q := ` SELECT U.ID FRO...
8549303d97af7c496dfaa1487b19a315a30dc46f
cf1a1056436e24fba018e27bacd03f852dc27179
gulywwx/todo-go-api
/routers/app_version.go
Go
go
293
no_license
package routers import ( "github.com/gin-gonic/gin" "github.com/gulywwx/todo-go-api/utils" ) //app更新接口 func GetAppVersionTest(c *gin.Context) { c.JSON(utils.SUCCESS, gin.H{ "code": utils.SUCCESS, "msg": utils.GetMsg(utils.SUCCESS), "data": "return data successful", }) }
33bb5b41e04439400f3e4812a13d31f7c475609a
fbedb436bcfa803eb8e877b6cf87f2e6d8a5e880
214AlphaDev/community-api-go
/applications_query.go
Go
go
1,696
no_license
package community_api_go import ( "context" "errors" "github.com/214alphadev/community-api-go/scalars" am "github.com/214alphadev/community-authentication-middleware" cd "github.com/214alphadev/community-bl" ) type ApplicationsInput struct { Position *scalars.UUIDV4 Next int32 State string } type appl...
b7dfb32a7256ad2e1dde4b135b0f2f49c6800dc9
34a77e79a4c3f9bff0facb3c4bb1afa70e9c97a2
kirylandruski/goim
/src/goim/binarize/utils.go
Go
go
4,797
no_license
package binarize import ( "encoding/binary" "unsafe" "errors" ) // Id func IdSize(val int32) int32 { return Int32Size(val) } func IdPut(buf []byte, offset int32, val int32) (int32) { start, end := offset, offset+Int32Size(0) binary.BigEndian.PutUint32(buf[start:end], uint32(val)) offset = end return offset...
33c8e66ab2f4cd8c80548a82fae7baf1a2e250b5
453ec754dad755bf08b9448620eff597abc126fa
mrbardia72/dark-zarinpal
/routers/router.go
Go
go
477
no_license
package routers import ( "github.com/gorilla/mux" "github.com/mrbardia72/dark-zarinpal/config" "github.com/mrbardia72/dark-zarinpal/service" "log" "net/http" ) func RouterMap() { r := mux.NewRouter() r.Methods("GET").Path("/Bank{price}").HandlerFunc(service.Bank) r.Methods("GET").Path("/CallBack{price}").Hand...
24c9c13f2d6e4cfcce7beb2952974b711f1d62a0
06f8b6903b5354573ea95f497456e7246c60b8c7
renatoork/pocgolang
/go-util/erro/erro_mega.go
Go
go
444
no_license
package erro import ( "bytes" "fmt" "mega/go-util/dbg" "path/filepath" "runtime" ) func Trata(err error) bool { if err != nil { _, arquivo, linha, _ := runtime.Caller(1) fmt.Println(fmt.Sprintf("%s:%d - %s", filepath.Base(arquivo), linha, err)) if dbg.GetDebug() { trace := make([]byte, 16384) runtim...
4f352684f162af0aaed1adb1976b74d58054a511
5c9ec3355a07057b2f2cc283ba26bd5ab143cab9
Allenxuxu/dsa
/queue/static_queue_test.go
Go
go
962
permissive
package queue import "testing" func TestStaticQueue(t *testing.T) { queue := NewStaticQueue(10) { _, ok := queue.Pop() if ok != false { t.Fatal() } if ok := queue.Push(1); ok != true { t.Fatal() } if queue.Length() != 1 { t.Fatal() } v, ok := queue.Pop() if ok != true { t.Fatal() } ...
b9065bd3672dea0d2c8a55120230abbea987aa96
5a4db3fe19a243ef53a39ea98eae8076169f52ec
kokizzu/google-api-go-client
/websecurityscanner/v1/websecurityscanner-gen.go
Go
go
137,780
permissive
// Copyright 2021 Google LLC. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code generated file. DO NOT EDIT. // Package websecurityscanner provides access to the Web Security Scanner API. // // For product documentation, see: https://cloud.google.com/secur...
4298870916029866949ee4134406d401abdce84e
b7e524b0379f82f20249df8fb81840557d906122
google/skia-buildbot
/perf/go/config/config.go
Go
go
25,562
permissive
package config import ( "context" "encoding/json" "errors" "fmt" "io" "io/ioutil" "regexp" "time" iSchema "github.com/invopop/jsonschema" cli "github.com/urfave/cli/v2" "go.skia.org/infra/go/jsonschema" "go.skia.org/infra/go/skerr" "go.skia.org/infra/go/sklog" "go.skia.org/infra/go/util" "go.skia.org/i...
dd324c9028274402228ca42eaeb93d740ab6a3a3
06b5796ea5835e52f2d1b3b5861d1d9ef55d6af1
ungarmichael/portfolio-v1
/backend/routes/contribution.go
Go
go
2,007
no_license
package routes import ( "backend/cmd/monolithic/entities" "backend/cmd/monolithic/repository" "encoding/json" "log" "net/http" ) // const Exported = "10" // func ConnectToContribution() { // fmt.Printf("hello") // // http.ListenAndServe(":8000", nil) // } // func HandleContribution() { // http.HandleFunc("/...
8f2fea3257c913b8e8c83b84386e6321afa7935c
fca1fe2cd35f283348afcad28d8f0326e382db74
GoogleCloudPlatform/magic-modules
/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances.go
Go
go
6,699
permissive
package sql import ( "fmt" "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-google/google/tpgresource" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" sqladmin "google.golang.org/api/sqladmin/v1beta4" ) func DataSour...
9bee8e19f8f1046905f7afb193f5e88c5276af4b
f750809093540872fcf13d09007d0e4c2bc25232
lotreal/pdk
/bytes.go
Go
go
2,784
permissive
// Copyright 2017 Pilosa Corp. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaime...
da36bfdc3e0cee5c200414af8c768677712e03aa
92fc0b2851f94fb745e7c17c1199ee2782d8329a
MattFenelon/Gotham
/src/http_tests/series_test.go
Go
go
5,161
permissive
package http_tests import ( "code.google.com/p/go-uuid/uuid" "domain" "io/ioutil" "net/http" "testing" "time" ) func TestGetSeries(t *testing.T) { t.Log("When multiple comics of the same series are added") api := newTestableApi() defer api.Close() comics := domain.NewComicDomain(api.es, api...
5866965c5d12f736d610273df23a6695f5c3108e
e0ba35f28c67a674e9d05f49a38d09e11586a0a4
evergreen-ci/barque
/vendor/github.com/evergreen-ci/pail/local.go
Go
go
12,495
permissive
package pail import ( "context" "io" "io/ioutil" "os" "path/filepath" "regexp" "github.com/evergreen-ci/utility" "github.com/mongodb/grip" "github.com/mongodb/grip/message" "github.com/pkg/errors" ) type localFileSystem struct { path string prefix string dryRun bool deleteOnPush boo...
2ea0df2cb0d8e1722762d847fcf71e3c47ebd7f1
1023592b7b3747bb45a762c6edd031d07c8ec1cd
SaltIce/GoMQTT
/mqtt_v5/message/disconnect.go
Go
go
855
permissive
package message import "fmt" // The DISCONNECT Packet is the final Control Packet sent from the Client to the Server. // It indicates that the Client is disconnecting cleanly. type DisconnectMessage struct { header } var _ Message = (*DisconnectMessage)(nil) // NewDisconnectMessage creates a new DISCONNECT message...
abd7c2040fb91544ca311421d0826013aea6483b
6845820f7533cc3615b4f1a17cc0bdd0557d5bf6
audrius-paskevicius/rotator
/size_rotator_test.go
Go
go
2,715
permissive
package rotator import ( "os" "testing" "github.com/stretchr/testify/assert" ) const ( path = "test_size.log" ) func cleanup() { os.Remove(path) os.Remove(path + ".1") os.Remove(path + ".2") os.Remove(path + ".3") } func TestSizeNormalOutput(t *testing.T) { cleanup() defer cleanup...