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
615c9d95ed94139f6482b7a70af032268dcc90e9
03298266c3d9a6b79b12464af16124de17577040
drone/go-scm
/scm/driver/gogs/issue_test.go
Go
go
4,849
permissive
// Copyright 2017 Drone.IO Inc. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package gogs import ( "context" "encoding/json" "io/ioutil" "testing" "github.com/drone/go-scm/scm" "github.com/google/go-cmp/cmp" "github.com/h2non/gock...
b3d1ab2f0ec5b804560a097f1e114ccce9fd53f1
e7d56e6d3ff2079152228958910ef9bf46ee54cf
hemancuso/rclone
/vendor/google.golang.org/api/dns/v2beta1/dns-gen.go
Go
go
134,187
permissive
// Package dns provides access to the Google Cloud DNS API. // // See https://developers.google.com/cloud-dns // // Usage example: // // import "google.golang.org/api/dns/v2beta1" // ... // dnsService, err := dns.New(oauthHttpClient) package dns // import "google.golang.org/api/dns/v2beta1" import ( "bytes" "e...
f8e57438fa6b5d1f8c29ae9e3b4ea8d4dbcdc92f
31e9f37012d061b33a3b5f6205859b82024e5419
Peakchen/xgameCommon
/akNet/serverPack.go
Go
go
7,393
permissive
package akNet // add by stefan import ( "github.com/Peakchen/xgameCommon/akLog" "github.com/Peakchen/xgameCommon/stacktrace" "github.com/Peakchen/xgameCommon/utils" "encoding/binary" "fmt" "github.com/golang/protobuf/proto" "reflect" ) /* model: ServerProtocol server to server, message */ type ServerProtoco...
82020f989d98f60faa650cf403be8e811e33371e
e515a282fcdec41a0ed3c7e563ab4d0c5e6f0e04
gruntwork-io/cloud-nuke
/aws/resources/sagemaker_notebook_instance.go
Go
go
3,660
permissive
package resources import ( "github.com/aws/aws-sdk-go/aws" awsgo "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/sagemaker" "github.com/gruntwork-io/cloud-nuke/config" "github.com/gruntwork-io/cloud-nuke/logging" "github.com/gruntwork-io/cloud-nuke/report" "github.com/gruntwork-io/cloud-nuke/...
bc8ed7e3a89477c3e4630fae6a1b073f4958742a
132611428aae3015df39f5bd4382592abddfe214
Michal-Stempkowski/hub
/sheet_logic/and.go
Go
go
256
no_license
package sheet_logic import ( "hub/sheet_logic/sheet_logic_types" ) type And BoolComparator func NewAnd(name string) *And { tmp := NewBoolComparator( name, sheet_logic_types.And, func(a bool, b bool) bool { return a && b }) return (*And)(tmp) }
7fc4b728fe3722b59ca4154f4db93414526c5b24
0426e2ca644a4b6edbebd9e60cea0fa0931a66b6
muhdfaiz/rest-api-go
/application/v11/notification_repository.go
Go
go
1,348
no_license
package v11 import "github.com/jinzhu/gorm" // NotificationRepository will handle all CRUD operation related to Notification resource. type NotificationRepository struct { BaseRepository DB *gorm.DB } // GetByDeviceUUIDAndBlastTypeAndEmptyUserGUIDAndType function used to retrive notification filter by device UUID ...
e997fb6c7ca298f8a9817496b6c2cde2bfd545b3
427bad5165dd7d7c9f9b444664c7890433cdc44f
deveshmishra34/go_crash_course
/04_functions/main.go
Go
go
205
no_license
package main import "fmt" func greetings(name string) string { return "hello " + name } func sum(x, y int) int { return x + y } func main() { fmt.Println(greetings("Dev")) fmt.Println(sum(7, 5)) }
c9034395e8b7ef0e38e6adedeabbef5b15b269e2
b4f78d2b262f9acaf0c27b2cf6f8980949f70244
yufan022/bds-xlm
/services/horizon/internal/main_generated.go
Go
go
2,804
permissive
package horizon import ( "net/http" ) func (action AssetsAction) Handle(w http.ResponseWriter, r *http.Request) { ap := &action.Action ap.Prepare(w, r) ap.Execute(&action) } func (action DataShowAction) Handle(w http.ResponseWriter, r *http.Request) { ap := &action.Action ap.Prepare(w, r) ap.Execute(&action) ...
dc1cec3c2a82e4d27b0230f25376e1ad36aeb91d
313850a3a0054fbad85be36898740382008950f2
yuanhh/go
/src/runtime/metrics.go
Go
go
19,098
permissive
// Copyright 2020 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. package runtime // Metrics implementation exported to runtime/metrics. import ( "unsafe" ) var ( // metrics is a map of runtime/metrics keys to data used b...
d5bb55105858d028f83f93e7aea96316593396a4
55690de09016b4f08248c08e0a29724ec71ae5ec
chalkan3/hydra-pipeline-migration
/cmd/commom/commonCmd.go
Go
go
1,063
no_license
package commom import ( "fastshop.com.br/create_pipelines/infra/helpers" "github.com/spf13/cobra" ) // CommonCmd common struct of cmd type CommonCmd struct { funcHandler *helpers.FuncHandler cobra *cobra.Command } // SetRun is a command to set the run command func (c *CommonCmd) SetRun(f func(cmd *cobra.Co...
4a3c7087db914a90f792003bdc99b7ea4f2aca26
2b5607255b0fc0771d6ade79da177ef70e256dd8
VinaiRachakonda/dolt
/go/store/nbs/benchmarks/null_block_store.go
Go
go
2,204
permissive
// Copyright 2019 Liquidata, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to...
6f52f885ac70d2d23f54f5e3d8083fa89e0c2a1b
0515a87a2b119524bf0f0fd958aa8f20b033624d
in2store/service-in2-book
/routes/v0/metas/root.go
Go
go
298
no_license
package metas import "github.com/johnnyeven/libtools/courier" var Router = courier.NewRouter(MetasGroup{}) type MetasGroup struct { courier.EmptyOperator } func (MetasGroup) Path() string { return "/metas" } type MetaItem struct { Label string `json:"label"` Value string `json:"value"` }
593f15d2cca428e7a5394d0697e95054c7e8e15c
e56d7b3caf4092e3dad6e5207d11eb5ba1fb1c77
hlandau/eddsa
/ed25519_test.go
Go
go
1,172
no_license
package eddsa import ( "bytes" "crypto/rand" "testing" ) func TestEd25519(t *testing.T) { privateKey, err := Ed25519().GenerateKey(rand.Reader) if err != nil { panic(err) } if len(privateKey.D) != 64 || len(privateKey.X) != 32 { t.Fatalf("bad length") } if bytes.Compare(privateKey.D[32:64], privateKey....
0598cbad451c1e04ff232eeca49d88bd976b09e8
4f3097cb4a9835dc72ae561de5bce5b393ad3d25
xurongsz/go-chart
/vector_renderer.go
Go
go
9,456
permissive
package chart import ( "bytes" "fmt" "io" "math" "strings" "golang.org/x/image/font" "github.com/golang/freetype/truetype" "github.com/xurongsz/go-chart/drawing" ) // SVG returns a new png/raster renderer. func SVG(width, height int) (Renderer, error) { buffer := bytes.NewBuffer([]byte{}) canvas := newCan...
5da6fae0af0f8ba8354bfa62ecb1be880a90d98a
bd14fc357631411221e56cb3fef935c865756422
prateekpandey14/maya
/tests/jiva/node-stickiness/suite_test.go
Go
go
3,589
permissive
/* Copyright 2019 The OpenEBS Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwar...
483da5c6d47ed786947ae3e752240f704e77dd35
b9300f8a4901e04d51ee878a33baeb615e63a94d
zhanghup/go-tools
/database/db/loader.go
Go
go
3,880
no_license
package db import ( "context" "fmt" "github.com/zhanghup/go-tools" "github.com/zhanghup/go-tools/database/txorm" "github.com/zhanghup/go-tools/loader" "reflect" "regexp" "strings" "xorm.io/xorm" ) var sqlFormatRegexp = regexp.MustCompile(`^\w+$`) // SliceDB 查找数据库对象,ctx可以为nil func SliceDB[Result any](db *xor...
0eb84376c93d44cbe3b6adaf30781f8ec7ba0f27
8aa7382657e0308fa15023179273893094fe7d20
ownesthq/cosmos-sdk
/x/auth/types/stdtx.go
Go
go
6,376
permissive
package types import ( "encoding/json" "fmt" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/multisig" "github.com/ownesthq/cosmos-sdk/codec" sdk "github.com/ownesthq/cosmos-sdk/types" ) var ( _ sdk.Tx = (*StdTx)(nil) maxGasWanted = uint64((1 << 63) - 1) ) // StdTx is a ...
7b174ef6b94fdd64d68a2f4b8fd98e51a132835c
adbced423d8b494e40ee57f34ab05edd24843ea3
qsupremacy/huaweicloud-sdk-go-v3
/services/iam/v3/model/model_keystone_show_security_compliance_by_option_request.go
Go
go
2,284
permissive
package model import ( "encoding/json" "errors" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter" "strings" ) // Request Object type KeystoneShowSecurityComplianceByOptionRequest struct { // 待查询的账号ID,获取方式请参见:[获取账号、IAM用户、项目、用户组、委托的名称和ID](https://support.huaweicloud.com/api-iam/iam_17_0002.html)。 D...
0851bbf761704c4abf449a0f5577683fde8383f2
304b0440ca5075fb2949374acdbc3c899bf0883a
DarkFunct/fec-go
/handler/whole/refer.go
Go
go
14,094
no_license
package whole import( "github.com/fecshopsoft/fec-go/util" "github.com/gin-gonic/gin" "net/http" "github.com/fecshopsoft/fec-go/helper" "github.com/fecshopsoft/fec-go/shell/model" "context" "strconv" "log" // "reflect" "encoding/json" "github.com/olivere/elastic...
85328c004f470119d7e426081568864cc7daeda8
8d429a3d90dbace3b613cbd2445496346f6152c2
aruaru0/golang_myatcoder
/ETC/M-Solutions/D/other/main.go
Go
go
1,917
no_license
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) func out(x ...interface{}) { fmt.Println(x...) } var sc = bufio.NewScanner(os.Stdin) func getInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func getString() string { sc.Sca...
44ea6ef629acd27574b2f391735de272a79c3a4b
d17eb1ca907db991309360f954f01ec4b11e7a25
adecaro/fabric-token-sdk
/token/services/tcc/shim.go
Go
go
456
permissive
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package tcc import ( "github.com/hyperledger/fabric-chaincode-go/shim" ) //go:generate counterfeiter -o mock/chaincode_stub_interface.go -fake-name ChaincodeStubInterface . ChaincodeStubInterface // ChaincodeStubInterface is used by...
cb65e3ac6c199b8ad0751fc0e9446b56b7ff96bb
e6da8f5274628318e94695bd33a34c00f501688c
xaevman/goat
/mod/net/timeoutevent.go
Go
go
758
permissive
// --------------------------------------------------------------------------- // // timeoutevent.go // // Copyright (c) 2014, Jared Chavez. // All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // // ----------- package net // Timeou...
453819a6765f2fb5d85b2642533cec0f524b91eb
a94c165e79840da9930f28e3b726eadd70f091fa
hareesh94/DOS-IOT-project
/IOT support in Xinu/go/rest.go
Go
go
1,759
no_license
package main import ( "fmt" "log" "net/http" "net" "strconv" "strings" "bufio" ) type query struct { Glowled int Status bool } func parseBool(s string, dest *bool) error { // assume error = false *dest, _ = strconv.ParseBool(s) return nil } func communicate ( led int , status bool) string { p := make(...
b3bfc0108ef71a435e25371e58e8ce9445aae5a6
72803377f868c7242c73d2789827fd2a6f3729bb
baijum/tektoncd-pipeline-operator
/pkg/apis/tekton/v1alpha1/register.go
Go
go
625
permissive
// NOTE: Boilerplate only. Ignore this file. // Package v1alpha1 contains API Schema definitions for the tekton v1alpha1 API group // +k8s:deepcopy-gen=package,register // +groupName=tekton.dev package v1alpha1 import ( "k8s.io/apimachinery/pkg/runtime/schema" "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" ) ...
3726ce26dc86a1588e5bf26792698d697db9eee0
f17277853affb1418b1518381f64bf29bfde4ca4
checkr/codeflow
/server/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_json_marshal/types.go
Go
go
221
permissive
package test type typeForTest struct { F *jm `json:"f,omitempty"` } type jm struct{} func (t *jm) UnmarshalJSON(b []byte) error { return nil } func (t jm) MarshalJSON() ([]byte, error) { return []byte(`""`), nil }
946f1b233cc9f91ff9ae04721da152c35eb1db87
526b3564ec57343a3b24900d59443fd598ee3a40
owulveryck/terraform-validator
/internal/hcl/hcl_parse.go
Go
go
4,904
permissive
// Package hcl handle the parsing of your terraform file package hcl import ( "github.com/hashicorp/hcl2/gohcl" "github.com/hashicorp/hcl2/hclparse" "github.com/thazelart/terraform-validator/internal/fs" "github.com/thazelart/terraform-validator/pkg/utils" "sort" "strings" ) // GetFolderParsedContents returns y...
0107d9af365168b85e80d571e89b4c3578cefa5f
988aaf1e4ceb610e916cab5472767db31708ac24
nmarcetic/capsule
/pkg/indexer/namespace/namespaces.go
Go
go
724
permissive
// Copyright 2020-2021 Clastix Labs // SPDX-License-Identifier: Apache-2.0 package namespace import ( v1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" "github.com/clastix/capsule/api/v1alpha1" ) type OwnerReference struct { } func (o OwnerReference) Object() client.Object { return &v1.Namesp...
2288eb36a873e1c7eb31ff00653b4e3823835be3
0cb122b53bdaa9aac3bb7a7e9774ce0f51ba71a1
yang-wei/singo
/repository/mem/room.go
Go
go
1,170
permissive
package mem import ( "sync" "github.com/tockn/singo/model" "github.com/tockn/singo/repository" ) func NewRoomRepository() repository.Room { return &roomRepository{ rooms: make(map[string]*model.Room, 0), } } type roomRepository struct { mutex sync.Mutex rooms map[string]*model.Room } func (re *roomReposit...
1add8559057cd07d3e29e51ff763d80d6a11bb05
f2c0f8e453d388d966f37fc872141d0be23f6b3c
go-various/goplugin
/logical/errors.go
Go
go
300
no_license
package logical func NewCodedError(status int, msg string) CodedError { return CodedError{ Status: status, Message: msg, } } type CodedError struct { Status int Message string } func (e CodedError) Error() string { return e.Message } func (e CodedError) Code() int { return e.Status }
16347417a166d4fddc8cfd292e25b92d1c25c7de
71953538382901525306f76a863ab1d673ea905b
maxbrunsfeld/executor
/Godeps/_workspace/src/github.com/cloudfoundry-incubator/runtime-schema/models/staging_messages.go
Go
go
1,927
no_license
package models type StagingRequestFromCC struct { AppId string `json:"app_id"` TaskId string `json:"task_id"` Stack string `json:"stack"` AppBitsDownloadUri string `json...
7fba940019f50cff67bb1875a891675b43d0fbb9
27fbafedf9e5b491b6fc34a647b0071143de6d30
tarikozket/tchannel
/golang/verify_utils_test.go
Go
go
2,068
permissive
package tchannel_test // Copyright (c) 2015 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...
757e381e747dc6a9df1da9e6c82de9065b903a69
a1fac7fa9f512193fd69005660f606ecdd9cf8d9
livetribe/vanity
/pkg/memory/memory.go
Go
go
3,120
permissive
/* * Copyright (c) 2020 the original author or 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 appl...
599572803e3df5022f35796e497d2bf9e8c2cbc8
a29ace4a2b3502076127cb25f955eadcb6213b13
Timatipjg/opim_admin
/src/utils/cors.go
Go
go
1,502
permissive
package utils import ( "github.com/gin-gonic/gin" "net/http" ) func CorsHandler() gin.HandlerFunc { return func(context *gin.Context) { context.Writer.Header().Set("Access-Control-Allow-Origin", "*") context.Header("Access-Control-Allow-Methods", "*") context.Header("Access-Control-Allow-Headers",...
c87e4ca614d946dd8413ba8afbb79e15df50ee73
50de9dba0ed70e1c607ae807187089df65058040
project-eve/eve
/pkg/pillar/zedUpload/datastore_http.go
Go
go
5,474
permissive
// Copyright(c) 2017-2018 Zededa, Inc. // All rights reserved. package zedUpload import ( "fmt" zedHttp "github.com/zededa/eve/pkg/pillar/zedUpload/httputil" "net" "net/http" "net/url" "time" ) type HttpTransportMethod struct { transport SyncTransportType hurl string path string authType string ...
68aeff177fb8313ba819ad75c9df98ce47d37fae
bc29c7ed13ba46188a05ddf7487b04b1d4463025
shinesolutions/swagger-aem-osgi
/clients/go/generated/model_com_adobe_granite_oauth_server_impl_o_auth2_token_revocation_servlet_info.go
Go
go
641
permissive
/* * Adobe Experience Manager OSGI config (AEM) API * * Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API * * API version: 1.0.0-pre.0 * Contact: opensource@shinesolutions.com * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ package ope...
bc1fa62a86b952905b52936711c4fc703a1ae980
6dd31cdbada50c2662aa1dc15e835567099553c0
assgnments/Tiyake.com
/entity/entity.go
Go
go
1,278
no_license
package entity import ( "github.com/jinzhu/gorm" ) type Role struct { gorm.Model Name string `gorm:"type:varchar(255)"` } type User struct { gorm.Model FullName string `gorm:"type:varchar(255);not null"` Email string `gorm:"type:varchar(255);not null;unique"` Password string `gorm:"type:varchar(255)"` Rol...
69a2024454baf92bb2a51ee111fea0388c18d717
f4a31439fcc2e22455bbd4f7d1de49a87bc65801
master-coder-ll/v2ray-web-manager
/v2ray-jdk/src/main/proto/v2ray.com/core/main/distro/all/all.go
Go
go
1,983
permissive
package all import ( // The following are necessary as they register handlers in their init functions. // Required features. Can't remove unless there is replacements. _ "v2ray.com/core/app/dispatcher" _ "v2ray.com/core/app/proxyman/inbound" _ "v2ray.com/core/app/proxyman/outbound" // Default commander and all...
ec1443be1c236bb5315b804a31d522d1eb5a38e5
00d69d0695d095e7411a5765110762b4df9b6f03
kimihito-sandbox/sd-201905-go
/choice/main.go
Go
go
269
no_license
package main import ( "fmt" "math/rand" "os" "time" ) func main() { rand.Seed(time.Now().UnixNano()) c := len(os.Args) - 1 if c < 1 { fmt.Fprintf(os.Stderr, "[usage] %s choice1 choice2...", os.Args[0]) os.Exit(1) } fmt.Printf(os.Args[rand.Intn(c)+1]) }
0cc1c391abc90c07d309c71dd14407ccfb60653b
6282accc57153ac946ef035669d986930f2d5ad8
saintfish/webutil
/auth.go
Go
go
753
no_license
package webutil import ( "github.com/hoisie/web" "github.com/saintfish/httpauth-go" "time" ) type Digest httpauth.Digest func NewDigest(realm, htdigest string, duration time.Duration) (*Digest, error) { digest, err := httpauth.NewDigest(realm, httpauth.OpenHtdigest(htdigest), false, nil) if err != nil { retur...
7c2191266f3233b677fb5da7828d86342b714b35
4ff74e805cad8cda3f0bba5a45cba6bab2091d77
fsmiamoto/verificador-ortografico-golang
/utils_test.go
Go
go
1,166
no_license
package main import "testing" func TestSanitizeWord(t *testing.T) { tests := []struct { description string input string want string }{ {"Uma pontuação", "Palavra!", "Palavra"}, {"Pontuação no começo e no fim", "!palavra!", "palavra"}, {"Em sequência", "!!palavra", "palavra"}, {"Diferentes...
70d37e65ba17deb74fab681e2f28be467e949950
8526d13cdb9aae0de721368db839aef3f793cdcb
jia-jerry/gardener
/pkg/operation/botanist/component/nodelocaldns/monitoring_test.go
Go
go
2,627
permissive
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the Lice...
a3af94c0ed892e0151b6e5922b8b60498ee2f667
8ad0ea16da56971f0a313b46bf5b7083bdfb164d
biasedbit/compression-tests
/internal/compression/compression.go
Go
go
990
no_license
package compression import ( "bytes" "github.com/google/uuid" "github.com/segmentio/kafka-go" "io" "strings" ) func Compress(codec kafka.CompressionCodec, src []byte) ([]byte, error) { b := new(bytes.Buffer) r := bytes.NewReader(src) w := codec.NewWriter(b) if _, err := io.Copy(w, r); err != nil { _ = w.Cl...
87fbe6762867c02f852615a13435a698cbb5f5ca
7046b696bba3ae849276ed7f26a5293a4628d7c6
JoshWong815/employmentInfo
/models/skill.go
Go
go
3,675
no_license
package models import ( "errors" "fmt" "reflect" "strings" "github.com/astaxie/beego/orm" ) type Skill struct { Id int64 Type string `orm:"size(128)"` Info string `orm:"size(128)"` } func init() { orm.RegisterModel(new(Skill)) } // AddSkill insert a new Skill into database and returns // last inserted I...
1fbabf8a73bb416c903088d72df08871888066bb
e2ae7b96e19fc1961b93f27bcd15704b1660891d
ryan1943/grpc-demo
/etcd-service-discovery/example/main.go
Go
go
483
no_license
package main import ( "flag" "fmt" "grpc-demo/etcd-service-discovery/discovery" ) func main() { var role = flag.String("role", "", "master | worker") flag.Parse() endpoints := []string{"http://127.0.0.1:2379"} if *role == "master" { master := discovery.NewMaster(endpoints) master.WatchWorkers() } else if ...
9f367744819c7e3f5fd03be19c110277d769e48a
14787ec3c2b64d4566c5a970d270122a8534dfd6
Aarabika/ptypes
/int64.go
Go
go
280
no_license
package ptypes import "github.com/Aarabika/nulls" func NullInt64(val *Int64) nulls.Int64 { return nulls.Int64{ Int64: val.GetInt64(), Valid: val.GetValid(), } } func NullInt64Proto(val nulls.Int64) *Int64 { return &Int64{ Int64: val.Int64, Valid: val.Valid, } }
bdbf4cd3083a996df6021050901f80f69f5a7602
42146c4823c3243e4a6e8c5ca9c5007c19d2818a
digicom1978/CodeMonk
/search/exampleTernarySearch.go
Go
go
727
no_license
package main import ( "fmt" ) func fnDouble(x float64) float64 { return -1*x*x + 2*x + 3 } func findMaxByTernarySearch(start float64, end float64) (float64, float64) { l1 := start l2 := end var x float64 = 0 for i:=0; i<200; i++ { mid1 := (2*l1 + l2) / 3 mid2 := (2*l2 + l1) / 3 if fnDouble(l1) > fnD...
da00b996bc5ad47940c53a7764eac3a457090469
9a72fc95159c7570622a78f9d18f84551096223e
viniciusramosdefaria/ritchie-cli
/pkg/cmd/delete_env_test.go
Go
go
1,154
permissive
/* * Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA * * 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...
9401c64fabb7b4440b79e2b9f65406b4acda68d7
a796e8f91542fa7435a89652a8fb7231793e38b7
reetasingh/client-go-examples
/cmd/update_pod/main.go
Go
go
1,823
no_license
package main import ( "context" "flag" "fmt" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/util/homedir" "path/filepath" ) func main() { // get kubeconfig file var kubeconfig *string homeDir := homedir.HomeDir() kubeconfi...
f109aaef12d00fc62516740a39c707adfb66ef26
ee619504c908cbb3fefac40a3e89b0bcf7773b17
goharbor/harbor
/src/jobservice/common/rds/keys.go
Go
go
3,884
permissive
// Copyright Project Harbor Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
6299a32387ec83b659d41d5dab7709cbda212014
1bed861764db0e92877395013d536f2e02a9f018
thinkdancer/zebra
/rip/server.go
Go
go
3,135
permissive
// Copyright 2018 zebra 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 law or agreed to ...
94142cc2e73dce37a15b31ed078f7dc258000cb2
484eb738263d52688f20a03df9f070e4f9c2c04c
bootstrapsp/learningGo
/learningGo/InterfacePartI/main.go
Go
go
2,014
no_license
package main import ( "fmt" "sort" ) // defining a custom type of datatype slice of string type people []string // implementing first function to attach to the type required for performing sort func (p people) Len() int { return len(p) } // implementing second function to attach to the type required for performi...
8d897bf2f25292f0af061eb6ef63464c64511657
1a9b6066400d589764c61139e17834c41621edd6
microsoftgraph/msgraph-beta-sdk-go
/identitygovernance/lifecycle_workflows_custom_task_extensions_item_last_modified_by_mailbox_settings_request_builder.go
Go
go
10,046
permissive
package identitygovernance import ( "context" i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be "github.com/microsoftgraph/msgraph-beta-sdk-go/models" i20a3050780ee0b0cde0a884a...
7b55c90cbf10d44540a47178ec7b5e63138c79e4
bd3d2d08ed14e636b119bb9d38e6860df764f9c6
openshift/cluster-api-provider-aws
/vendor/github.com/awslabs/goformation/v4/cloudformation/cloudfront/aws-cloudfront-distribution_origingroupmembers.go
Go
go
1,975
permissive
package cloudfront import ( "github.com/awslabs/goformation/v4/cloudformation/policies" ) // Distribution_OriginGroupMembers AWS CloudFormation Resource (AWS::CloudFront::Distribution.OriginGroupMembers) // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-orig...
fa5422e09f10e9b138d8f67183a15cded2415817
5771281460713e7b49c1ce5ef3717255afe986d7
laudarch/iso20022
/AcknowledgementReason15Choice.go
Go
go
628
permissive
package iso20022 // Choice of format for the acknowledgement reason. type AcknowledgementReason15Choice struct { // Specifies additional information about the processed instruction. Code *AcknowledgementReason3Code `xml:"Cd"` // Specifies additional information about the processed instruction. Proprietary *Gener...
20b7bcb3c8dd9da719d33bdbb6fbbf44a0c223ae
0f58f04c6758120d198bc413eea9ea31511bf686
drm/maze-solver-go
/main.go
Go
go
1,206
no_license
package main import ( "bufio" "errors" "flag" "fmt" "image" "net/http" "os" "time" _ "image/gif" "maze" ) var conf maze.Conf func init() { conf = maze.Settings } func main() { var reader func() (image.Image, string, error) flag.Parse() if conf.File != "" { reader = func() (image.Image, string, e...
9eb1098a620a0bf72cad7c6d1ecaf03c414e3770
f03f1a1e8c0fabb8ae8b5473860205338131ed2e
jessie-codes/aries-framework-go
/pkg/didcomm/crypto/jwe/authcrypt/decrypt_jwk_test.go
Go
go
3,567
permissive
/* Copyright SecureKey Technologies Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package authcrypt import ( "encoding/base64" "testing" "github.com/stretchr/testify/require" chacha "golang.org/x/crypto/chacha20poly1305" jwecrypto "github.com/hyperledger/aries-framework-go/pkg/didcomm/crypt...
40902bddb0f437a92d708578925247ca460d69cd
1962fb87002efaec4dc1683b42da22eb590a7164
ecletus/core
/resource/slice_value.go
Go
go
1,842
permissive
package resource import ( "reflect" "github.com/moisespsena/template" ) type SliceValue struct { Current interface{} Deleted interface{} DeletedID []ID deletedMap map[string]bool } func (s *SliceValue) DeletedMap() map[string]bool { if s.deletedMap == nil { s.deletedMap = map[string]bool{} for _, ...
56c9a220b896abc3c54d105137f808cd53c0230e
e8033bf157e3636c0f3e78b47cd0c8e3bae90830
taragu/eventing
/pkg/reconciler/names/names_test.go
Go
go
1,117
permissive
/* * Copyright 2018 The Knative Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
12d6830f8f8628d063e8f2adc628126aad25c9bc
c4a35c1d537460db02749a4c0b3a07032f79734c
sugy/mackerel-agent
/mackerel/api.go
Go
go
1,867
permissive
package mackerel import ( "errors" "fmt" "net/url" "github.com/mackerelio/golib/logging" mkr "github.com/mackerelio/mackerel-client-go" ) var logger = logging.GetLogger("api") // API is the main interface of Mackerel API. type API struct { *mkr.Client } // IsNetworkError returns true if err is url.Error caus...
5078a3e4b01dff8fa3016d6f00dbdb591e9d9251
b1cdfad6cb661901331a0cb9c24d27cb99a9a0ee
sudo-sturbia/xenigma
/pkg/machine/mappers.go
Go
go
3,735
permissive
package machine // Contains Plugboard and Reflector struct and their needed functions. This file // is named mappers simply because both reflector, and plugboard are used to create // mappings of one character to another. import ( "fmt" "math/rand" ) // Plugboard is a set of connections that maps different charact...
f8215d6b94c9a2e2a81dec7bce118ecba863e526
13805a3cacd8fa58a3cd712614c6c7e7410b9d8f
lwc/protoc-gen-twirp_stub
/go_naming.go
Go
go
3,322
no_license
// Copyright 2018 Twitch Interactive, 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. A copy of the License is // located at // // http://www.apache.org/licenses/LICENSE-2.0 // // or in the "license"...
b4921b9808e6cea29269672ca161f7fd76f4097c
e5dd0c40728abb9c9a9fac6b6a1ddf325f841b99
gsmcwhirter/discord-signup-bot
/pkg/commands/config_discord.go
Go
go
798
permissive
package commands import ( "github.com/gsmcwhirter/discord-bot-lib/v23/cmdhandler" "github.com/gsmcwhirter/discord-bot-lib/v23/logging" "github.com/gsmcwhirter/go-util/v8/logging/level" ) func (c *ConfigCommands) discordHandler(msg cmdhandler.Message) (cmdhandler.Response, error) { ctx, span := c.deps.Census().Sta...
3306512e7144ae920e74d658f5b0d8fed4053369
7c75444ff7f6eacc33e3762a0c1cde3e72080c61
0xbb/matterbridge
/gateway/samechannel/samechannel_test.go
Go
go
1,379
permissive
package samechannelgateway import ( "fmt" "github.com/42wim/matterbridge/bridge/config" "github.com/BurntSushi/toml" "github.com/stretchr/testify/assert" "testing" ) var testconfig = ` [mattermost.test] [slack.test] [[samechannelgateway]] enable = true name = "blah" accounts = [ "mattermost.test",...
20b78f8efca43b9ee6f3dd297c3a26d0eb9e8745
3d367c4d7968fa91514eaa5879eae3e9a6d7ec8b
mattermost/mattermost-push-proxy
/server/metrics_test.go
Go
go
3,694
permissive
package server import ( "io/ioutil" "net/http" "strings" "testing" "time" "github.com/prometheus/common/expfmt" "github.com/stretchr/testify/require" ) func TestMetricDisabled(t *testing.T) { t.Log("Testing Metrics Enabled") platform := "junk" pushType := PushTypeMessage fileName := FindConfigFile("matte...
4c1205bef2b528d3d06bcd3aa793657b41f9b659
a2741fe8b22f1e0c449fdd99bbc5059b3fe90fb9
Luzifer/fhemhue
/config.go
Go
go
1,970
permissive
package main import ( "fmt" "io/ioutil" "net" yaml "gopkg.in/yaml.v2" log "github.com/Sirupsen/logrus" homedir "github.com/mitchellh/go-homedir" "github.com/pborges/huemulator" "github.com/satori/uuid" ) type config struct { Telnet struct { IP string `yaml:"ip"` Port int `yaml:"port"` } `yaml:"te...
738191fd896e2b6ff7b3dca6359fa4e2c3b89f53
66b979d882bed4184697cc2d2a5bf8bb24370b3e
creedasaurus/dendrite
/currentstateserver/storage/shared/storage.go
Go
go
3,256
permissive
// Copyright 2020 The Matrix.org Foundation C.I.C. // // 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...
851692a2663559ad857181b1b47035e1f3ace239
8d9a081f4d45de05f95c67ab4b703ee7f51e676c
tcarreira/roaw2020
/strava_client/swagger/response.go
Go
go
1,887
permissive
/* * Strava API v3 * * The [Swagger Playground](https://developers.strava.com/playground) is the easiest way to familiarize yourself with the Strava API by submitting HTTP requests and observing the responses before you write any client code. It will show what a response will look like with different endpoints depen...
1da0295ce70efba59552ddb5c8e36b9a89012dac
0485a4b04fb9d1b68aa3f01e71b8710bb5eb38d4
koalafyhq/edgy
/internal/proxy/transporter.go
Go
go
2,509
permissive
package proxy import ( "io/ioutil" "net/http" "github.com/koalafy/edgy/http/headers" "github.com/koalafy/edgy/internal/helpers" "github.com/rs/zerolog/log" ) // Transporter is type Transporter struct{} // RoundTrip is func (transport *Transporter) RoundTrip(req *http.Request) (*http.Response, error) { endpoin...
97e85b39ee89286c9b0d6dcde1b768daaa26f0ac
afd5bf2e828d0c44415aaefe805c45338c376832
sureshpalemoni/kubernetes
/staging/src/k8s.io/legacy-cloud-providers/azure/clients/diskclient/azure_diskclient_test.go
Go
go
4,398
permissive
// +build !providerless /* Copyright 2020 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 ...
91571bb7bb265b2adbcc133bbc01b517d6ccaf5a
11dde3c18c20b06cdcde39f4d30444f5a2e09e7d
fengjijiao/stathub-go
/src/send.go
Go
go
1,973
permissive
/* * Copyright 2015-2019 Li Kexian * * 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 ...
e9f02ac069a546a34717508a7d83a02f4b303034
8014b66ec99e956bb85f7caf7e23ed27336e623d
hzhyvinskyi/grpc-todo-app
/server/main.go
Go
go
6,528
permissive
package main import ( "context" "fmt" todopb "github.com/hzhyvinskyi/grpc-todo-app/proto" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" "google.golang.org/grpc" "google.golang.org/grpc/codes" "go...
ce14a4b621c4e44c6593d1b90eb525699a304417
130276ff8c847beebcd91942ae9fcb67d0178376
mrparkers/istio
/tools/istio-iptables/pkg/constants/constants.go
Go
go
2,810
permissive
// Copyright 2019 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 i...
2d0706d292707df264c876d5292c0b354e819fee
7d06b63ca5ce3a188a77830e199033595b72b157
jamescarter26/DeMars-DMC
/rpc/core/types/wire.go
Go
go
280
permissive
package core_types import ( "github.com/tendermint/go-amino" "github.com/Demars-DMC/Demars-DMC/crypto" "github.com/Demars-DMC/Demars-DMC/types" ) func RegisterAmino(cdc *amino.Codec) { types.RegisterEventDatas(cdc) types.RegisterEvidences(cdc) crypto.RegisterAmino(cdc) }
1ac484f95f8f7e895adc0e825c1dce2415860cb7
8d79bbcbcffff1a03933b078c59aacb1f96ec098
pavius/rivi
/bot/actions/trigger/trigger_test.go
Go
go
3,039
permissive
package trigger import ( "github.com/bivas/rivi/bot/mock" "github.com/stretchr/testify/assert" "gopkg.in/jarcoal/httpmock.v1" "net/http" "testing" ) func TestTriggerDefaults(t *testing.T) { httpmock.Activate() defer httpmock.DeactivateAndReset() meta := &mock.MockEventData{ Number: 1, Title: "title1", ...
c4ea88da62d2c6b0f7382e2af69baafd503c222d
362943ba34a3184f58deba7926acab3b7e361887
chu-yik/cluster-api-provider-aws
/api/v1beta1/network_types.go
Go
go
17,018
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, ...
e20f07e6280fc3f3951c87eed8ed9e3bc00c9cea
2837d5ae45a248872aa77e5e784b9e9de9987aa6
pga2rn/IB-DTM_framework
/statistics/session.go
Go
go
3,050
no_license
package statistics import ( "context" "fmt" "github.com/pga2rn/ib-dtm_framework/config" "github.com/pga2rn/ib-dtm_framework/rpc/pb" "github.com/pga2rn/ib-dtm_framework/shared/logutil" "os" "reflect" "strings" ) var PackageName = "statistics" type StatisticsSession struct { Config *config.StatisticsConfig ...
5280b721134625b6a04e47d6ac4cfe2473aeac8c
bf02c8be43364505b8bff421dd2732ed3257d7db
tranhungt/sous
/vendor/github.com/opentable/go-singularity/dtos/byte_string.go
Go
go
3,365
permissive
package dtos import ( "fmt" "io" "github.com/opentable/swaggering" ) type ByteString struct { present map[string]bool Empty bool `json:"empty"` ValidUtf8 bool `json:"validUtf8"` } func (self *ByteString) Populate(jsonReader io.ReadCloser) (err error) { return swaggering.ReadPopulate(jsonReader, self) } fu...
45d6bed0bf654ab48e9de85b41c98e2d107be3d3
7afac0ab4268266e68db3a098a33f095cf56c607
stephen-tse/harmony
/consensus/consensus_v2.go
Go
go
49,097
permissive
package consensus import ( "bytes" "encoding/binary" "encoding/hex" "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/rlp" protobuf "github.com/golang/protobuf/proto" "github.com/harmony-one/bls/ffi/go/bls" "github.com/harmony-one/harmony/api/proto" msg_pb "github.com/harmony-...
7ad8948e67793aae8fa424c51c7e7ef1628c75f0
4eecabb92056c1c3380bbdd4bd2c27a2b20bc33f
GoogleCloudPlatform/magic-modules
/mmv1/third_party/terraform/services/compute/resource_compute_firewall_migrate.go
Go
go
2,236
permissive
package compute import ( "fmt" "log" "sort" "strconv" "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func resourceComputeFirewallMigrateState( v int, is *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) { if is.Empty() { log.Println("[DEBUG] Empty InstanceS...
e21e96193c2e2f5f2aec904b6315655c4a0f97e8
6099e6ac515a075c2be4551996a55a0c03341029
mikehelmick/pkg
/webhook/webhook.go
Go
go
7,773
permissive
/* Copyright 2017 The Knative Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
395d4c3d9d54adbefec458d4bb9525b1b570a299
13b16e6aaa931e26fd1d7b09339c912f833feef1
bit-monitor/bit-monitor-server-go
/api/v1/resource_load_error_log.go
Go
go
2,626
permissive
package v1 import ( "bit.monitor.com/global" "bit.monitor.com/model/response" "bit.monitor.com/model/validation" "bit.monitor.com/service" "github.com/gin-gonic/gin" "go.uber.org/zap" ) func AddResourceLoadErrorLog(c *gin.Context) { var err error var r validation.AddResourceLoadErrorLog err = c.ShouldBind(&r...
0f1540a03d699d1700decc66dd6003d622fb7b13
6d3fcc6dc5056a164f8d6e6501b339005a48f8d1
coding-yogi/cfmonitoring
/cf/cf.go
Go
go
1,934
no_license
package cf import ( "errors" "flag" cfclient "github.com/cloudfoundry-community/go-cfclient" "github.com/coding-yogi/cfmonitoring/config" "github.com/coding-yogi/cfmonitoring/log" ) type IClient interface { GetClient() error GetApp(appName string) (cfclient.App, error) } type Client struct { orgName strin...
ee47ee776a6aefddcc52475687b379f5680f69bd
fa84361bcdc028f7b690dffe4176b865b616fbb7
ccDev-Labs/go-elasticsearch
/esapi/api.xpack.searchable_snapshots.stats.go
Go
go
5,143
permissive
// Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. // // Code generated from specification version 8.0.0: DO NOT EDIT package esapi import ( "context" "net/http...
e4e27b70fa88c0238a65e6036be9865396a3bc59
8eea417a674d4e8e93a703ad47e4b69cb77fb02f
tianxia007/msgpush
/comet/push/ios.go
Go
go
1,299
no_license
package push import ( "fmt" "github.com/yukongco/msgpush/comet/conf" "github.com/yukongco/msgpush/common/check" "github.com/sideshow/apns2" "github.com/sideshow/apns2/certificate" ) // IOS push is not div whether user is login func PushToIOS(token string, message []byte, iosCertFile, topic string) error { noti...
5547821227401af95dcd300c9fc09727941163ec
fa35af32ce23055b91a7a3bb545304359f4aa735
meysampg/num
/mat/functions.go
Go
go
4,067
no_license
package mat import ( "github.com/phil-mansfield/num" ) // Exp computes the matrix exponential of m and returns the result. // // If m is nil or not a square Matrix, an error Matrix is returned. func Exp(m *Matrix) *Matrix { return nil } // Sin computes the matrix radian sine of m and returns the result. // // If m...
005668a47c04555c3ffba6085aaa9f9cf510d184
2a6907bc3bfa8d77d1a2c088c9eadc5b11114cf3
sx0404/engine
/graphic/graphic.go
Go
go
9,298
permissive
// Copyright 2016 The G3N 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 graphic implements scene objects which have a graphic representation. package graphic import ( "su/engine/core" "su/engine/geometry" "su/engine/...
d400ec8aad01b7973f93e7eda52887e471202b87
3daf5d34239c39dd8d38865b26d967bd6329c477
youtzz/gopher30days
/algorithm/sliding-window/0438.Find-All-Anagrams-in-a-String/solution_test.go
Go
go
646
no_license
package problem0438 import ( "reflect" "testing" ) func Test_findAnagrams(t *testing.T) { type args struct { s string p string } tests := []struct { name string args args want []int }{ { name: "testcase 1", args: args{ s: "cbaebabacd", p: "abc", }, want: []int{0, 6}, }, { ...
219e5c22ab29988ed9b8336ec457b96274555a3d
257fd34deb01e83a23d230c71bf236bc2c4c45c0
cj-ateam/starnamed
/cmd/wasmd/main.go
Go
go
320
permissive
package main import ( "os" "github.com/cosmos/cosmos-sdk/server" "github.com/iov-one/starnamed/app" ) func main() { rootCmd, _ := NewRootCmd() if err := Execute(rootCmd, app.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: os.Exit(e.Code) default: os.Exit(1) } } }
54caf86f714519f42558707ab44dc2e58d6cb099
43e8525d824d37e41d1e94646ed7bbf9357db3be
JakeWarner/packngo
/virtualnetworks_test.go
Go
go
1,596
permissive
package packngo import ( "testing" ) func TestAccVirtualNetworks(t *testing.T) { skipUnlessAcceptanceTestsAllowed(t) c, projectID, teardown := setupWithProject(t) defer teardown() l, _, err := c.ProjectVirtualNetworks.List(projectID, nil) if err != nil { t.Fatal(err) } if len(l.VirtualNetworks) != 0 { t...
3bece046df8e01b3577778530609817bfbbc9cff
ef946a3017f1d34a06cc1603b86b10110b032133
dimdiden/gotests
/pobig.go
Go
go
835
no_license
package main import ( "fmt" "database/sql" _ "github.com/go-sql-driver/mysql" "log" "encoding/json" ) type Person struct { Id int Name string Age int } func GetPersonList() (personlist []Person) { db, err := sql.Open("mysql", "ded:ltleirf@tcp(212.237.13.190:3306)/test") if err != nil { log.Fa...
5146b003b5de58db48541eaa952dfab215fb2ccd
423e43fc48da21276e9907b3db015efdf72b19da
chronowave/chronowave
/ssql/parser/parser.go
Go
go
3,210
permissive
/* * Copyright 2020 ChronoWave 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...
f5e2f2a441b0a2d46bb6741edf3fe63bfa8d0faa
1e79593fae65aec82c11632aa0ec4e175ec4ecc5
polariseye/go-substrate-rpc-client
/rpc/state/get_consts_test.go
Go
go
1,520
permissive
package state import ( "github.com/stafiprotocol/go-substrate-rpc-client/client" "github.com/stafiprotocol/go-substrate-rpc-client/types" "github.com/stretchr/testify/assert" "testing" ) func TestState_GetConstWithMetadataV12(t *testing.T) { meta := types.NewMetadataV12() types.DecodeFromBytes(types.MustHexDeco...
421aab37eb8b8f087a23bad9ef05739f98c7bd16
15fab2943a1d81332221efa249429583a03d041d
superJinQing/nnet
/examples/mixed-protocol/main.go
Go
go
1,735
permissive
// This example shows how to mix different transport protocols and have nodes // with tcp and kcp running in the network at the same time. // Run with default options: go run main.go // Show usage: go run main.go -h package main import ( "flag" "math/rand" "os" "os/signal" "sync" "time" "github.com/nknorg/n...
dd3b91a8b506f24a0dbe72c48e56dfa9c1f5ec28
970366b23919390d8ae8aab5617c49c478b2bca6
yangwawa0323/gobyexample
/examples/temporary-files-and-directories/temporary-files-and-directories.go
Go
go
1,972
permissive
// Throughout program execution, we often want to create // data that isn't needed after the program exits. // *Temporary files and directories* are useful for this // purpose since they don't pollute the file system over // time. package main import ( "fmt" "io/ioutil" "os" "path/filepath" ) func...
bdff5498265ca6361a08acfe11afb79f4d6d752a
b53819509de9145beaea45a5bc44de20903338d4
Elio-yang/MGPUSim-Accel-Sim
/timing/cp/internal/resource/curesource_test.go
Go
go
10,406
permissive
package resource import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "gitlab.com/akita/mgpusim/v2/insts" "gitlab.com/akita/mgpusim/v2/kernels" ) func assertAllResourcesFree(r *CUResourceImpl) { Expect(r.wfPoolFreeCount[0]).To(Equal(10)) Expect(r.wfPoolFreeCount[1]).To(Equal(10)) Expect(r.wfPoolFreeC...
e276b0ae521264c46826c2106ff117e71bd9cda4
6db5e62e38a1abd7965f0c969ff3c475c76661b8
Bren2010/bn448
/example_test.go
Go
go
1,163
permissive
// Copyright 2012 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. package bn448 import ( "crypto/rand" ) func ExamplePair() { // This implements the tripartite Diffie-Hellman algorithm from "A One // Round Protocol for Tr...
44d5c7b45323c2ad6e8ec3f6ec882698ffc7412a
ee16f3a1744c81dc2f3a078a98f55cf30fb4ef05
digi1874/api.ys1994-vod
/main.go
Go
go
278
no_license
/* * @Author: lin.zhenhui * @Date: 2020-03-20 10:58:17 * @Last Modified by: lin.zhenhui * @Last Modified time: 2020-03-20 11:05:42 */ package main import ( "api.ys1994-vod/database" "api.ys1994-vod/routers" ) func main() { defer database.DB.Close() routers.Run() }
76d59efdcc4da37f8b482c9da8f3e3579d4bd84c
2139678e1aac538347ea039f0991688dc72e9d05
zjlx/gf-vue-admin
/server/app/service/dictionaries.go
Go
go
3,264
permissive
package service import ( "errors" "server/app/api/request" "server/app/model/dictionaries" "server/app/model/dictionary_details" "server/library/utils" "github.com/gogf/gf/frame/g" ) // CreateDictionary create a Dictionary // CreateDictionary 创建Dictionary func CreateDictionary(create *request.CreateDictionary)...
c8c1fb6e18b3f8ef9a28f3f1c6f0532c39517b0a
f1bbfedad06cb5ba749e2b47ef60f9ceecab196b
ddipankargogoi/cloud-build-samples
/go-rest-main/src/net/conf.go
Go
go
8,899
permissive
// Copyright 2015 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. // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package net import ( "internal/bytealg" "os" "runtime" "sync" "syscall" ) // conf re...
573ce91a168c8e97ce8db8b7a3a1d3fac05a289e
7f3539f070dd1ef54d15d6d2ec7a1f30cc087737
seqizz/restic
/internal/backend/azure/azure.go
Go
go
11,282
permissive
package azure import ( "context" "crypto/md5" "encoding/base64" "fmt" "hash" "io" "net/http" "os" "path" "strings" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/sema" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/errors" "github.co...