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
5f010c9e96f083a94491a0f776ee316edb90ebe3
ea6749816dd750a06f1c0d1531cd07ed02f1466f
daviogg/vouch
/services/signer/standard/parameters.go
Go
go
3,105
permissive
// Copyright © 2020 Attestant Limited. // 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 ...
111ac5a2444fb4a9b3f20839b961db2218b24d81
ba4a9b14cc4ca30c56559eea7b63105282bee702
rohan-agra/new-VOL-2356-voltha-go
/db/model/model.go
Go
go
1,133
no_license
/* * Copyright 2018-present Open Networking Foundation * 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 ...
567f4cfeb0bdf3d80a1c7614de01ddd70b4849d7
0d124d4daad27a16eb0513dff24153b1a9cdde17
inkyblackness/imgui-go-examples
/cmd/example_sdl_opengl3/main.go
Go
go
751
permissive
// +build sdl package main import ( "fmt" "os" "github.com/inkyblackness/imgui-go/v4" "github.com/inkyblackness/imgui-go-examples/internal/example" "github.com/inkyblackness/imgui-go-examples/internal/platforms" "github.com/inkyblackness/imgui-go-examples/internal/renderers" ) func main() { context := imgui...
939479819d3315a1f18b7f1075b8d423d52b780f
2df7a37c3059ae7f12fd604d31298b6fe5f69faf
lifa1225/aspose-words-cloud-go
/v2107/api/models/unprotect_document_online_request.go
Go
go
5,700
permissive
/* * -------------------------------------------------------------------------------- * <copyright company="Aspose" file="unprotect_document_online_request.go"> * Copyright (c) 2021 Aspose.Words for Cloud * </copyright> * <summary> * Permission is hereby granted, free of charge, to any person obtaining a copy...
4baa4e576489d44028aebae28914f9e1f9e49ccf
1d46ddef4125e807ac2b27f20bfebcadc64f471b
quanee/study-golang
/basic/basic/basic.go
Go
go
222
no_license
package main import ( "fmt" "math" ) func triangle() { var a, b int = 3, 4 fmt.Println(calcTriangle(a, b)) } func calcTriangle(a int, b int) int { var c int c = int(math.Sqrt(float64(a * a + b * b))) return c }
713da147ad2e59f92d0597564d05e1d5ee2c3f3f
9b0c02c8c04f8eafa9192378bda5b6c309e53c49
ipfsmartcloud/powergate
/ffs/api/istore.go
Go
go
5,358
permissive
package api import ( "encoding/json" "fmt" "sync" "time" "github.com/ipfs/go-cid" "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/query" "github.com/textileio/powergate/ffs" "github.com/textileio/powergate/util" ) var ( dsInstanceConfig = datastore.NewKey("instanceconfig") dsBaseCidStor...
ac5a1f6373f6ab8208c35b4f97f2b445c8d92854
6ce3d24b0e209f842368a38ec9a620d30fdfa60e
birdstorm/tidb
/br/pkg/backup/client.go
Go
go
35,652
permissive
// Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. package backup import ( "context" "encoding/hex" "encoding/json" "fmt" "io" "os" "strings" "sync" "time" "github.com/google/btree" "github.com/opentracing/opentracing-go" "github.com/pingcap/errors" "github.com/pingcap/failpoint" backuppb "gith...
7b38c4466d2d2d9d350d89ddd913183272579e60
e8c67dc618fa9212b70e13a43e063a9ea6ea96d8
jackyalbo/cloud-credential-operator
/vendor/github.com/microsoftgraph/msgraph-sdk-go/models/audio_conferencing.go
Go
go
7,788
permissive
package models import ( i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // AudioConferencing type AudioConferencing str...
83ecd8b56785fe50346a06a49fd331681d3011fb
2b584c049d77e7f71eb9b45a16838a74b70d07ac
khansaAmrouni/jx
/pkg/helm/helm_helpers_test.go
Go
go
8,449
permissive
package helm_test import ( "fmt" "io/ioutil" "path" "reflect" "strings" "testing" helm_test "github.com/jenkins-x/jx/pkg/helm/mocks" "github.com/jenkins-x/jx/pkg/secreturl/localvault" "github.com/pborman/uuid" "github.com/petergtz/pegomock" "github.com/stretchr/testify/require" "github.com/jenkins-x/jx/...
9b5fc6d15e514db92e4120da6e69938cfc8a4703
e067bde33123723199ca78175d9259c25c7164a0
alex60217101990/test_run
/main_test.go
Go
go
1,880
no_license
package main_test import ( "math" "testing" "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" ) type Compute struct { A uint32 B uint32 } func (c *Compute) CoerceInt() { c.A = c.A % 10; c.B = c.B % 10 } func (c Compute) Add() uint32 { return c.A + c....
6df8865fc2fa86e34f1a2a0fc214e0e5dbd93a9d
2d9b3a57be244a8bd137738c508c5d245b82b05b
michalq/endomondo2strava
/internal/modules/upload/strava-uploader.go
Go
go
3,263
no_license
package upload import ( "fmt" "strings" "github.com/michalq/endo2strava/internal/modules/common" "github.com/michalq/endo2strava/internal/modules/workouts" "github.com/michalq/endo2strava/pkg/strava-client" ) // Status status of current import type Status struct { // Uploaded in current run Uploaded int // S...
ae1155f0ee92379a729877d9cc8225865a09ee36
59eea8aa6f102f4f467f195c12ebbf6cbfac9edc
tendermint/networks
/internal/logging/logging_test.go
Go
go
638
permissive
package logging import ( "reflect" "testing" ) func TestKVPairSerialization(t *testing.T) { testCases := []struct { kvpairs []interface{} expected map[string]interface{} }{ { []interface{}{"a", 1, "b", "v"}, map[string]interface{}{ "a": 1, "b": "v", }, }, { []interface{}{"a"}, ma...
f54084ad46bcfaecd46382a607f87828994555d2
790c878028f86173f319e2ebcedcd2ca5f1c95f8
rjmathew/learngo
/basic_server.go
Go
go
817
no_license
package main import ( "net/http" "encoding/json" "fmt" ) func main() { http.HandleFunc("/", handler) http.ListenAndServe("localhost:8081", nil) } func handler(w http.ResponseWriter, r *http.Request) { response, err := publishJson() if (err != nil) { panic(err) } fmt.Fprintf(w, string(response)) } func pub...
714d18ef85ce8d5de1a7dcdc665afec8d9acebdb
271c3717450a2f11c821907b7fce6f42a5003c8d
blacktake/deploy
/utils/config.go
Go
go
697
no_license
package utils import ( "github.com/larspensjo/config" "os" //"fmt" ) func LoadConfig(configName string, innerConfigName string) (result map[string]string, err error) { var TOPIC = make(map[string]string) configFile, err := os.Getwd() if err != nil { return TOPIC, err } cfg, err := config.ReadDefault(confi...
c9960c228ebdbac3e62d52daa4bc7e4053f86547
56216820bf87f599ad4ecc2302456916e0b99168
lyqscmy/leetcode-go
/solution/33.go
Go
go
719
no_license
package solution import ( "sort" ) // nums no duplicate func rsearch(nums []int, target int) int { pivot := findPivot(nums) res := sort.SearchInts(nums[:pivot], target) if res < len(nums) && nums[res] == target { return res } res = pivot + sort.SearchInts(nums[pivot:], target) if res < len(nums) && nums[res...
616277f20423889addd78d932b5f392e72c06d18
23a5643a6479658bc61c7ffeed45b7b7ef0de7ea
wongw859/casnode
/object/balance.go
Go
go
6,726
permissive
// Copyright 2020 The casbin Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by a...
2c18200141d1e98a2118ae5524cf63d6f3e148fd
b89c1d1b04613f551672caf4aa3a52a5dd7d38d7
watagit/Golang
/ch2/ex2-2/unitconv/tempconv.go
Go
go
319
no_license
package uniconv import "fmt" type Celsius float64 type Fahrenheit float64 const ( AbsoluteZeroC Celsius = -273.15 FreezingC Celsius = 0 BoilingC Celsius = 100 ) func (c Celsius) String() string { return fmt.Sprintf("%g°C", c) } func (f Fahrenheit) String() string { return fmt.Sprintf("%g°F", f) }
759fc977f134fda1c65c2f12e9d4e3580cdddf6e
abbf2a71d003617cfea6370ddf664473ecbecb69
huberts90/xGenerator
/x_generator_test.go
Go
go
265
no_license
package xGenerator import ( "testing" "unicode/utf8" ) func Test_xGenerator(t *testing.T) { length := 10 xGen := NewXGenerator() xID := xGen.Get() if utf8.RuneCountInString(xID) != length { t.Errorf("%s should consis of %d characters", xID, length) } }
323ad86d57fac38b9cf5d6dd4b18b4884444d99b
a866a3c3d5ea7a6e477c4dfbb5377f79995f0e44
sequix/distribution
/context/trace.go
Go
go
2,892
permissive
package context import ( "context" "runtime" "time" "github.com/sequix/distribution/uuid" ) // WithTrace allocates a traced timing span in a new context. This allows a // caller to track the time between calling WithTrace and the returned done // function. When the done function is called, a log message is emitt...
437c078487e4ce57aefb8af4d206dd7fb224eaba
ae4ac2fc85355cfe5889f4e1fa28029a1493380f
omirror/commento
/api/email_get.go
Go
go
1,717
permissive
package main import ( "net/http" ) func emailGet(em string) (email, error) { statement := ` SELECT email, unsubscribeSecretHex, lastEmailNotificationDate, pendingEmails, sendReplyNotifications, sendModeratorNotifications FROM emails WHERE email = $1; ` row := db.QueryRow(statement, em) e := email{} if er...
b2ecc5d1190d3035c52ba7da8afd3384a5f5e9c8
3425e86983b0f28d61e7d36eb0f8fe7c1abfc33e
vmichel95/gvisor
/pkg/sentry/fsimpl/proc/task_net.go
Go
go
27,405
permissive
// Copyright 2019 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...
6c636f8f6811de297d9304214506bf4017155059
cba7da34d9f92769df247754971b28e1c3c1f194
gen0cide/cfx-example
/foopkg/config.go
Go
go
954
no_license
package foopkg import ( "fmt" "github.com/gen0cide/cfx" ) // NewFooConfig is a constructor that uses the cfx package to inject the configuration // from CFX parsed YAML. func NewFooConfig(provider cfx.Container) (*Config, error) { // create an empty Config object cfg := &Config{} // set defaults here if you wa...
7c93153931af8f95964bd12a267d2a4e211f70b5
d4a0e72990ffe2231e269650a5dcb0f5753870a3
hakten/kops
/cmd/kops/integration_test.go
Go
go
25,139
permissive
/* Copyright 2019 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, ...
67e3cf0408da47b00323212a85959cdfb0d85f35
c576d03b55f4e5a78251153bb58a7bffc91c6eec
joviqiao/nanoserver
/vendor/gopkg.in/chanxuehong/wechat.v2/mp/jssdk/card_ticket_server.go
Go
go
5,090
permissive
package jssdk import ( "errors" "math/rand" "strconv" "sync/atomic" "time" "unsafe" "gopkg.in/chanxuehong/wechat.v2/mp/core" ) // 卡劵 api_ticket 中控服务器接口. type CardTicketServer interface { Ticket() (ticket string, err error) // 请求中控服务器返回缓存的卡劵 api_ticket RefreshTicket(currentTicket s...
c31d4fd7211139f5a0e64dac38707ce6ef2d5231
05e33b40bc0f8c791c66cc162086fbbdeaf598e5
Thomas-cyclotron/publicChain
/part24-persistence-cli/main.go
Go
go
548
no_license
package main import ( "publicChain/part24-persistence-cli/BLC" ) func main() { //创世区块 blockChain := BLC.CreateBlockChainWithGenesisBlock() defer blockChain.DB.Close() ////添加新区块 //blockChain.AddBlockToBlockChain("Send 100RMB To A") //blockChain.AddBlockToBlockChain("Send 200RMB To B") //blockChain.AddBlockToBl...
0461fb37835e073cbb98c4b7b583855da31c2806
b793a33089adf10b8efb2fcc6c854b4f285088cc
cromero-metal-ph/packet-cli
/internal/capacity/check.go
Go
go
5,049
permissive
// Copyright © 2019 Ali Bazlamit <ali.bazlamit@hotmail.com> // // 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,...
d37a5af07c373fb72920393b87ee1556352d6e94
f46d5b79610cfb5004d6589140cf1bd14a7d4784
phpyandong/opentaobao
/model/tmallservice/TmallServicecenterWorkcardExpressorderCreateResponse.go
Go
go
866
permissive
package tmallservice import ( "encoding/xml" "github.com/bububa/opentaobao/model" ) /* 物流订单创建API APIResponse tmall.servicecenter.workcard.expressorder.create 天猫服务寄送类业务,服务商履约完成后寄回操作时,提供的物流寄件单创建API */ type TmallServicecenterWorkcardExpressorderCreateAPIResponse struct { model.CommonResponse TmallServ...
798ac7d72f5db2107f66dd97e09f873d7475121c
31400ef85985f4fdec882794cb3d313059f7ae8f
VKTRS2/finance-messaging
/iso20022/seev/CorporateActionMovementPreliminaryAdviceV04.go
Go
go
11,725
permissive
package seev import ( "encoding/xml" "github.com/fairxio/finance-messaging/iso20022" ) type Document03500104 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:seev.035.001.04 Document"` Message *CorporateActionMovementPreliminaryAdviceV04 `xml:"CorpActnMvmntPrlimr...
1e9aa453ef94db53e4926383de8eb638c40d1fff
f84483ae1d8f1b79e9ae3f53c73c79d2edc8a39c
vernellparker/BaseRaylibProject
/player.go
Go
go
314
no_license
package main type Player struct { } func (p Player) Setup() { panic("implement me") } func (p Player) Preload() { panic("implement me") } func (p Player) Update(dt float32) { panic("implement me") } func (p Player) TearDown() { panic("implement me") } func NewPlayer() GameFileBase{ return &Player{} }
15c9631137a47c5a62d1e47cd747d06186c8126e
d62cfe285bf167e55df6e06a9410c50f97c77504
HanLinSun/GoLang_Test-Learn
/FaceObj_test.go
Go
go
262
no_license
package GoProj01 import "testing" //Go语言面向对象编程:通过struct //Go语言不支持继承. //Go语言接口 type Employee struct{ ID int Skill string Name string Age int } func Test(t *testing.T){ e:=Employee{4,"C++","Michael",22} t.Log(e) }
663e54b3ae3d2b9240c41d39bbd5ee1501e7cd74
5aa04cf2e8c76893bc3f65ee2b73472c6e8c1eee
Shea11012/apiserver
/router/middleware/header.go
Go
go
1,072
no_license
package middleware import ( "github.com/gin-gonic/gin" "net/http" "time" ) func NoCache(c *gin.Context) { c.Header("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate, value") c.Header("Expires", "Thu, 01 Jan 1970 00:00:00 GMT") c.Header("Last-Modified", time.Now().UTC().Format(http.TimeFormat)) c...
ddbf76a3eaa772552c1f34070c29423d15aee5d6
d251a8a1cad6bf8743c0868f3c140a60c967e30f
Happy-Ferret/editor
/util/iout/iorw/undoredo.go
Go
go
1,623
permissive
package iorw type UndoRedo struct { Type WriterOp Index int B []byte // insert/delete B2 []byte // overwrite insert } func (ur *UndoRedo) Apply(w Writer, redo bool) error { switch ur.Type { case InsertWOp, DeleteWOp: insert := ur.Type == InsertWOp if (insert && !redo) || (!insert && redo) { retur...
e39920c3d275252993002fefb64e6b472ee88c59
c292754d3eb9b0515472bbec460b5216460850f0
AmundsenJunior/how-to-go
/section_25/exercise_04.go
Go
go
702
permissive
/* Starting with this code, use the sqrt.Error struct as a value of type error. If you would like, use these numbers for your lat "50.2289 N" long "99.4656 W" solution: https://play.golang.org/p/nsRxbDfkCh */ package main import ( "fmt" "log" ) type sqrtError struct { lat string long string err er...
80b101b56f034947bfa19a2c008e1f66546c2288
37882622bcbf0fa96c1d11758ff83f82f3cf75d4
keratin/throttled-valve
/valve/schedule.go
Go
go
1,823
permissive
package valve import ( "time" "github.com/throttled/throttled" ) // Schedule is configuration struct for NewValve. It comprises multiple RateQuotas that have been // calculated by NewSchedule to work together in a constricting fashion. type Schedule struct { Rates []*throttled.RateQuota } // Entry is a configura...
68a4b5cab0b48f8eb58ac9f360392680bfb52cd6
54bf0d3fea757db56d5b6ef8d6cd8dbcdc744b09
x-Fierce/tile38-client
/examples/fields.go
Go
go
556
permissive
// +build ignore package main import ( "log" t38c "github.com/b3q/tile38-client" ) func main() { tile38, err := t38c.New("localhost:9851", t38c.Debug) if err != nil { log.Fatal(err) } // To set a field when setting an object: if err := tile38.Keys.Set("fleet", "truck1"). Point(33.5123, -112.2693). Fie...
cacc05b74a303e65a28b5b5e26cb0d2cda8f3685
d067cee2ef818b7962a2553fb72768ed900b5bac
zachmu/dolt
/go/libraries/doltcore/table/pipeline/pipeline.go
Go
go
10,848
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...
7b7614ae09c33b6963f6ff71ea1a58606def97e2
118a2a9b3aa368997c0ac13c10db160666b25e24
TalentMob/talentmob_server
/api/login.go
Go
go
11,565
no_license
package api import ( "context" "errors" "fmt" "log" "firebase.google.com/go" _ "firebase.google.com/go/auth" "github.com/ant0ine/go-json-rest/rest" "github.com/rathvong/talentmob_server/models" "google.golang.org/api/option" ) // HTTP POST - handle for all user registrations request with email func (s *Serv...
8525ea4505aacf87d00fa3bce844e95ddc734d5e
01aa8d432f1631468064a51015d4eaa2d7a1ad0b
GoogleCloudPlatform/cloud-build-local
/vendor/cloud.google.com/go/videointelligence/apiv1/AnnotateVideo_smoke_test.go
Go
go
1,857
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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
1ddad6364d56b62214f7bd0b8c04580f79e30713
fe6670dc27a4fb2888893700bf25747e50fa3e28
wrbooth/ceph-csi
/pkg/cephfs/fsjournal.go
Go
go
4,443
permissive
/* Copyright 2019 The Ceph-CSI 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, so...
7b16be4a6f5c15a81e084cb6848c63c20a43d99d
d2ce2f9577259a3909b2b66ca1f36ced54068661
olivere/elastic
/search_queries_has_child.go
Go
go
3,694
permissive
// Copyright 2012-present Oliver Eilhard. All rights reserved. // Use of this source code is governed by a MIT-license. // See http://olivere.mit-license.org/license.txt for details. package elastic // HasChildQuery accepts a query and the child type to run against, and results // in parent documents that have child ...
a2d53b9c46fe5a5a30cfa5061e5857d026e1f77e
ea4feef7c3f11384b955ef1bfcb9a2350d8d55d4
kwkoo/credscontroller
/credscontroller/vendor/github.com/hashicorp/vault/vendor/github.com/hashicorp/vault-plugin-auth-cf/models/configuration.go
Go
go
2,249
permissive
package models import "time" // Configuration is the config as it's reflected in Vault's storage system. type Configuration struct { // Version 0 had the following fields: // PCFAPICertificates []string `json:"pcf_api_trusted_certificates"` // PCFAPIAddr string `json:"pcf_api_addr"` // PCFUsername string `json...
d83ec8c4754773e53e72e02cde3b95e619363ed3
b6783d7d657f87c057cf5e8b96f3e443945cf3ae
zhangliying0113/go
/code/day07/channel2/main.go
Go
go
783
no_license
package main import ( "fmt" "sync" ) // channel练习 // 1. 启动一个goroutine,生成100个数发送到ch1 // 2. 启动一个goroutine,从ch1中取值,计算其平方放到ch2中 // 3. 在main中 从ch2取值打印出来 var wg sync.WaitGroup var once sync.Once func f1(ch1 chan<- int) { defer wg.Done() for i := 0; i < 100; i++ { ch1 <- i } close(ch1) } func f2(ch1 <-chan int, ...
6184318a9485123221d483ad219a8b7c5588e165
4748900440b674f61d839f3f8b627fe72c9aaf2c
xiongqq345/go-Algorithm
/jz-offerII/056. 二叉搜索树中两个节点之和.go
Go
go
776
permissive
package jz_offerII //给定一个二叉搜索树的 根节点 root 和一个整数 k , 请判断该二叉搜索树中是否存在两个节点它们的值之和等于 k 。假设二叉搜索树中节点的值均唯一。 /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ func findTarget(root *TreeNode, k int) bool { var vals []int var inorder func(node...
8b57315a9238ecda0e2d29e137f4078dbc515162
23d51838e05ec59db2595240be30e4e407768fa4
icy95/gopherbot
/bot/run_pipelines.go
Go
go
16,684
permissive
package bot import ( "fmt" "io" "os" "path/filepath" "strconv" "strings" "github.com/lnxjedi/robot" ) var envPassThrough = []string{ "HOME", "HOSTNAME", "LANG", "PATH", "USER", } // startPipeline is triggered by plugins, job triggers, scheduled tasks, and child jobs // Called from dispatch: checkPluginM...
a8f330dc0671a0afec20e9c57e904ab5f1d9d35c
b74aa3102551b490d44a1e89e80095375562b3a2
get3w/get3w
/server/api/apps/files/get.go
Go
go
920
permissive
package files import ( "encoding/base64" "net/http" "github.com/get3w/get3w" "github.com/get3w/get3w/server/api" "github.com/get3w/get3w/storage" "github.com/labstack/echo" ) // Get file content func Get() echo.HandlerFunc { return func(c echo.Context) error { appPath := c.Param("app_path") if appPath == ...
562937eb4216fc0ea7d9878b037d37bf70ce4c44
61dfb76966caf67e606b473825e7b98e1dff2330
stady01/xdd-plus
/models/bot.go
Go
go
8,931
no_license
package models import ( "fmt" "io/ioutil" "os" "regexp" "strconv" "strings" "time" "github.com/beego/beego/v2/client/httplib" "github.com/beego/beego/v2/core/logs" ) var SendQQ = func(a int64, b interface{}) { } var SendQQGroup = func(a int64, b int64, c interface{}) { } var ListenQQPrivateMessage = func...
1160bdf3ead3d4f398a5b57485bd8e51e4fa64b1
274d43905a8c08ce277166f80fcaaa1517cd743f
chennqqi/vhost
/utils/ssl_generator.go
Go
go
2,745
permissive
package utils import ( "crypto/ecdsa" "crypto/rand" "crypto/rsa" "crypto/x509" "crypto/x509/pkix" "encoding/pem" "fmt" "log" "math/big" "net" "os" "path" "time" ) var isCA = false func publicKey(priv interface{}) interface{} { switch k := priv.(type) { case *rsa.PrivateKey: return &k.PublicKey case...
885283103320c2ccc1eb63d43811d7fa487360f0
e804450aab3ca8fb4ae0dbf045f37ddc062f918e
AngelDionisio/udemy
/golang/random/exercises/interfaces/greeter/main.go
Go
go
992
no_license
package main import ( "fmt" ) // User base person struct type User struct { FirstName string LastName string } // Greet prints User info, implements the Greeter interface func (u *User) Greet() string { return fmt.Sprintf("%s, %s", u.LastName, u.FirstName) } // Customer is a type of User type Customer struct ...
94c631dad1d89236b6831cb1e34369d03e968d4e
8f945e1c573a8e46bbc600f2eae217e236ae3ba9
hf/smtp
/command_test.go
Go
go
2,950
permissive
package smtp import ( "bytes" "fmt" "strings" tst "testing" ) func TestParseCommand(t *tst.T) { expected := map[string]struct { name commandName addr []byte sizeHint uint64 }{ "HELO": { name: commandHELO, }, "HELO domain.com": { name: commandHELO, addr: []byte("domain.com"), }, ...
28b5ccf84b0f1995f6338491a1f1932ca20368b8
435170c829e8c7924d22ccd7071559e5c12b80d1
hhy5861/go-rsa
/gen_rsa.go
Go
go
1,308
no_license
package main import ( "crypto/rand" "crypto/rsa" "crypto/x509" "encoding/pem" "os" "fmt" ) type Pem struct { PrivateKey *rsa.PrivateKey } var ( bits = 2048 err error privateFile = "/Users/mike/Downloads/private.pem" publicFile = "/Users/mike/Downloads/public.pem" ) func main() { rsaPem :...
639d6c5c043e2abbc0f9a67e0eee6f9a9aa406bc
9b196a747e00337c7d320ba002c6215b83f99ecd
reedperry/go-checkers
/search.go
Go
go
1,824
permissive
package main import ( "errors" "fmt" "math" ) func SelectMove(board *Board, color Color) ([]*Move, error) { var moves []*Move myGame := new(Game) myGame.board = board return moves, nil } func FindOneMove(board *Board, color Color) (*Move, int8, error) { myPieces := findMyPieces(board, color) var moves = ...
fe7507384bc23bae86cc0e480bcae337fdca0d37
9897a857a9c7548be5d6c188b8100a0b48d7bbba
kkeuning/middleware
/cors/dsl.go
Go
go
6,966
permissive
package cors import ( "bytes" "fmt" "regexp" "strings" "github.com/goadesign/goa" ) type ( // CheckFunc is the signature of the user provided function invoked by the middleware to // check whether to handle CORS headers. CheckFunc func(*goa.Context) bool // ResourceDefinition represents a CORS resource as ...
ee5cc6e9370066a97b4b67fb7772a1c8b72596c3
10728630ff5bedf1e56ef9d623714c0776595da1
antongulenko/http-isolation-proxy
/services/service_catalog/catalog.go
Go
go
3,922
permissive
package main import ( "fmt" "math/rand" "sync" "time" "github.com/antongulenko/http-isolation-proxy/services" "github.com/antongulenko/http-isolation-proxy/services/service_catalog/catalogApi" ) const ( item_lock_retries = 5 lock_expiration = 3 * time.Second item_prefix = "item/" lock_prefix ...
4b85a43c47727fd6130a62efc4ea64b7e2df4d20
76f00aaf4a2b4f42f2fa8e4f528a33536a02d8f6
fyonfa/mySocialSpace
/bd/insertTweet.go
Go
go
864
no_license
package bd import ( "context" "github.com/fyonfa/mySocialSpace/models" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "time" ) //InsertTweet insert tweet in the data base func InsertTweet(t models.RecordTweet) (string, bool, error) { ctx, cancel := context.WithTimeout(context.Ba...
3f8a0a09682ed7c60b021ffdaaa84a8b0acebd24
7212849e68c023c3152efd8e7e0cd50c3e0f2674
ingshtrom/dataplaneapi
/configuration/configuration.go
Go
go
15,178
permissive
// Copyright 2019 HAProxy Technologies // // 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...
b4bb5d33eb3868386a7c8169a9b29bdd4a8163e3
432f5ab2ef75528435895ec8d2cc87fe7057032a
liumingmin/goutils
/utils/struct.go
Go
go
7,849
permissive
package utils import ( "errors" "reflect" "strings" "time" ) var ( StructTimeType = reflect.TypeOf(time.Now()) ) const ( STRUCT_DATE_TIME_FORMAT_LAYOUT = "2006-01-02 15:04:05" STRUCT_DATE_FORMAT_LAYOUT = "2006-01-02" ) type StructConvFunc func(interface{}, reflect.Type) interface{} func CopyStructDefau...
b7a9e98913b505759a6b3bbfaafb96649e7480f9
fea9d9f138529c6566be6d6845d350cf7d062285
xwc1125/gopdf
/creator/utils.go
Go
go
1,309
permissive
/* * This file is subject to the terms and conditions defined in * file 'LICENSE.md', which is part of this source code package. */ package creator import ( "os" "github.com/xwc1125/gopdf/contentstream/draw" "github.com/xwc1125/gopdf/model" ) // Loads the template from path as a list of pages. func loadPagesF...
0ed0c73b0c88c03ac25ee53f4c4fa20610b92cd0
23d1c8f5db5032fbcf304d7c356922923499451c
sunnyboy00/hiveGo
/ai/policy_features.go
Go
go
8,550
no_license
// Policy features add a set of features per action of the board, plus padding. // // Each action is represented by: // // Move: 0/1 if the action is a move (and not a new placement). // Source Position: (if move, otherwise 0) // Radius-2 of board area around piece leaving. // Target Position: // Radius-2...
b539e694abf674baa70f9bbe05c1f6c4b59d6b27
f081bafef5ad2b8a080c0166a9602536e748b296
kolyshkin/cri-o
/vendor/github.com/containers/buildah/buildah.go
Go
go
24,154
permissive
package buildah import ( "context" "encoding/json" "fmt" "io" "io/ioutil" "os" "path/filepath" "sort" "time" "github.com/containers/buildah/docker" "github.com/containers/image/v5/types" encconfig "github.com/containers/ocicrypt/config" "github.com/containers/storage" "github.com/containers/storage/pkg/...
5d1b6d214251da0c29c154d20c3a706b46fbf89a
aabf4d1c9b5738063fcfb0f9af2d1213ea8b1e03
sabyagup/boki-benchmarks
/workloads/workflow/beldi/internal/media/core/handlers/user/main.go
Go
go
937
permissive
package main import ( // "github.com/aws/aws-lambda-go/lambda" "github.com/eniac/Beldi/internal/media/core" "github.com/eniac/Beldi/pkg/beldilib" "github.com/mitchellh/mapstructure" "cs.utexas.edu/zjia/faas" ) func Handler(env *beldilib.Env) interface{} { var rpcInput core.RPCInput beldilib.CHECK(mapstructure...
2bcba9c6d382b32ac58a39bbb09de357b3991951
dd8ddf8cfbed0e7683d39d7b10714fd5533c390e
ayas/cel-go
/interpreter/prune.go
Go
go
8,076
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 ...
f59be5c2a3a648cd0b4e360af31f5c43e00983e0
eacefc6a939e1b110e7110b553716108c3a14bf8
FILRetrievalClient/powergate
/reputation/reputation.go
Go
go
6,551
permissive
package reputation import ( "context" "fmt" "math" "sort" "sync" "time" "github.com/ipfs/go-datastore" logging "github.com/ipfs/go-log/v2" ma "github.com/multiformats/go-multiaddr" "github.com/textileio/powergate/index/ask" askRunner "github.com/textileio/powergate/index/ask/runner" "github.com/textileio/...
315e1b1d944356c392067ca008d055cd2f4f79fa
150eb08ca6a6bcc3d9c04322d536c206869f79af
shanerogers/azure-service-operator
/pkg/secrets/keyvault/client_test.go
Go
go
7,483
permissive
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. package keyvault import ( "context" "log" "net/http" "strconv" "time" "github.com/Azure/azure-service-operator/pkg/errhelp" "github.com/Azure/azure-service-operator/pkg/helpers" "github.com/Azure/azure-service-operator/pkg/resourceman...
0bba6116527d30f573f99d029efdb79bc38ac3b3
fff9d9d8c7ef3acb186176d2ba5b54dc0db8f8fc
moscowHackathon/arkon
/models/session.go
Go
go
1,104
no_license
package models import ( "errors" "sync" "github.com/astaxie/beego" ) type Session struct { ID string calc *SessionCalc } func (s Session) GetQuestion() string { if ok,i := s.calc.GetNextToCheck(); ok { return features[i] } return "Error: no questions" } func (s Session) Answer(a int) (bool, string) { be...
68a3fc601fcc41119bbeb663079a4fc004619b53
0eb429b148bf8b9c9b1f0dc9bc1e7f2b41c6d0e5
Lexxos/gitea
/vendor/xorm.io/xorm/engine.go
Go
go
40,783
permissive
// Copyright 2015 The Xorm 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 xorm import ( "context" "database/sql" "errors" "fmt" "io" "os" "reflect" "runtime" "strconv" "strings" "time" "xorm.io/xorm/caches" "x...
030ba98cef8566fa941bc87e56efc62771d0b37b
b803dcbb8b11a8f77e545d15484c4a995582e863
alfredogan/kubeturbo
/pkg/discovery/dtofactory/container_dto_builder_test.go
Go
go
5,895
permissive
package dtofactory import ( "fmt" "testing" "github.com/stretchr/testify/assert" "github.com/turbonomic/kubeturbo/pkg/discovery/metrics" "github.com/turbonomic/kubeturbo/pkg/discovery/util" api "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ) var ( namespa...
4be41524a1c148c1aff0a4fe39c13658596ece8a
3ed582b8cc163dbdf641815db51c7f52b78a96f4
bdewey/git-stack
/src/steps/abort_merge_branch_step.go
Go
go
301
permissive
package steps import "github.com/bdewey/git-stack/src/script" // AbortMergeBranchStep aborts the current merge conflict. type AbortMergeBranchStep struct { NoOpStep } // Run executes this step. func (step *AbortMergeBranchStep) Run() error { return script.RunCommand("git", "merge", "--abort") }
ae517dce771b3caf96ae3e2a05b075f4fb863201
0c1792144d7dc73b0fbee93f836f4d435bb22351
ziutek/emgo
/egpath/src/stm32/o/f40_41xxx/pwr/xgen_pwr.go
Go
go
4,906
permissive
package pwr // DO NOT EDIT THIS FILE. GENERATED BY xgen. import ( "bits" "mmio" "unsafe" "stm32/o/f40_41xxx/mmap" ) type PWR_Periph struct { CR RCR CSR RCSR } func (p *PWR_Periph) BaseAddr() uintptr { return uintptr(unsafe.Pointer(p)) } //emgo:const var PWR = (*PWR_Periph)(unsafe.Pointer(uintptr(mmap.PWR_...
aa723a2ecae8b196e83a7525176eaef29e5c8c78
c9ea05c7d8b0d01cc62d9319ea8c1adc72214ccb
sankala-dremio/opentelemetry-collector
/processor/probabilisticsamplerprocessor/factory.go
Go
go
1,714
permissive
// Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
a819294c3283d2a3a43e2f9c6f234f9c38967660
87b0c24330270b83d2c208f6ccfce4b94e3cc5de
xybots/cadence-aws-sdk
/activities/lambda/lambda.go
Go
go
23,073
permissive
// Generated by github.com/temporalio/temporal-aws-sdk-generator // from github.com/aws/aws-sdk-go version 1.35.7 package lambda import ( "context" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/lambda" "github....
28254aceb308838b6ba0e60e67ccefdaa05734bf
6870c90790bc2c3cc709dd7babad22587c7fd3a6
er123rin/cli
/cmd/gh/main.go
Go
go
3,828
permissive
package main import ( "errors" "fmt" "io" "net" "os" "os/exec" "path" "strings" "github.com/cli/cli/command" "github.com/cli/cli/internal/config" "github.com/cli/cli/internal/ghinstance" "github.com/cli/cli/internal/run" "github.com/cli/cli/pkg/cmd/alias/expand" "github.com/cli/cli/pkg/cmd/factory" "gi...
5c6c5e668d8ba1ecad8da984517c152d0bf80ad5
f56d21d838604f359a9819870e523f3e9fdb4f33
martinei/terraform-provider-instana
/instana/resource-custom-event-specficiation-threshold-rule_test.go
Go
go
33,148
permissive
package instana_test import ( "fmt" "net/http" "strconv" "strings" "testing" "github.com/gorilla/mux" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" "github.com/stretchr/testify/assert" . "github.com/gessnerfl/terr...
23be1a3d45af61583015fb8b2b559aca59aa2312
de3c7b2eca493c56d1b3f6f6857a7c17d71a6abe
KrunalXpress/introducing-go
/ch6/ex7/main.go
Go
go
452
no_license
package main import "fmt" func makeEvenGenerator() func() uint { //closure example - write a function that returns another function. i := uint(0) return func() (ret uint) { ret = i i += 2 return } } func main() { nextEven := makeEvenGenerator() //(nextEven)returns a (makeEvenGenerator)function that generate...
dfc1cf209824830004a9d095bc849bc7d134937c
7feb210c70d1a8253180e18cccf2c2275836df14
AccelByte/accelbyte-go-sdk
/eventlog-sdk/pkg/eventlogclientmodels/models_generic_query_payload.go
Go
go
3,342
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 eventlogclientmodels import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" ...
e39d6b67697d0ca8f16bf07a5aa95d6ff6d5dc03
d76c8f1bd6028b4fcf465203e56e1b3e6d357f59
Cielo2017/hyperledger-fabric-gm-1
/common/channelconfig/channel.go
Go
go
6,505
permissive
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package channelconfig import ( "fmt" "math" "github.com/dddengyunjie/hyperledger-fabric-gm/bccsp" "github.com/hyperledger/fabric/common/capabilities" "github.com/hyperledger/fabric/common/util" "github.com/hyperledger/fabric/ms...
73f4993a9d7b338400560dd210ca1375b09865d2
7910657e730f54c699fbcfb89939b090b9594bcf
raveltan/nusbi-server
/auth/createToken.go
Go
go
1,541
no_license
package auth import ( "github.com/form3tech-oss/jwt-go" "github.com/gofiber/fiber/v2" "time" ) func createToken(username string, role string) (string, error) { // Create token token := jwt.New(jwt.SigningMethodHS256) // Set claims claims := token.Claims.(jwt.MapClaims) claims["name"] = username claims["role...
cc8e31b3e7c7d5e62e120562800b5142378c7c82
0ef01af83ef8bf27a6c61f4ea6495d18b6adedb5
FengFees/letcode
/21/11/19可信/第一道.go
Go
go
2,270
no_license
package main import ( "fmt" "math" ) func payByPromotion(prices []int, promotions [][]int, discounts []int, order []int) int { var maxPrice, maxPromotions int mpPrice := make(map[int]int, len(prices)) mpOrder := make(map[int]int, len(order)/2) for i, price := range prices { mpPrice[i] = price } for i := 0;...
1b1ce1fba2d94bf589aa7e9b37c2e3572d57ce80
5a71360b64d83b96f70df9a3892ec78e6ecf0e72
wimspaargaren/mongo-go-driver
/bson/raw.go
Go
go
3,746
permissive
// Copyright (C) MongoDB, Inc. 2017-present. // // 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 package bson import ( "errors" "io" "github.c...
e5fa30665e44ac4030bfd1f41907468feda30c08
72036425b000c9521affc83840c4bf21993ab9e5
next-stack/cert-manager
/internal/apis/certmanager/validation/issuer_test.go
Go
go
44,829
permissive
/* Copyright 2020 The cert-manager 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...
855c48eb5564e7c682eb2b1332f8cf236ab311b6
12f1a8ad633c8ca8e4153c7b7d4ca03c4372a933
PacktPublishing/Hands-On-Dependency-Injection-in-Go
/ch06/acme/internal/logging/logging.go
Go
go
750
permissive
package logging import ( "fmt" ) // L is the global instance of the logger var L = &LoggerStdOut{} // LoggerStdOut logs to std out type LoggerStdOut struct{} // Debug logs messages at DEBUG level func (l LoggerStdOut) Debug(message string, args ...interface{}) { fmt.Printf("[DEBUG] "+message, args...) } // Info ...
99620e66380a7326775533b987d71c470a463ef9
161b2fab252269dfbe26872e00b57ef52b24c195
zuzzas/machine-controller-manager
/pkg/util/controller/client_builder.go
Go
go
3,072
permissive
/* Copyright 2016 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, ...
195564b4549df137c24baf355677bb73ac826a2d
9a85e9b7ef85a58df10914c92b51ca90ad079be3
rveen/golib
/polarion/polarion.go
Go
go
14,838
permissive
// This package implements an API over a working copy of a Subversion repository // of a Polarion project. It qualifies as a hack. // // NOTE To build a local copy with revisions, svnrdump can be used, and then a // local SVN or Git server repo created. But: Git doesn't support files > 100 MB ! // // NOTE https://gist....
4881256b173b7c4f2155f0aba446ae22e4d5c8f7
9140a887196411a2e2516f07687c887ce142684b
youthonline/bitshares
/types/gen_dynamicglobalpropertyid.go
Go
go
2,217
permissive
// This file was automatically generated by genny. // Any changes will be lost if this file is regenerated. // see https://github.com/cheekybits/genny package types import ( "fmt" "github.com/youthonline/bitshares/util" "github.com/denkhaus/logging" "github.com/juju/errors" ) type DynamicGlobalPropertyID struct...
076c8e8de4c3212952c804dabd890e924a84902f
1693773b42b54195c21da5ddfd521d1902c30e95
limitmhw/HydroCMS
/controllers/node.go
Go
go
2,373
permissive
package controllers // import ( // "encoding/json" // "github.com/astaxie/beego" // "github.com/astaxie/beego/orm" // // m "github.com/beego/admin/src/models" // m "hydrocms/models" // ) // type NodeController struct { // beego.Controller // } // func (this *NodeController) Rsp(status bool, str string) { // t...
94c5c592c3f1d866289fc537fe44d33b64aac51f
b0b4a3c8e0b470472cb061b2b9938fe1c55a1090
rebornwwp/learn-go-with-tests
/mocking/mocking_test.go
Go
go
655
no_license
package mocking import ( "bytes" "testing" "time" ) func TestCountdown(t *testing.T) { buffer := &bytes.Buffer{} sleeper := &ConfigurableSleeper{time.Microsecond} Countdown(buffer, sleeper) got := buffer.String() want := `3 2 1 Go!` if got != want { t.Errorf("got '%s' want '%s'", got, want) } } func Te...
bf042bf7041fb8e407a9d08a836c1f9cf103a67b
8f50548663fbef3fb81dbef4f652af053a6d7dd3
hprateek43/kubernetes
/test/e2e_node/podresources_test.go
Go
go
28,562
permissive
/* 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 or agreed to in writing, ...
7033d9eb42391ee492412dbf4567a9f12f7b585f
37cc58de920f20d2fde61e775060d7b14eadc72c
pinkgorilla/go-sample
/pkg/alert/log_test.go
Go
go
254
no_license
package alert_test import ( "testing" "github.com/pinkgorilla/go-sample/pkg/alert" ) func Test_LogAlert(t *testing.T) { a := alert.NewLogAlert() err := a.Alert(alert.NewAlertMessage("hello message", nil, nil)) if err != nil { t.Fatal(err) } }
9d6b329d5f0169a31672074b864cac6a0af57eaf
b969b0107c1101f2cfd2a170a5fcb18b77e85e9e
wallstromsimon/leetcode
/longestPalindromeSubstring_test.go
Go
go
3,009
no_license
package leetcode import ( "testing" ) // Solution to https://leetcode.com/problems/longest-palindromic-substring/ func TestPalindromeLongestSubstring(t *testing.T) { result := longestPalindrome("babad") expectedResult := "bab" if result != expectedResult { t.Errorf("Got %s; expected %s", result, expectedResult)...
f27dcf2335c6818706dc7579a7dedd5fb8b185b0
e59a311effc2c9dcec742bb9e92fd79ea18c6b8c
salmonofdoubt/TECH
/PROG/GO/go-Lynda-copyright/cc/00_language-fundamentals/01_getting-started/02_numeral-systems/03_hexadecimal/main.go
Go
go
356
no_license
package main import "fmt" func main() { // fmt.Printf("%d - %b - %x \n", 42, 42, 42) // fmt.Printf("%d - %b - %#x \n", 42, 42, 42) // fmt.Printf("%d - %b - %#X \n", 42, 42, 42) fmt.Printf("%d \t %b \t %#X \n", 42, 42, 42) } /* All material is licensed under the Apache License Version 2.0, January 2004 http://www...
5052236dc0aa1aa422df6021e7e7f065dbccbc3c
715b508d419a3d4b6dc8610ab01977fa2107a79c
109km/learn-go-by-examples
/43_string_functions/string_functions.go
Go
go
281
no_license
package main import ( "fmt" "strings" ) var log = fmt.Println func main() { log("Join:", strings.Join([]string{"a", "b"}, "-")) log("Count:", strings.Count("helllo", "l")) log("Repeat:", strings.Repeat("a", 3)) log("Replace:", strings.Replace("foooooooo", "o", "0", 3)) }
4e7f5180b58ecfc6281c9ef5a91c2cb4fb8cec9f
8923899cf05eb35ab2c509b2775b0e3241c0acd2
doc22940/migrate
/database/mysql/mysql_test.go
Go
go
8,047
permissive
package mysql import ( "context" "database/sql" sqldriver "database/sql/driver" "fmt" "log" "testing" ) import ( "github.com/dhui/dktest" "github.com/go-sql-driver/mysql" "github.com/stretchr/testify/assert" ) import ( "github.com/golang-migrate/migrate/v4" dt "github.com/golang-migrate/migrate/v4/databas...
d1390817d67d0f7fd001b8a991f55d78a01d82b6
8645078a0af20a1f4adcea2ad91c96d8be14167b
mikma/gvisor
/pkg/sentry/fsimpl/verity/verity.go
Go
go
36,565
permissive
// Copyright 2020 The gVisor Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
4c0f86846ff17542e2b30165fbfbe4757567610d
7b0c9d5f447fd3cc44a77ea4e4a3da9d93b6f82a
ericzhang6222/arrai
/syntax/std_re.go
Go
go
2,228
permissive
package syntax import ( "context" "fmt" "regexp" "github.com/arr-ai/arrai/rel" "github.com/arr-ai/arrai/tools" ) var ( stdReMatch = rel.NewNativeFunction("compile", func(_ context.Context, re rel.Value) (rel.Value, error) { reStr, is := tools.ValueAsString(re) if !is { return nil, fmt.Errorf("//re.compi...
43e2cb04ef8b8740448be9433c6c27c222a1a230
ff0bb5c0cf4df6c553526e4ae10ab6d67f776a8b
SergeKrier/gobmp
/pkg/sr/sr-local-block-tlv.go
Go
go
1,318
permissive
package sr import ( "encoding/binary" "fmt" "github.com/golang/glog" "github.com/sbezverk/gobmp/pkg/tools" ) // CapabilityTLV defines SR Capability TLV object // https://tools.ietf.org/html/draft-ietf-idr-bgp-ls-segment-routing-ext-08#section-2.1.4 type LocalBlockTLV struct { SubRange uint32 SID *SIDTLV }...
0ba94b61183c502975602674998d6e9510789e03
ebf5863ae1752b0ff1ea75c7ebb02d01237cce9c
VonRosenchild/amboy
/vendor/gonum.org/v1/gonum/lapack/gonum/dlasq2.go
Go
go
9,515
permissive
// Copyright ©2015 The gonum 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 gonum import ( "math" "gonum.org/v1/gonum/lapack" ) // Dlasq2 computes all the eigenvalues of the symmetric positive // definite tridiagonal ma...
d59cb3acf388054d7db654ca58f9e924b0841611
f950b1fe5a42351b0692cbd29191f630d40b6c4c
RanchoCooper/go-cookbook
/chapter04/log/example/main.go
Go
go
237
no_license
package main import ( "fmt" "github.com/RanchoCooper/go-cookbook/chapter04/log" ) func main() { fmt.Println("basic logging and modification of logger:") log.Log() fmt.Println("logging 'handled' errors:") log.FinalDestination() }
cedcdfaadf19d310e180d86162a3fff9c95cfb5b
26cbdae1aea329e577d979387bf6b70275340eae
pks-os/kubernetes-router
/vendor/github.com/tsuru/tsuru/provision/kubernetes/provisioner.go
Go
go
43,734
permissive
// Copyright 2016 tsuru 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 kubernetes import ( "context" "flag" "fmt" "io" "net/url" "strconv" "strings" "sync" "time" "github.com/pkg/errors" "github.com/tsuru/config...
a51ea4cd9a75d11d344c08450bf29a5b93369755
62d00f28624f463b8e77a2641c5480559b46b531
jreece1567/go_swagger_client
/models_core/movie_links.go
Go
go
3,603
permissive
package models_core // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( strfmt "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/errors" "github.com/go-openapi/validate" ) /*MovieLinks movi...
390fadd1bce4acf38bd62e684bfffebc852ac039
c9181eb59ac3b829adb79dcd81f70cd1a9ee0574
mklimuk/test-alsa
/vendor/github.com/mklimuk/husar/train/utils_test.go
Go
go
11,645
no_license
package train import ( "strconv" "testing" "time" "golang.org/x/text/language" "github.com/mklimuk/husar/config" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) type TrainUtilsTestSuite struct { suite.Suite } func (suite *TrainUtilsTestSuite) TestServiceChecker() { train := Tra...
c80b84718ee21ba46614b8c9bc07dfdf0b4e9f99
13b6cb45fbf67ee8d2e5f9999a30f7387c065d9b
rust-chainblock/walletSrv
/coldWallet/sign/eth.go
Go
go
1,851
no_license
package sign import ( "encoding/hex" "fmt" "golang.org/x/crypto/sha3" "math/big" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" ) func FloatToBigInt(val float64) *big.Int { bigval := new(big.Float) bigval.SetFloat64(val) coin ...