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
e6840c8e25f80d2244c9959ab4f3a6a9b10b98fd
b723fb1a7d27955b39849dbef6a55f13b419b08c
huangsuwei/microTest
/test/test.go
Go
go
788
no_license
package main import ( "fmt" "github.com/golang/protobuf/proto" "microTest/prototext" ) func main1() { text := &prototext.Test{ Name: "panda", Weight: []int64{150, 140, 180}, Stature: 176, Motto: "天行健,君子以自强不息,地势坤,君子以厚德载物", } fmt.Println(text) //proto编码 data, err := proto.Marshal(text) if err != ...
cb4eed1940dc826e01e307a4cd604631632fb8d4
ede385468653b80607770dba7353e12a0f9c3c69
jerry7z/kubevirt
/tests/network/vmi_multus.go
Go
go
34,377
permissive
/* * This file is part of the kubevirt project * * 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...
618c8566b8ab8911dabb02158404ad27d1d2ffd9
c8140e0d406591ea731047eb6bed6663334c80b7
sourya/go-sdk
/web/tree_test.go
Go
go
15,072
permissive
// Copyright 2013 Julien Schmidt. All rights reserved. // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file. package web import ( "fmt" "net/http" "reflect" "strings" "testing" ) func printChildren(n *RouteNode, prefix string) { fmt.Printf(" %02d:%02d %s%s[%d] ...
78599ec35c273d4b59f81c9a6b930e03158adc7b
bac5c5e83b7737894505657e10a7fe8b4990036f
kimdj2/go-example
/src/ch04/section_3/method_overriding.go
Go
go
602
no_license
package main import "fmt" type Item struct { name string price float64 quantity int } func (t Item) Cost() float64 { return t.price * float64(t.quantity) } type DiscountItem struct { Item discountRate float64 } func (t DiscountItem) Cost() float64 { return t.Item.Cost() * (1.0 - t.discountRate/100) }...
0b2b76f7255d22c6cb391a83f838148956122e4b
fabbfbdf9539be988bc5ee092bd0da62d2a2ab6f
helmutkemper/telerik
/htmlElementSpan.go
Go
go
1,567
permissive
package telerik import ( "bytes" "reflect" ) // The HTML <span> element is a generic inline container for phrasing content, which does not inherently represent // anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they // share attribute values, such as la...
ca14637d31c07c6303e8893a5d4fd77bbd175715
331c6febbb877dd9fd099a736b788b4961198dec
dbenoit17/installer
/vendor/github.com/metal3-io/baremetal-operator/pkg/bmc/access.go
Go
go
3,342
permissive
package bmc import ( "net" "net/url" "strings" "github.com/pkg/errors" ) // AccessDetailsFactory describes a callable that returns a new // AccessDetails based on the input parameters. type AccessDetailsFactory func(parsedURL *url.URL) (AccessDetails, error) var factories = map[string]AccessDetailsFactory{} //...
8a607bb545a210655bde5645d74386be17778fec
1084a635772ce6f425471a7d3dda5b48f882a342
randydom/blog
/api/pkg/remind/remind.go
Go
go
3,049
permissive
package remind import ( "net/url" "strconv" "time" model2 "app/provider/model" "github.com/goapt/golib/convert" "github.com/goapt/golib/robot" "github.com/goapt/logger" "github.com/ilibs/gosql/v2" "app/config" "app/pkg/aesutil" ) func StartCron() { t := time.NewTicker(60 * time.Second) for t1 := range ...
994dc4977a745681675f29d82be6bbe22bb10645
21f01049607ff1fd4515fb2edefe6524cbc94475
enobufs/go
/tests/e2e/list_all_channel_group_test.go
Go
go
3,349
permissive
package e2e import ( "testing" "time" pubnub "github.com/pubnub/go" "github.com/pubnub/go/tests/stubs" "github.com/stretchr/testify/assert" ) func TestListAllChannelGroupNotStubbed(t *testing.T) { assert := assert.New(t) pn := pubnub.NewPubNub(configCopy()) _, _, err := pn.ListChannelsInChannelGroup(). Ch...
f0181740eefd4712e47e0000e2531c6e4d0c3f8a
5ce2e7d62da5f6e92b424a01414afc4aec5fe4d9
KennyUng/Golang-Study
/Web-Dev/creating-http/005/05/main.go
Go
go
369
no_license
package main import ( "io" "net/http" ) func hotdog(w http.ResponseWriter, r *http.Request) { io.WriteString(w, "hotdog") } func burger(w http.ResponseWriter, r *http.Request) { io.WriteString(w, "burger") } func main() { http.Handle("/hotdog", http.HandlerFunc(hotdog)) http.Handle("/burger", http.HandlerFun...
6d9c98bb43e90cd30c24dff0d35c67811b7ae745
20ce99826e2a35e80cf01041eb11680447db3953
solo-io/gloo
/test/gomega/matchers/contain_headers.go
Go
go
867
permissive
package matchers import ( "net/http" "github.com/onsi/gomega" "github.com/onsi/gomega/gstruct" "github.com/onsi/gomega/types" "github.com/solo-io/gloo/test/gomega/transforms" ) // ContainHeaders produces a matcher that will only match if all provided headers // are completely accounted for, including multi-valu...
e52209251f275ba1ded41aac1f2b25b638bbaa72
4fe5c7584dc2b9d574f4ea92c78a4d070a8c20f0
wzt3309/k8sconsole
/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_subjectaccessreview_expansion.go
Go
go
1,083
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 ...
1fa3e04030a6d7b677100d15c7ae2ceb17f7bf16
cfe58a3359553cd68afb145c78d9b9c09302a2a3
jdcloud-api/jdcloud-sdk-go
/services/jdfusion/apis/GetDisks.go
Go
go
2,873
permissive
// Copyright 2018 JDCLOUD.COM // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
09aa5f656aa8708618441eacacfccfd3f18fdcf4
e1aaf5f48b4a4d65fb4b3fb0f9234eec330e3866
mattevans/dinero
/cache.go
Go
go
1,417
permissive
package dinero import ( "fmt" "time" cache "github.com/patrickmn/go-cache" ) // CacheService handles in-memory caching of our rates. type CacheService struct { client *Client store *cache.Cache } // NewCacheService creates a new handler for this service. func NewCacheService( client *Client, store *cache.Ca...
ee41c43eedcee1f8b633c9cf6974cd0d6333e32c
04e07642e32e3a03b745255ff8e3c1b8d0824eb6
kmcdon83/sdk-go
/samples/kafka/sender/main.go
Go
go
1,361
permissive
package main import ( "context" "log" "github.com/Shopify/sarama" "github.com/google/uuid" "github.com/cloudevents/sdk-go/protocol/kafka_sarama/v2" cloudevents "github.com/cloudevents/sdk-go/v2" ) const ( count = 10 ) func main() { saramaConfig := sarama.NewConfig() saramaConfig.Version = sarama.V2_0_0_0 ...
5b5687ccf0e373947c89260e3358bf1fec8663a6
4ef21efe881f2465b8385c79f64c104952f27e08
kazukiyoshida/go-gin-tutorial
/handlers.article.go
Go
go
696
no_license
package main import ( "net/http" "strconv" "github.com/gin-gonic/gin" ) func showIndexPage(c *gin.Context) { articles := getAllArticles() render(c,gin.H{ "title": "Home Page", "payload": articles},"index.html") } func getArticle(c *gin.Context) { if articleID, err := strconv.Atoi(c.Param("ar...
a59bd15e25c3f4e074673c74420bd90cc7e8ecb1
bb028b4ef3f4c21f1167e185a8c30dcb7647b65d
mojtaba-eshghie/AZ-GoLang-for-Researchers
/10/main.go
Go
go
210
no_license
package main import ( "os" "net/http" "fmt" ) func main() { resp, err := http.Get("http://google.com/") if err != nil { fmt.Println("Error: ", err) os.Exit(-1) } else { fmt.Println(resp) } }
92641c696e0002bb44c6418c689e2ad5ee34e778
2c63e8c742eb9eb3f75bc047b177e5d43d73e50b
kumahq/kuma
/pkg/test/network.go
Go
go
377
permissive
package test import ( "fmt" "net" ) func GetFreePort() (int, error) { port, err := FindFreePort("") return int(port), err } func FindFreePort(ip string) (uint32, error) { ln, err := net.Listen("tcp", fmt.Sprintf("%s:0", ip)) if err != nil { return 0, err } if err := ln.Close(); err != nil { return 0, err...
9e0f78531cb00fe79f75fd033957219886d8b09e
4ac5d45c58bd137e94eea3f4f1cca83e149b2de3
BinduPushparaj/firefly
/internal/i18n/en_translations.go
Go
go
18,411
permissive
// Copyright © 2021 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 // // 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 // // Unle...
fa8f346e319e6e55251e61e524e3fb92e229e97e
b3cc11a0998db01bffc0412f624fcdf2b57bd227
dannym87/go-notes-app
/middleware.auth.go
Go
go
416
no_license
package main import ( "github.com/gin-gonic/gin" ) func NewAuthMiddleware(app *App) gin.HandlerFunc { return func(c *gin.Context) { resp := app.oauth2Server.NewResponse() defer resp.Close() if ir := app.oauth2Server.HandleInfoRequest(resp, c.Request); ir != nil { c.Set("token", ir.AccessData) } if re...
c2f64e937df4aa82a43be1d5d4368060b21030d3
6298db7e2ae23afda88d291afbdd75123d073ade
pydio/minio-srv
/cmd/storage-rest-common.go
Go
go
1,779
permissive
/* * Minio Cloud Storage, (C) 2018 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...
0528e8e80b477f41dbdd0c7014f627327eac1fb8
e17bb5ab1ce8ffa5dc93d199217e2ed1f3ab5dd6
supcik/gelakelevel
/basic_test.go
Go
go
1,144
permissive
// Copyright 2019 Jacques Supcik // // 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 ...
af0e906d64d932652f888f9b0ffc509b70ab6960
e9027f81e97138a3fd7cbcacd02820a282ccf339
morrell/pulumi-azure-native
/sdk/go/azure/dbformysql/v20171201/firewallRule.go
Go
go
5,381
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 v20171201 import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // Represents a server firewall rule. ty...
106e8fef466bf8de31331cf42826739c19c65009
a864be720723690a494c95cfc5d9f173386ed351
nebi-frame/gvisor
/runsc/boot/controller.go
Go
go
15,243
permissive
// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
3df853da2f35a4543023f0ee13b8b1c00db4dbcf
96016b218ab54681e59e218a6901794254f651ef
wsfy15/leetcode
/go/src/327.区间和的个数.go
Go
go
452
no_license
/* * @lc app=leetcode.cn id=327 lang=golang * * [327] 区间和的个数 */ // @lc code=start func countRangeSum(nums []int, lower int, upper int) int { res := 0 n := len(nums) preSum := make([]int, n+1) for i := 1; i <= n; i++ { preSum[i] = preSum[i-1] + nums[i-1] for j := 0; j < i; j++ { val := preS...
4d6cc6df5c279174d80864ac2070d6b4fa68e2a5
9db60c403ca15db29e2eda112035c955fda4e20d
sillyhatxu/docker-ui
/main.go
Go
go
542
no_license
package main import ( "flag" "fmt" "github.com/sillyhatxu/docker-ui/api" "github.com/sillyhatxu/docker-ui/config" "github.com/sirupsen/logrus" "os" ) func init() { flag.StringVar(&config.Conf.ServerHost, "p", "0.0.0.0:8080", "local server address") flag.Usage = func() { fmt.Println(fmt.Sprintf("Usage of %s:...
548db087a8293d771a5cdf1042521c0c08458789
1506245bfd38232afc92cf692c158faefdcd3c0c
bookerzzz/aerospike-client-go
/batch_command.go
Go
go
3,224
permissive
// Copyright 2013-2015 Aerospike, 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 t...
3716473b34c22075ca0025dc59bffd790cd33012
a983de1c3587798b0dd7872b82b8a7547f068ce9
wrxcode/deploy-server
/docker/aaa.go
Go
go
750
permissive
package docker import ( "os/exec" "bytes" "time" "fmt" ) func aaa() { cmd := exec.Command("", []string{}...) outbuf := new(bytes.Buffer) errbuf := new(bytes.Buffer) cmd.Stderr = errbuf cmd.Stdout = outbuf cmd.Start() flag := 0 time.AfterFunc(60*time.Second, func() { flag = 3 }) go func() { err :...
d47bd6f8df5c2602554ee0cb4025ac16b5086e7f
7312e24b20827855b17e0daad633f590b35fbd05
jiaoww/gin-admin
/internal/app/routers/api/ctl/c_user.go
Go
go
6,329
permissive
package ctl import ( "strings" "github.com/gin-gonic/gin" "github.com/jiaoww/gin-admin/internal/app/bll" "github.com/jiaoww/gin-admin/internal/app/ginplus" "github.com/jiaoww/gin-admin/internal/app/schema" "github.com/jiaoww/gin-admin/pkg/util" ) // NewUser 创建用户管理控制器 func NewUser(bUser bll.IUser) *User { retu...
e788bde98f38cf337adc8717315114594bbcf998
0347c4b986a6f7d38cd39a7859746fc3b3a8354f
deepglint/streamtools
/st/library/count.go
Go
go
2,183
permissive
package library import ( "container/heap" "time" "github.com/deepglint/streamtools/st/blocks" // blocks "github.com/deepglint/streamtools/st/util" ) type Count struct { blocks.Block queryrule chan blocks.MsgChan querycount chan blocks.MsgChan inrule blocks.MsgChan inpoll blocks.MsgChan clear ...
a059dd44176209e05d31509f60f8d16724f94252
430f54d8ceace3cdf1e137ef763a17ff7e3f4422
jin502437344/gf
/.example/os/gfsnotify/gfsnotify_limit.go
Go
go
384
permissive
package main import ( "github.com/jin502437344/gf/os/gfsnotify" "github.com/jin502437344/gf/os/glog" ) // 对同一个文件多次Add是否超过系统inotify限制 func main() { path := "/Users/john/temp/log" for i := 0; i < 9999999; i++ { _, err := gfsnotify.Add(path, func(event *gfsnotify.Event) { glog.Println(event) }) if err != ni...
3649326ef312808b2e0bf03a4d629fd8c3dba767
955121b319a408e2e3a9cf32c560210f8bf98f29
steiler/gnmic
/examples/pkg/set_rpc/main.go
Go
go
1,447
permissive
// © 2022 Nokia. // // This code is a Contribution to the gNMIc project (“Work”) made under the Google Software Grant and Corporate Contributor License Agreement (“CLA”) and governed by the Apache License 2.0. // No other rights or licenses in or to any of Nokia’s intellectual property are granted for any other purpose...
770b66d9cef4226bcfac3ca8d6956cbd1ddaaded
a446b01dafd9588e8f8b4fef2e814d903263a90d
alika/cma-operator
/pkg/util/cmagrpc/cma.go
Go
go
1,811
permissive
package cmagrpc import ( "context" "crypto/tls" pb "github.com/samsung-cnct/cluster-manager-api/pkg/generated/api" "github.com/spf13/viper" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) type Client struct { conn *grpc.ClientConn client pb.ClusterClient } func CreateNewClient(hostname stri...
5dfda54ebbb2d62f37c933cd8797c5d774883d3e
8f169a9363baae33d42eb05e39c0643926df519e
universelabs/universe-storage
/internal/config/config.go
Go
go
1,176
permissive
package config import ( "github.com/universelabs/universe-server/storage" "github.com/spf13/viper" ) type Constants struct { Port string StormDB struct { Path string exists bool } } func initViper() (Constants, error) { // config filename and path viper.AddConfigPath("./config") viper...
99859cd0cb7a6bf2f8d4dfe7615113417bfd3033
6285cd67755d14951b67a959dbeb81c27ba8be18
MartinHeinz/faas
/watchdog/requesthandler_test.go
Go
go
13,407
permissive
// Copyright (c) Alex Ellis 2017. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. package main import ( "bytes" "fmt" "io/ioutil" "log" "net/http" "net/http/httptest" "os" "path/filepath" "strings" "testing" "time" ) func TestHandl...
7dc6d9d71de456add96883fcd9729324c2b61180
bb33b9523fcdbbd871c886c8c9bd50468a0aa778
dadjeibaah/smi-sdk-go
/pkg/apis/specs/v1alpha1/tcp_route.go
Go
go
1,097
permissive
package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // +genclient // +genclient:noStatus // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // TCPRoute is used to describe TCP inbound connections type TCPRoute struct { metav1.TypeMeta `json:",inline"` // Standard object'...
3bc33484f39263f18777a9870d781098d2d7024d
775f7233b6812408515b1f163e65aacee41707a9
RonaldCrb/go-pg-rest-api
/users/model.go
Go
go
3,147
no_license
package users import ( "errors" "log" "time" "github.com/RonaldCrb/go-pg-rest-api/config" ) // User represents a user instance type User struct { ID int FirstName string LastName string Password string Email string CreatedAt time.Time UpdatedAt time.Time } // CreateUser creates a new user in...
dc1cfeced5e3b1ff1788b759e9f3d9ec85e4c19e
740fd9a7b889c6939249f0ea602bb088bbdf3b44
symcn/istio
/istioctl/cmd/root.go
Go
go
12,324
permissive
// Copyright Istio 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 wri...
9d30d81d7fbaaf72fdac7fa2e9708100e5731eb4
3f41da221195aa13a7826818f467de4f9684e420
vodafon/cryptopals
/set1/c6_break_repeating_key_xor/break_repeating_key_xor.go
Go
go
1,706
no_license
package c6_break_repeating_key_xor import ( "errors" "sort" "github.com/vodafon/cryptopals/set1/c3_single_byte_xor" ) type keyElem struct { pos int value byte } func HammingDistance(s1, s2 []byte) int { if len(s1) != len(s2) { panic(errors.New("sources are not the same length")) } diff := 0 for i := 0...
57347c17fee2dabccc22d2c2b3815cd93b32c36c
ff7f1e72869e8e1068a09133fb8a77de5c659ce2
mygirl8893/swipechain-node
/bifrost/thorclient/types/tx_out.go
Go
go
2,178
permissive
package types import ( "crypto/sha256" "fmt" "strings" "gitlab.com/thorchain/thornode/common" ) type TxOutItem struct { Chain common.Chain `json:"chain"` ToAddress common.Address `json:"to"` VaultPubKey common.PubKey `json:"vault_pubkey"` SeqNo uint64 `json:"seq_no"` Coins com...
792af52dc13ce8ccb828c7afb021bd3912edf86b
08386d6b5b18d0e64de6eabaf6f076e7ffac69ae
openshift/installer
/pkg/asset/installconfig/installconfig.go
Go
go
7,128
permissive
package installconfig import ( "context" "fmt" "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/validation/field" "github.com/openshift/installer/pkg/asset" "github.com/openshift/installer/pkg/asset/installconfig/alibabacloud" "github.com/openshift/installer...
1dd0f5d96d3a88ffd5c5ab0eab67f3ed363151b7
36c7da63b4a0438048f67270f9d51bc1a0f5ce53
Victonator/thomas-disco
/pkg/music/youtube.go
Go
go
6,968
permissive
package music import ( "context" "encoding/json" "errors" "fmt" "log" "net/http" "net/url" "strconv" "strings" "time" ytdl "github.com/kkdai/youtube/v2" "google.golang.org/api/option" "google.golang.org/api/youtube/v3" ) func getDuration(stringRawFull, stringRawOffset string) (stringRemain string) { va...
585e5042d698781e6052c3af0e97a0c9942224f8
b835309d1ac4fc0a8d05a45863388bd5e03cfb3c
NecroMan/go-logging
/handler_stdout.go
Go
go
1,147
permissive
package logging import ( "os" ) type StdoutStream struct { stdout *os.File } func NewStdoutStream() *StdoutStream { return &StdoutStream{ stdout: os.Stdout, } } func (self *StdoutStream) Tell() (int64, error) { // Stdout.Stat().Size() always return 0 return 0, nil } func (self *StdoutStream) Write(s string...
a86e785c82190e5e7b31427a78c202f9421c97af
f4596ab1f1090177ae1ad149659fd30a7e4c14b7
martinlindhe/base36
/example_test.go
Go
go
480
permissive
package base36_test import ( "fmt" "github.com/martinlindhe/base36" ) func ExampleEncode() { fmt.Println(base36.Encode(5481594952936519619)) // Output: 15N9Z8L3AU4EB } func ExampleDecode() { fmt.Println(base36.Decode("15N9Z8L3AU4EB")) // Output: 5481594952936519619 } func ExampleEncodeBytes() { fmt.Println...
6379a996853684f02af379e58a86bfa794bbb7a1
5d02722056b62f983d1f8ba73be00422d1a011e9
modasi/mika
/tracker/announce.go
Go
go
12,026
permissive
package tracker import ( "bytes" "github.com/chihaya/bencode" "github.com/gin-gonic/gin" "github.com/leighmacdonald/mika/consts" "github.com/leighmacdonald/mika/metrics" "github.com/leighmacdonald/mika/store" "github.com/leighmacdonald/mika/util" log "github.com/sirupsen/logrus" "net" "sync/atomic" "time" )...
e5ea946703894a74ef5b43de9f8aba0685693576
a37080c4d503adfde0ced997b73c38a96ffaee9f
Djoulzy/ZUMBY
/main/server.go
Go
go
4,128
no_license
package main import ( "encoding/json" "runtime" "syscall" "github.com/Djoulzy/ZUMBY/hub" "github.com/Djoulzy/ZUMBY/nettools/httpserver" "github.com/Djoulzy/ZUMBY/nettools/scaling" "github.com/Djoulzy/ZUMBY/nettools/tcpserver" "github.com/Djoulzy/ZUMBY/urlcrypt" "github.com/Djoulzy/ZUMBY/world" "github.com/...
7b52ad8583c76940a03e620ab30f9601f92b4c22
fc6d15f5a55622286af19c21de4cc761b6e7c41c
obsermo/kubeadm
/kinder/hack/orderimports/orderimports.go
Go
go
11,602
permissive
/* Copyright 2021 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
b83a2243732169954dbbcc522fc8dc73f1eac194
9be2ac20f69db155152a4a08ab5fd817597d4b46
ratchaneego/mygod
/myapi/json2struct.go
Go
go
347
no_license
package main import ( "encoding/json" "fmt" ) type Todo struct { ID int `json:"id"` Title string `json:"title"` Status string `json:"status"` } func main() { data := []byte(`{ "id": 1, "title": "pay credit card", "status": "active" }`) var t Todo err := json.Unmarshal(data, &t) fmt.Printf("% #v\...
1ae051cafd65905ea0c2520c3f61bf109fdc936a
2c8a1d8ed1d2ebe791eac0d696a43d639275b3a1
sildevTeam/silOSS
/backend/storage/index.go
Go
go
6,782
permissive
package storage import ( "bytes" "encoding/binary" "errors" "fmt" "io" "os" "silOSS/backend/utils/mmap" "sync" ) const ( indexVersion = 1 indexMagic = "SILOSS" indexHeaderSize = 0 + 6 + 1 + // magic &version 8 + // max offset 8 + // total size 0 indexSlotSize = 0 + 4 + // fId 4 + // ch...
0005ca29d08210b959843b61a2871d18bc1f5fa2
4730cd7aa7b2c669f5f7c9df44b0806860176510
epsylonix/cryptopals
/cryptopals/3_24_mt19937_cypher.go
Go
go
1,438
permissive
package cryptopals import ( "errors" "time" ) type set324EncryptorDecryptor struct { seed int mt *mtRand } func newSet324ED(key uint16) set324EncryptorDecryptor { return set324EncryptorDecryptor{ seed: int(key), } } func newSet324CurTimestampED() set324EncryptorDecryptor { return set324EncryptorDecryptor...
eae5147f1a5993f344b45d316439feb8cb2814d4
1179aae09f52302439bffe33c5ce5f0bdd275312
open-telemetry/opentelemetry-collector-contrib
/receiver/filestatsreceiver/factory.go
Go
go
1,483
permissive
// Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 package filestatsreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filestatsreceiver" import ( "context" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opente...
3bcd7ac2afd6b0005eac5bd12fe5115ac918376f
192e2f405938f32570084b997c361e7eaf75b638
mchirico/mock-playground
/pkg/idea/s_test.go
Go
go
1,894
no_license
package idea import ( "github.com/golang/mock/gomock" Mocks "github.com/mchirico/mock-playground/pkg/mocks" "github.com/stretchr/testify/assert" "testing" ) func TestS_Foo(t *testing.T) { controller := gomock.NewController(t) defer controller.Finish() MockInterface := Mocks.NewMockIDEA(controller) first := ...
3184c3341a49f1ff857e1c264d5c2258e746fd90
79c3f96cedb71144d598962571aa1bd85b92af3f
shylasrinivas/vsphere-automation-sdk-go
/services/nsxt/global_infra/tier_1s/locale_services/interfaces/DadStateClient.go
Go
go
1,077
permissive
/* Copyright © 2019 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: BSD-2-Clause */ // Code generated. DO NOT EDIT. /* * Interface file for service: DadState * Used by client-side stubs. */ package interfaces import ( "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) type DadSta...
54a4056880a85238578f4271e338c3b66f65c2b8
a40fe2807b6e66524fda925d574b45c64d4709ec
sagikazarmark/modern-go-application
/internal/platform/database/config_test.go
Go
go
1,041
permissive
package database import ( "testing" "github.com/stretchr/testify/assert" ) func TestConfig_Validate(t *testing.T) { tests := map[string]Config{ "database host is required": { Port: 3306, User: "root", Pass: "", Name: "database", }, "database port is required": { Host: "localhost", User: "r...
863b868bde5ee831eeb5c78eef7b8c2f83dc14e8
e4529be1bd78f6e610e8f37d5065a6ab3d128e8b
guoyu07/gate-proxy
/backend.go
Go
go
3,873
no_license
package gateway import ( "fmt" "io/ioutil" "net/http" "time" ) // Status . 服务状态 type BackendStatus int func (status BackendStatus) String() string { switch status { case BackendDown: return "下线" case BackendUp: return "上线" } return "未知" } const ( // Down 下线 BackendDown BackendStatus = iota + 1 // Up...
5c4e5dba45673465f95a260249a80efe9d3ca53e
87a57b3ac04f83bc91c30fdfda4dbf5700ee0189
zhipenwang/dtm
/examples/base_types.go
Go
go
2,010
permissive
package examples import ( "database/sql" "fmt" "github.com/gin-gonic/gin" "github.com/yedf/dtm/common" "github.com/yedf/dtm/dtmcli" "github.com/yedf/dtm/dtmgrpc" ) // M alias type M = map[string]interface{} // DtmServer dtm service address const DtmServer = "http://localhost:8080/api/dtmsvr" // DtmGrpcServer...
a5a4b0d6796abaed467e96fc9a20192390d30900
8859ce0466c00da7ec8749e0e03ef18dfc7795f3
mikeqian/beego
/validation/validation_test.go
Go
go
10,947
permissive
// Copyright 2014 beego Author. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applica...
efc18bf98626ee8d86d13763c42507eaa0ec5576
3e5fee30ca6e6988636e0bab29fc65ad93a25a50
fadeAce/dendrite
/src/github.com/matrix-org/dendrite/appservice/workers/transaction_scheduler.go
Go
go
7,015
permissive
// Copyright 2018 Vector Creations Ltd // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
cdc6bef7c46a360e9262cd3ed532b5c6d03aac46
3c935ca4ad9b5d4c8fee43b7a416d9923a1a3f66
spursy/generate-micro
/template/proto.go
Go
go
404
no_license
package template var ( ProtoSRV = `syntax = "proto3"; package {{dehyphen .Alias}}; service {{title .Alias}}Dispatcher { // Demo rpc GetDemo(DemoRequest) returns (DemoListReply) {} } message DemoRequest { string k = 1; } message DemoListReply { int32 status = 1; string message = 2; repeated DemoObject d...
dbbccc2f22b5567fdbb9807dd45d1f0aca4cb632
302ecdbbd1fac08b4cbf36714c164bf1f3668707
anovakovic01/mainflux
/readers/postgres/messages.go
Go
go
3,439
permissive
// Copyright (c) Mainflux // SPDX-License-Identifier: Apache-2.0 package postgres import ( "errors" "fmt" "github.com/jmoiron/sqlx" // required for DB access "github.com/mainflux/mainflux/readers" "github.com/mainflux/mainflux/transformers/senml" ) const errInvalid = "invalid_text_representation" var errInval...
779c7828bc2e84eaf14192767475176e64359ee7
a1610388e0cb25df3136aca4e35664b7b9ddaaae
gregoryfranklin/jaeger-operator
/pkg/ingress/query_test.go
Go
go
2,859
permissive
package ingress import ( "fmt" "testing" "github.com/stretchr/testify/assert" "github.com/jaegertracing/jaeger-operator/pkg/apis/io/v1alpha1" ) func TestQueryIngress(t *testing.T) { name := "TestQueryIngress" jaeger := v1alpha1.NewJaeger(name) ingress := NewQueryIngress(jaeger) dep := ingress.Get() asser...
4204d5dfb8770d7301173340e39bef91378e8475
488e22f1fd6d1808c644c0ec3eed887cfbd856f3
yobert/ldap-report
/report.go
Go
go
694
permissive
package main import ( "html/template" "os" ) var tmpl = template.Must(template.New("").Parse(` <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>LDAP report</title> <link rel="stylesheet" href="main.css"></link> <script src="m...
a502febe2e52598978fe4dfbd22d82e29266c127
78b817b6dc1ee99bae504c2301a710a490c2383f
belgradio/lxd
/lxd/container_snapshot.go
Go
go
11,379
permissive
package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "net/url" "strings" "time" "github.com/gorilla/mux" "github.com/lxc/lxd/lxd/db" "github.com/lxc/lxd/lxd/instance" "github.com/lxc/lxd/lxd/operations" "github.com/lxc/lxd/lxd/response" "github.com/lxc/lxd/lxd/util" "github.com/l...
753ce6f38d18e8b0db2c2c89c4e7b8864b4a8661
55c9dedb1b8ff8eed40d586afa01b3ef5c0583f6
raa0121/GoBCDice
/pkg/core/object/r_roll_comp_result_test.go
Go
go
1,048
permissive
package object import ( "fmt" "testing" ) func TestRRollCompResult_Inspect(t *testing.T) { testcases := []struct { obj *RRollCompResult expected string }{ { obj: &RRollCompResult{ ValueGroups: NewArray( NewArray( NewInteger(3), NewInteger(1), ), NewArray( NewInte...
045889cce02686ae1a9cd90da982de393c28ee4a
8664719134da633ce08a1736d9bd5724b87913a6
richardartoul/m3db
/storage/options.go
Go
go
15,673
permissive
// Copyright (c) 2016 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge...
ffab98194dde2c8d80f196fe6448e5f60e6348ce
4db50cfaf9b9bfaa7dc780355403eb830b55f866
animenotifier/arn
/Anime.go
Go
go
24,210
permissive
package arn import ( "errors" "fmt" "sort" "strconv" "strings" "time" "github.com/aerogo/nano" "github.com/animenotifier/arn/validate" "github.com/animenotifier/twist" "github.com/akyoto/color" "github.com/animenotifier/kitsu" "github.com/animenotifier/shoboi" ) // AnimeDateFormat describes the anime da...
e44d6378927597f904ddd2ab2f66cfefe8023dc8
edcd6d1c9bd3d63c68e694d4e4b07459d65aa29b
AccelByte/accelbyte-go-sdk
/platform-sdk/pkg/platformclient/wallet/list_user_currency_transactions_responses.go
Go
go
5,029
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. // Code generated; DO NOT EDIT. package wallet import ( "encoding/json" "fmt" "io" "io/ioutil" "strings" "github.com/go-openapi/...
7d79d82380f0579915805c5b5bfbd9848391b054
e56e54ebb8a95ce12b0caaf1e00b2b67e962b357
openshift/installer
/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_location.go
Go
go
3,643
permissive
package webpubsub import ( "fmt" "strings" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" ) var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string LocationName string } // NewLocati...
f08932271546710776af55068387aeaead8b1a7f
e3a5aa60c891daf2867052598fc0e4ad7e3c95c6
jasonodonnell/postgres-operator
/apiserver/backupservice/backupimpl.go
Go
go
6,915
permissive
package backupservice /* Copyright 2017-2018 Crunchy Data Solutions, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
cd9d58855597f0a7f9b388ad544d04b792bc1a4c
eff6cac3724cb4570690828370ed23b36b997541
ZeroTechh/UserService
/core/user/userMeta/main.go
Go
go
2,058
permissive
package userMeta import ( "context" "time" "github.com/ZeroTechh/UserService/core/types" "github.com/ZeroTechh/VelocityCore/logger" "github.com/ZeroTechh/VelocityCore/utils" "github.com/ZeroTechh/hades" "go.mongodb.org/mongo-driver/mongo" ) var ( // all the configs config = hades.GetConfig("main.ya...
b10f208430010cce395572689b216c0b4fecfb90
9f37df1cdff360bfc75e4f6f1193a20d27aec0f5
kubesphere/kubesphere
/vendor/k8s.io/apiserver/pkg/server/handler.go
Go
go
8,451
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, ...
0100027bd9bccd66b9164f11ee25145172f0359f
c07fecf22a7c56ff87a525224307b7387b354705
huaweicloud/huaweicloud-service-broker
/vendor/github.com/gophercloud/gophercloud/acceptance/clients/clients.go
Go
go
15,959
permissive
// Package clients contains functions for creating OpenStack service clients // for use in acceptance tests. It also manages the required environment // variables to run the tests. package clients import ( "fmt" "net/http" "os" "strings" "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/o...
3c56bbbd77a1dec797143057b98422713eed3663
715ede15db2eb398f6a67f959e22faadc2c79d84
digitalbitbox/bitbox-wallet-app
/vendor/github.com/ethereum/go-ethereum/core/types/transaction.go
Go
go
20,182
permissive
// Copyright 2014 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum 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...
3af435140218dca5aaaad1d1d5b45064d30c96f7
bf45a099b73391b1de0e1cbba5467a1a8c629e9d
ggncnt/go
/services/horizon/internal/actions_ledger.go
Go
go
3,184
permissive
package horizon import ( "github.com/ggncnt/go/services/horizon/internal/db2" "github.com/ggncnt/go/services/horizon/internal/db2/history" "github.com/ggncnt/go/services/horizon/internal/ledger" "github.com/ggncnt/go/services/horizon/internal/render/hal" "github.com/ggncnt/go/services/horizon/internal/render/prob...
705c85c5695d5fa40dd4da5c467d4f9ffcda10d3
b6d7d844b93c444c3037b2a4fd14ac1c9abf81a9
owncloud/ocis
/services/notifications/pkg/service/shares.go
Go
go
2,944
permissive
package service import ( "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/utils" "github.com/owncloud/ocis/v2/services/notifications/pkg/email" "google.golang.org/protobuf/types/known/fieldmaskpb" ) func (s eventsNotifier) handleShareCreated(e events.ShareCreated) { logger := s.logger.With()...
77222d77c1067efd7fe2fa66911542006ff7aadc
7a2d77a9fdfcc817e7270595907250e8100eebf5
alisw/arrow
/go/arrow/array/fixed_size_list.go
Go
go
8,065
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...
4b8010e572df6fc7a45f5fe75fceea1b02d6b441
5be86b07fc4e14aa30c36b81ea7acd2eedc5006f
chuckha/appenv
/programs/binary.go
Go
go
777
no_license
package programs import "os/exec" type Binary struct { Command string Args []string } func (b *Binary) Version() ([]byte, error) { return exec.Command(b.Command, b.Args...).CombinedOutput() } func (b *Binary) GetCommand() string { return b.Command } var ( Python = &Binary{ Command: "python", Args: []...
3b2e35727d82ee12ac22897b50847890aa975c72
3d4a7887d2321e5ee782adb9979b92c8e70558e2
kevinlincg/gf
/encoding/gtoml/gtoml.go
Go
go
1,014
permissive
// Copyright 2017 gf Author(https://github.com/gogf/gf). 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 gtoml provides accessing and converting for T...
1bf36797f737b29fe2f97c6d56829e1ee1d6231b
3b403752d423e619b5605125ac794b8c4313d93c
SilenceHVK/blog
/golang/basic/goroutine/context_test.go
Go
go
4,588
permissive
package goroutine import ( "context" "fmt" "testing" "time" ) /* Context 是 Go 1.7 加入的新的标准库, 它定义了 Context 类型,专门用来处理请求的多个 goroutine 之间与请求域的数据、取消信号、截止时间等相关操作。 对服务器传入的请求应该创建上下文,而对服务器传出调用应该接手上下文,它们之间的函数调用链必须传递上下文,或者可以使用 WithCancel、WithDeadline、WithValue 创建的派生上下文。当一个上下文取消时, 它派生的所有上下文也被取消。 context.Context 是一个接口,定...
ed48a65409efbde7abae2f14adc565e2fac5dd1c
a7c894082c8a9b6b3b80331df334fcadf3bed141
hSATAC/miyabi
/server_test.go
Go
go
3,496
permissive
package miyabi_test import ( "net" "net/http" "os" "syscall" "testing" "time" "github.com/naoina/miyabi" ) const ( addr = "127.0.0.1:0" ) func newTestListener(t *testing.T) net.Listener { l, err := net.Listen("tcp", addr) if err != nil { t.Fatal(err) } return l } func TestServer_Serve(t *testing.T) {...
95612fe44eb28f9f90409ef69604dcd58bc6e92f
9ad27de850eae1556ac5e579c8f267b9eb19af78
Sylvi21/kubernetes-operator
/pkg/configuration/base/resources/builder.go
Go
go
4,212
permissive
package resources import ( "fmt" jenkinsv1alpha2 "github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" logf "sigs.k8s.io/controller-runtime/pkg/log" ) const ( NameWithSuffixFormat = "%s-%s" PluginDefinitionFormat ...
d9e2274c39dfa1b403b4fd8ab80de60ba35b7eab
d1f511f898f0838c50c6f0d77971bfb50cc6625e
Mjolnir42/soma
/cmd/soma/main__error_stack.go
Go
go
754
permissive
/*- * Copyright (c) 2018, Jörg Pernfuß * * Use of this source code is governed by a 2-clause BSD license * that can be found in the LICENSE file. */ package main // import "github.com/mjolnir42/soma/cmd/soma" // The error stack is used to defer returning errors from functions // where the function signature is c...
988e5aa919a8cbcd6ed631592b33c41f5cf2e2b1
ba6e715782c4427e00c6ae18fbc004e24f88ef55
inwinstack/pango
/netw/interface/loopback/pano_test.go
Go
go
3,123
permissive
package loopback import ( "testing" "reflect" "github.com/inwinstack/pango/version" "github.com/inwinstack/pango/testdata" ) func TestPanoNormalization(t *testing.T) { testCases := []struct{ version version.Number tmpl string vsys string importVsys string ...
1e8e21a4ca7101a8611e002171918d7135b6b55c
8e5ae634ffac3238d1dc3a405e9c2728d925be94
geemo/test
/go/src/worker/worker.go
Go
go
384
no_license
package worker import ( "fmt" "log" "worker/file" ) // Worker 工作协程 func Worker(in, out chan *file.File, wid int) { for { fmt.Printf("worker: %v\n", wid) f := <-in process(f) out <- f } } func process(f *file.File) { err := f.ReadFile() if err != nil { log.Fatalf("file read failed, error is: %v\n", e...
d4b5c7ccc90ddac2be718e166c00b0032b7970fd
b3365cea00095e09e07f0782e69f2562fd86f7e8
bcrochet/kni-installer
/pkg/asset/machines/azure/machines.go
Go
go
3,283
permissive
// Package azure generates Machine objects for azure. package azure import ( "fmt" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "github.com/openshift-metalkube/kni-installer/pkg/types" "github.com/openshift-metalkube/kni-in...
5cb2369ee37214a837444d76d6d197e23dbfa4c5
b6d714ce22a3269f1f128e25ee32117d6931d9dd
yrj2011/my-test-infra
/prow/config/config.go
Go
go
40,414
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, ...
22b2c8e7bce2f5cc48566e55cb78044e6874ba92
7074b58524502db714913b4361283935fda86640
GeoNet/delta
/tools/chart/tsunami.go
Go
go
3,907
permissive
package main import ( "sort" "time" "github.com/GeoNet/delta/internal/metadb" ) func (cp ConfigPage) Tsunami(base string) ([]Page, error) { db := metadb.NewMetaDB(base) var pages []Page chans := make(map[string]interface{}) for _, c := range cp.Options.Channels() { chans[c] = true } var plots []Plot ...
988085d14c1d47d7586f4bc6749d78b503ece303
3a1d4dc5ac1edb5d990e96a72ca22a484ca48e98
cgwyx/go-filecoin
/internal/pkg/vm/internal/vmcontext/actor_store.go
Go
go
1,211
permissive
package vmcontext import ( "context" "fmt" "github.com/filecoin-project/go-filecoin/internal/pkg/vm/internal/gascost" "github.com/filecoin-project/go-filecoin/internal/pkg/vm/internal/storage" specsruntime "github.com/filecoin-project/specs-actors/actors/runtime" "github.com/ipfs/go-cid" ) // actorStorage hide...
ecaeb2677035e21053455d99a74d35a2c4f70265
063e9c541d90719380bf8e13560b6faef88a819e
itsmurugappan/job-trigger
/vendor/github.com/itsmurugappan/kubernetes-resource-builder/pkg/kubernetes/corev1/podspec.go
Go
go
1,224
permissive
package corev1 import ( corev1 "k8s.io/api/core/v1" "github.com/itsmurugappan/kubernetes-resource-builder/pkg/kubernetes" ) type PodSpecOption func(*corev1.PodSpec) func GetPodSpec(spec kubernetes.PodSpec, options ...PodSpecOption) corev1.PodSpec { podSpec := corev1.PodSpec{} for _, fn := range options { fn(...
93a3cd7e05d10ac45f64c8cb1c84073db0918167
0a49d4ae9d411ddd0dafe7fda3fb6ec9292c1187
TechCafeFreedom/TODONE-server
/pkg/domain/service/user/service_test.go
Go
go
1,870
no_license
package user import ( "testing" "todone/pkg/domain/entity" "todone/pkg/domain/repository" "todone/pkg/domain/repository/user/mock_user" "github.com/gin-gonic/gin" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" ) const ( userID = 1 uid = "uid" name = "name" thumbnail = "...
558bf8b2edb847052457dacc312b2ed112297526
9583a50305297b8c74f011d26026382e1648eeb2
vvelikodny/cadence-samples
/cmd/samples/recipes/pickfirst/pickfirst_workflow_test.go
Go
go
807
no_license
package main import ( "context" "testing" "time" "github.com/stretchr/testify/suite" "go.uber.org/cadence" ) type UnitTestSuite struct { suite.Suite cadence.WorkflowTestSuite } func TestUnitTestSuite(t *testing.T) { suite.Run(t, new(UnitTestSuite)) } func (s *UnitTestSuite) Test_Workflow() { env := s.NewT...
cc19d3f5b06be4307392e55913568379a7a31dd1
88afeceeca6873b7d2370d41e3cd5a383daed596
StarWarsDev/go-legion-hq
/data_test.go
Go
go
2,636
permissive
package legionhq import ( "encoding/json" "reflect" "testing" ) const darthVaderCommanderJSON = `{ "cardType": "unit", "defense": "red", "surges": [], "speed": 1, "wounds": 8, "courage": -1, "cardSubtype": "trooper", "cardName": "Darth Vader", "title": "Dark Lord of the Sith", "isUnique": true,...
9ebfa66ff48814621103e619bbd2083514f6f67c
66625fbc5b56cc08a4199005b76939ca53ec7711
xtreme-sameer-vohra/kn-plugin-func
/vendor/github.com/buildpacks/pack/builder/config_reader.go
Go
go
2,945
permissive
package builder import ( "fmt" "os" "path/filepath" "github.com/BurntSushi/toml" "github.com/pkg/errors" "github.com/buildpacks/pack/internal/config" "github.com/buildpacks/pack/internal/style" "github.com/buildpacks/pack/pkg/dist" ) // Config is a builder configuration file type Config struct { Descriptio...
f9d2ce2076443ad55cff67c0dc328cecd34e522b
721137c225645f49d05093212f68ee7424d32fa5
mrityunjaygr8/go-contact
/app/auth.go
Go
go
1,841
no_license
package app import ( "net/http" u "go-contact/utils" "strings" "go-contact/models" jwt "github.com/dgrijalva/jwt-go" "os" "context" "fmt" ) var JwtAuthentication = func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { notAuth := []string{"/api/user/ne...
157c01a7f2be4fe2c32c2a7e45a957a6ec44b051
49c514c3ed781ead1d1ab57ce79753f69fbe95fe
ik-automation/concourse-up
/bosh/internal/gcp/gcp_test.go
Go
go
5,871
permissive
package gcp import ( "errors" "fmt" "io/ioutil" "reflect" "strings" "testing" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3/s3iface" ) type mockS3API struct { s3iface.S3API getObjectOutput *s3.GetObjectOutput err error } f...
c971c3924df49705a3482a5665b8f19232ea22ac
7f575229115207fad613ea30cfdf760c2f0196f4
qingfenghuohu/tools
/main.go
Go
go
11,253
no_license
package tools import ( "bytes" "crypto/md5" "encoding/base64" "encoding/json" "fmt" "github.com/gin-gonic/gin" "github.com/json-iterator/go" "github.com/satori/go.uuid" "io/ioutil" "log" "math/rand" "net/http" "net/url" "os" "os/exec" "reflect" "regexp" "sort" "strconv" "strings" "time" ) func Md...
95209f53c049f8d959b29adb169237591b9b17fe
e5dc239c8e9289dc3dc9a2c189bd8d9a44fc87b6
CSN123/CSCI130
/11/main.go
Go
go
374
no_license
package main import ( "io" "log" "net/http" ) func main() { // Registering the URL path and binding it to surferPage handler http.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) { io.WriteString(res, "Name: "+req.FormValue("n")) }) // Setting the listener on port 8080 log.Println("Listeni...
daf6365ab2538565fca39b7f3a0d8e07aa3737cc
898e099e6f1cf2c05069db7955262dae93fb592e
yuchengwu/kruise
/pkg/apis/apps/v1alpha1/imagepulljob_types_test.go
Go
go
1,683
permissive
/* Copyright 2020 The Kruise 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...
cd9ef98b312688933a1a77a15c0523e3a1f3263e
578b447e90a9f6433f52b4cd894d2ca71ee10b28
karlmoad/DemoJWTService
/authentication/microsoftAzure.go
Go
go
4,596
no_license
package authentication import ( "errors" "encoding/json" "log" "net/http" "strings" "time" ) var ( ErrorKeyNotFound = errors.New("key not found") ErrorMetadataFailure = errors.New("failure retrieving key metadata") ErrorKeyData = errors.New("failure getting keys") ) type microsoftKeySource struct { meta ...
2ece848d9b3713d889b0e263545b5dab97f0c402
83c1c2052406a9e3d4ecdf77b29361d3993d1ebf
google/gvisor
/pkg/sync/locking/lockdep_nolockdep_test.go
Go
go
948
permissive
// Copyright 2022 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...
183450bea40026ef4c03ff204aecdb47cde17706
57082f3eed402084640abbd382451c581092db4d
chinashuguo/go-zero
/core/load/adaptiveshedder_test.go
Go
go
5,517
no_license
package load import ( "math/rand" "sync" "sync/atomic" "testing" "time" "github.com/stretchr/testify/assert" "github.com/chinashuguo/go-zero/core/collection" "github.com/chinashuguo/go-zero/core/logx" "github.com/chinashuguo/go-zero/core/mathx" "github.com/chinashuguo/go-zero/core/stat" "github.com/chinash...