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
e1f24104c9599ed537d56d15e56119fb93574c03
bd60270f42a6beb386fa66bddc0b1b14f1ac9312
ftyszyx/zyxlibs
/wechat/pay/pay.go
Go
go
4,219
permissive
package pay import ( "encoding/xml" "errors" "fmt" "github.com/ftyszyx/libs/wechat/context" "github.com/ftyszyx/libs/wechat/util" ) var payGateway = "https://api.mch.weixin.qq.com/pay/unifiedorder" // Pay struct extends context type Pay struct { *context.Context } // Params was NEEDED when request unifiedord...
30307265e3bdbef918eb44296e697cf4ead4e68a
fed17bcf47def45f7f7c0534b75241031a28487d
CS-Infinite/csinf-backend-2020
/day2/webservice/server/router.go
Go
go
384
no_license
package server import ( "../controller" "github.com/gin-gonic/gin" ) func NewRouter() *gin.Engine { router := gin.New() router.GET("/ping", controller.Ping) productController := controller.ProductController{} router.GET("/products", productController.ReadAll) router.GET("/product", productController.Read) r...
dede33687094119c95bd6ebdb4af8f3a5463b869
d5711b0c3358d81915b4a382ac8ac7c42e1dd274
ekmixon/rudolph
/internal/cli/flags/custom-args.go
Go
go
732
permissive
package flags import ( "fmt" "os" "path/filepath" "github.com/spf13/cobra" ) func FileArg(cmd *cobra.Command, args []string) error { if len(args) != 1 { return fmt.Errorf("one argument, as the full path to a file, is required") } fileInfo, err := os.Stat(args[0]) if err != nil { return fmt.Errorf("could...
afac6ff4cc42e33810147ae1d3b26a2b4630bf03
3b975845e2aae87bff7521505205bb8b71f06df7
misachi/budgetor
/users/repository.go
Go
go
299
no_license
package users import "budgetor/budgets" /* UserRepo shoud be **/ type UserRepo interface { GetAllUsers(u []User) []User GetUser(u User) interface{} AddUser(u User) UpdateUser(u *User, data map[string]interface{}) DeleteUser(u *User) AddBudgetPeriod(user *User, item *budgets.BudgetPeriod) }
08fdfbfd60488382696bccfcfcd993027b86cef6
0bd1523ec7abcb8628b7e028b1c555479bf80e38
starchainstc/starchain
/account/client.go
Go
go
20,494
permissive
package account import ( "starchain/crypto" "starchain/core/transaction" ."starchain/common" ct"starchain/core/contract" "sync" "time" "fmt" "os" "starchain/core/ledger" "bytes" "encoding/binary" "syscall" "os/signal" "starchain/common/log" "starchain/events/signalset" "crypto/sha256" "strings" "star...
02ce144cd8bfa212f2b5d69780d8c85c919a2ce0
071a8f6edaaeb298bdeb154a00445cef2ce2b600
niallnsec/demo_auth
/main.go
Go
go
786
no_license
package auth import ( _ "github.com/BurntSushi/toml" _ "github.com/aws/aws-sdk-go" _ "github.com/fatih/color" _ "github.com/gofrs/uuid" _ "github.com/gomodule/redigo/redis" _ "github.com/gorilla/csrf" _ "github.com/gorilla/handlers" _ "github.com/hashicorp/vault/api" _ "github.com/jackc/pgconn" _ "github.com...
98853c71c877b6d14d9e9efcae4347f250b6aac4
ef49eb2c768c85e56c3c7294d17f6e1b43fa7ce8
doorOfChoice/dawn_media
/model/category.go
Go
go
783
no_license
package model import "errors" /** 创建分类 */ func (c *Category) Create() error { count := 0 db.Model(Category{}).Where("name=?", c.Name).Count(&count) if count != 0 { return errors.New("分类已经存在") } db.Save(c) return db.Error } /** 更新分类 */ func (c *Category) Update() error { if u, err := FindById(&Category{}, c....
c3c8c13bb0877a47770c15e9c3e8d1de15b42d8c
aab7b7168565c37e7ddc72a331e64ed7cf892ff4
maximilien/knctl
/pkg/knctl/cmd/route.go
Go
go
3,985
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 agreed to in writing, soft...
b0178b380bba33b756d7ce903e802cd1d2f81928
bd4fd5bb3a050c28a2ec0cf4beaec739fd379f13
ankitanwar/DataStructure
/stackAndQueues/nonRepeatingStream.go
Go
go
601
no_license
package stackandqueues //NonRepeating : To find the non repeating character in the queue func NonRepeating(s string) []string { ans := []string{} queue := Queue{} dict := make(map[string]int) for i := 0; i < len(s); i++ { current := string(s[i]) _, found := dict[current] if found == false { dict[current] ...
48c55be699fe263a3f737bc16eb6c6b57e486c76
64123526c4439e72fddc08fc069977dc69032f4e
snarksliveshere/otus_golang
/hw_13_sql/internal/data_handlers/events_for_month.go
Go
go
848
no_license
package data_handlers import ( "github.com/snarskliveshere/otus_golang/hw_13_sql/config" "github.com/snarskliveshere/otus_golang/hw_13_sql/internal/helpers" "time" ) func CheckEventsForMonth(date string) (map[string]time.Time, error) { firstDate, err := helpers.GetFirstDateFromMonth(date) if err != nil { retur...
0512a980cdf78f6451ecd42bf383f959863a254f
7aedf986ac4932731ac6f7ef7cdb3d86f919a004
TRSWNCA/codeforces-tool
/cmd/watch.go
Go
go
358
permissive
package cmd import ( "github.com/xalanq/cf-tool/client" ) // Watch command func Watch() (err error) { cln := client.Instance info := Args.Info n := 10 if Args.All { n = -1 } if _, err = cln.WatchSubmission(info, n, false); err != nil { if err = loginAgain(cln, err); err == nil { _, err = cln.WatchSubmis...
5f5ec72dc06fabefad5cf08b6ae4d2ba74c183ef
3c6d5770a7746dae2c5cd38573f018c0198ed9aa
moinfar/codenames
/server.go
Go
go
5,954
no_license
package codenames import ( "encoding/json" "fmt" "html/template" "net/http" "path" "sort" "strings" "sync" "time" "github.com/jbowens/dictionary" ) type Server struct { Server http.Server tpl *template.Template gameIDWords []string mu sync.Mutex games map[string]*Game defaultWor...
1c17114fd16557eb73f9f2c5b6b54ca31de22456
f3ace914d055f5042f3a63717fdf3847fc7abea7
mimani68/Blockchain-wallet
/oldwallet.go
Go
go
782
no_license
package main import ( "crypto/ecdsa" "fmt" "log" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" ) func createOldWallet() { privateKey, err := crypto.GenerateKey() if err != nil { log.Fatal(err) } privateKeyBytes := crypto.FromECDSA(privateKey) fmt.Println("SAVE...
ef0955e88891831d8ebc4d6f5feae3cfefa5ce9c
eb2980dfa880b2a2ce868a060eb1e258749b3137
peter-vaczi/sprinkler
/api/stubs_test.go
Go
go
499
no_license
package api_test import "github.com/peter-vaczi/sprinkler/gpio" type GpioStub struct { pins map[int]*PinStub } func NewGpioStub() *GpioStub { return &GpioStub{pins: make(map[int]*PinStub)} } func (g *GpioStub) NewPin(p int) gpio.Pin { pin := &PinStub{pin: p} g.pins[p] = pin return pin } type PinStub struct { ...
2b745fafc958f97c61c1336c9d4323a50aefa905
7c85b9aad76af6ca6aef9ada3de42602374f810f
hbtc-chain/bhchain
/x/custodianunit/genesis.go
Go
go
601
permissive
package custodianunit import ( sdk "github.com/hbtc-chain/bhchain/types" ) // InitGenesis - Init store state from genesis data // // CONTRACT: old coins from the FeeCollectionKeeper need to be transferred through // a genesis port script to the new fee collector CU func InitGenesis(ctx sdk.Context, ak CUKeeper, data...
1dd719ded3c2dc9f5f0cca3cea07d303610c3af1
92d528c6dc6cb107c7f5f742f186e6f70b7da67d
tangbaoabo/crawler
/persist/Itemsaver.go
Go
go
1,004
no_license
package persist import ( "crawler/engine" "github.com/pkg/errors" "golang.org/x/net/context" "gopkg.in/olivere/elastic.v6" "log" ) func ItemSaver(index string) (item chan engine.Item, err error) { out := make(chan engine.Item) client, e := elastic.NewClient(elastic.SetSniff(false)) if e != nil { return nil,...
19326996fb82feef0915128cb1dd49ebd7d623a6
ef966b715ff9d887990c00ace68bf2501b727352
abicky/ecsmec
/internal/service/service_test.go
Go
go
6,099
permissive
package service_test import ( "io/ioutil" "log" "os" "reflect" "testing" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ecs" "github.com/golang/mock/gomock" "github.com/abicky/ecsmec/internal/service" "github.com/abicky/ecsmec/internal/testing/mocks" "github.com/abicky/ecsmec/internal/...
041384fcfb1a064587e8257f95698ddea186a7b9
355f74e673a44e988cc33962e85d8ce8f791d646
kedacore/keda
/vendor/github.com/arangodb/go-driver/database_graphs.go
Go
go
4,094
permissive
// // DISCLAIMER // // Copyright 2017 ArangoDB GmbH, Cologne, Germany // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless require...
de7859cce02e08711ec37543e500a94bdaeacf8a
c27f25a824bf9697f197cc9d8c46e8ae6a82456f
go-xe2/xthrift
/lib/go/test/comm/helloHandler/hello_handler.go
Go
go
687
no_license
/***************************************************************** * Copyright©,2020-2022, email: 279197148@qq.com * Version: 1.0.0 * @Author: yangtxiang * @Date: 2020-08-24 14:07 * Description: *****************************************************************/ package helloHandler import ( "fmt" "github.com/go-xe2...
6cb8d08494ac82001396500bb76d800598b4a652
feeafd671ab8c52e6aafc86196ccad3a92de5716
chslink/go-eval
/ast.go
Go
go
335
permissive
package eval type Expr interface { Eval(env Env) float64 // Check reports errors in this Expr and adds its Vars to the set Check(vars map[Var]bool) error } type Var string type literal float64 type unary struct { op rune x Expr } type binary struct { op rune x, y Expr } type call struct { fn string ...
50dad3149be7320e55339531a0c21dd925b79415
d56942f0c4caaf9a0e266f4b3901decf10cbbe91
yuzliu/kfserving
/pkg/controller/v1alpha1/trainedmodel/controller_test.go
Go
go
21,884
permissive
/* Copyright 2020 kubeflow.org. 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, software d...
a2045ff4d52ed30c920860f1d64f640cb86e9333
b552b16c14de4689fb9d710aa1bd4a38ef6e7c12
ericjohnsohnisc/armada
/cmd/armadactl/cmd/info.go
Go
go
1,422
permissive
package cmd import ( "context" "sort" "time" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "google.golang.org/grpc" "github.com/G-Research/armada/pkg/api" "github.com/G-Research/armada/pkg/client" ) func init() { rootCmd.AddCommand(infoCmd) } var infoCmd = &cobra.Command{ Use: "info queue",...
d34c2fc520f99582a5a7d6643e61da528790eb16
b491527fe1987e86ca957705dd29424fe30ed943
oinume/lekcije
/backend/infrastructure/ga_measurement/ga_measurement.go
Go
go
532
permissive
package ga_measurement import ( "context" "github.com/oinume/lekcije/backend/model2" ) type gaMeasurementRepository struct { client Client } func NewGAMeasurementRepository(client Client) *gaMeasurementRepository { return &gaMeasurementRepository{client: client} } func (r *gaMeasurementRepository) SendEvent( ...
49424a1338d6550f5ca165dc3d59bae7ab349714
8a5f8e5f129223a20a7375545ac8772940b28c5f
unslur/Riverapi
/RiverFlow.go
Go
go
15,015
no_license
// RiverFlow package main import ( "fmt" "myfunc" "net/http" "time" "github.com/gin-gonic/gin" ) type Tmp_tspss_dwd_flow struct { Station_id string `db:"station_id"` Capture_time string `db:"capture_time"` Area string `db:"area"` Waterlevel_start string `db:"waterlevel_start"` Wate...
53c9f216fc37ef76197d3304c88733818cae8db7
c1f735e9f999c25dc1928edcab20ea179b171434
unixorn/kubectx
/internal/kubeconfig/helper_test.go
Go
go
1,405
permissive
// Copyright 2021 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 ...
c07ec05603369ac2130722436c982d5dbd90fc1f
cf690f0840637118f2978fe94d57314d96ba63bf
gomini/go-mips32
/test/syntax/semi5.go
Go
go
263
permissive
// errorcheck // Copyright 2010 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 main func main() { // ERROR "unexpected semicolon or newline before .?{.?"
93837205e5b29593c7439ab6c8aeefcf2a366bca
1c080dbc007185e3d0fd29ee391c538809a79512
Snaxai/IS105
/ICA02/Oppg3/unicode/Oppg 3a.go
Go
go
709
no_license
package unicode import ( "fmt" ) const unicode = "\xbd\xb2\x3d\xbc\x20\xe2\x8c\x98" //x8c kan bli gjort om til xc6 og x98 kan gjort om til x7e //for å skrie ut de riktige symbolene const otherunicode = "\xc2\xbd\x3f\x3d\x3f\xe2\x8c\x98" //SkrivUT skriver ut const unicode på %q func SkrivUT() { for i := 0; i < len(...
9a328691e76ab07a778592bb22ea0e110affc572
27fb6fbc587972166b14541b8b5af56a2c412816
kalohq/concourse-up
/commands/deploy.go
Go
go
3,788
permissive
package commands import ( "errors" "os" "github.com/EngineerBetter/concourse-up/bosh" "github.com/EngineerBetter/concourse-up/certs" "github.com/EngineerBetter/concourse-up/concourse" "github.com/EngineerBetter/concourse-up/config" "github.com/EngineerBetter/concourse-up/fly" "github.com/EngineerBetter/concou...
caa609953237cfe6c0806b78538bafc530982aca
f1cf890fc682bf10a2795806c77e62d2cbe0a8f3
acoshift/flash
/flash_test.go
Go
go
8,232
permissive
package flash import ( "testing" . "github.com/smartystreets/goconvey/convey" ) func TestNew(t *testing.T) { Convey("Given new flash", t, func() { f := New() Convey("Flash should not be nil", func() { So(f, ShouldNotBeNil) }) Convey("Flash data should be empty", func() { So(f.v, ShouldBeEmpty) }...
f7089c3f779118253247dc842882ad3efd494da7
5d925ae40296a857372be3c5a199645b55ccd031
jfreymuth/pulse
/record.go
Go
go
6,782
permissive
package pulse import "github.com/jfreymuth/pulse/proto" // A RecordStream is used for recording audio. // When creating a stream, the user must provide a callback that will be called with the recorded audio data. type RecordStream struct { c *Client index uint32 state streamState err error w Writer createR...
963d0515fa10771e76ce600685b15bc8514620a9
4d1cf246bb512e552f5b8dca3194531ebe5c87e3
keepondream/go-learn
/src/ch10/func/func_test.go
Go
go
834
no_license
package func_test import ( "fmt" "math/rand" "testing" "time" ) func returnMultiValuse() (int, int) { return rand.Intn(10), rand.Intn(20) } func timeSpent(inner func(op int) int) func(op int) int { return func(n int) int { start := time.Now() ret := inner(n) fmt.Println("time spent:", time.Since(start)....
2423f680315ef7ca3de65298eb59492285367e4e
e219fa9ab837c8117c6ffdeb37b0a6e90f45ccab
line/line-bot-sdk-go
/linebot/httphandler/httphandler.go
Go
go
2,200
permissive
// Copyright 2016 LINE Corporation // // LINE Corporation licenses this file to you 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 requi...
4aac413a822826e8cf72ed7e39214ba495cc79f7
6d590e847700bb7f93f60315e169aa243562a9f4
cvincent00/antsdk
/api/shop/AlipayOfflineMarketApplyorderBatchqueryRequest.go
Go
go
3,363
no_license
package shop import ( "github.com/cvincent00/antsdk/api" "github.com/cvincent00/antsdk/utils" ) // 业务流水批量查询接口 // 通过该接口分页查询Leads、门店、商品相关操作流水信息 type AlipayOfflineMarketApplyorderBatchqueryRequest struct { api.IAlipayRequest TerminalType string `json:"terminal_...
8a2572adb9200b3025ef83e0ed02622cca5ac5a7
19b946a3f1e324a839304682a7a59e2efbbce4e2
ManchersterByTheSea/openBilibili
/go-common/app/interface/main/tv/model/media.go
Go
go
7,289
no_license
package model import ( "fmt" "net/url" "go-common/library/time" ) const ( _epFree = 2 ) // SeasonCMS defines the elements could be changed from TV CMS side type SeasonCMS struct { SeasonID int64 Cover string Desc string Title string UpInfo string Category int8 // - cn, jp, ...
a61a610050af6cd184ab40701bbfd8ccc79660ea
ee29d95e02e098dee21671980be5a6e87c724d30
skycoin/skycoin-exchange
/_vendor-20171101171736/github.com/skycoin/skycoin/src/mesh/nodemanager/node_record.go
Go
go
3,479
no_license
package nodemanager import ( "log" "net" "strconv" "strings" "sync" "github.com/skycoin/skycoin/src/cipher" "github.com/skycoin/skycoin/src/mesh/messages" ) type NodeRecord struct { id cipher.PubKey nm *NodeManager transports map[messages.TransportId]*TransportRecord transportsByNodes map[cipher.PubKey]...
e955e29efff4be7fb68a789860ff0d45cca6f423
5606152f56277322d69d70c8009a3ce06cf98cd6
rizalaslams/miniewallet
/api/model/user.go
Go
go
2,318
no_license
package model import ( "errors" "time" "github.com/badoux/checkmail" "golang.org/x/crypto/bcrypt" ) type User struct { ID uint64 `gorm:"primary_key;auto_increment" json:"id"` Username string `gorm:"size:255;not null;unique" json:"username"` Email string `gorm:"size:100;not null;unique" json:...
95d71247d68aa24d2480f7bffb26a9676d226fae
5eaa3dc8f80b4e30f962005691e104571b705db3
cahyowhy/go-basic-rest-api-revisit
/handler/book_handler.go
Go
go
2,032
no_license
package handler import ( "net/http" "sync" "github.com/cahyowhy/go-basit-restapi-revisit/service" "github.com/cahyowhy/go-basit-restapi-revisit/util" "github.com/gofiber/fiber/v2" "gorm.io/gorm" ) type BookHandler struct { service *service.BookService } func (handler *BookHandler) GetAll(c *fiber.Ctx) error ...
efe2c4545fe5ebd3dbeb7e4adcb39af76e851951
615171e017f88e1b2c8d76b1816559fb0b7346de
wylyeak/simplejson
/json_object.go
Go
go
4,313
permissive
package simplejson import "encoding/json" type JSONObject struct { innerMap map[string]interface{} } // NewJSONObjectFromString returns a new JSONObject, parsed from a string or an error if unsuccessful func NewJSONObjectFromString(jsonobject string) (*JSONObject, error) { var resultingMap map[string]interface{} ...
667be97e72f96da1ef35d7d7640dedb89bf66095
248bf7e51fde24a2a9d9c76f03dbc1edbecb674b
liudanyejiantai/mongo-go-driver
/mongo/index_view.go
Go
go
9,563
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 mongo import ( "bytes" "context" "erro...
19a7bd082119c67ed2178ae68cf9d32f721e546d
784190cee929534123f1e86226b72c7cc33904bd
csanclop/magma
/symphony/graph/importer/exported_ports.go
Go
go
7,998
permissive
// Copyright (c) 2004-present Facebook All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package importer import ( "context" "fmt" "io" "net/http" "strconv" "github.com/facebookincubator/symphony/graph/ent" "github.com/facebookincubato...
3ce174bee8e71977acdf23b916d6474a09ceec05
230822d64ff388f6b132220911cb36065faf313f
PoonamSama/go-programming
/CONTEXT/WithCanclel/001WithCancel/001WithCancel.go
Go
go
669
no_license
package main import ( "context" "fmt" ) func main() { ctx := context.Background() fmt.Println("Context", ctx) fmt.Println("Context Error:", ctx.Err()) fmt.Printf("Context type %T\t \n", ctx) fmt.Println("________") ctx, cancel := context.WithCancel(ctx) fmt.Println("ContextWithCancel", ctx) fmt.Println("Con...
9a9491baf81e9443e1596dce6739bfb6e0c0fc82
0117cbc3b042ed4d5111b2dffff5b73f5de88c1a
guanbinbin/ebook
/routers/commentsRouter_controllers.go
Go
go
2,020
no_license
package routers import ( "github.com/astaxie/beego" ) func init() { beego.GlobalControllerRouter["ebook/controllers:AngularController"] = append(beego.GlobalControllerRouter["ebook/controllers:AngularController"], beego.ControllerComments{ Method: "AngularRender", Router: `/*`, AllowHTTPMethods: []strin...
8e1a01ac0592fe5fab095d88328adbb459fd313b
f139a42745598c83341cbf6f009819053ccad92b
yuzixun/algorithm_exercise
/offer/33.go
Go
go
999
no_license
package main func verifyPostorder(postorder []int) bool { if len(postorder) <= 2 { return true } return verifyHelper(postorder, 0, len(postorder)-1) } func verifyHelper(postorder []int, left, right int) bool { if left >= right { return true } var i int for i = left; i < right; i++ { if postorder[i] > p...
efc4e2229afd7993a7b2b6739d2c36de2a08f741
32dad4333d7bf0cb55dc098bc0312a74fbed179e
LiangTsao/metallb-operator
/controllers/suite_test.go
Go
go
4,615
permissive
/* 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, software distributed under the License...
553d872b133f42d0349921c2f109f08707f69efc
53444e284920cf1f07db5bf96b354fcc0bda28b1
eminom/gocom
/basic.go
Go
go
728
no_license
package main import ( "fmt" "github.com/tarm/serial" "log" "time" ) func main() { // c := &serial.Config{Name: "COM4", Baud: 115200} c := &serial.Config{ Name: "COM4", Baud: 128000, //115200, Size: 8, StopBits: serial.Stop1, Parity: serial.ParityNone, ReadTimeout: 500 * ...
041883a9e4af6c82c34f4edbcc9ce44b5a590940
1c7f3a337240b7a8fc57498fb237c9a0cc87f7cc
solarwindscloud/azure-sdk-for-go
/profiles/preview/preview/billing/mgmt/billing/models.go
Go
go
28,566
permissive
// +build go1.9 // Copyright 2019 Microsoft Corporation // // 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...
d903158ba47128409c3d75a848cdf96647822e3b
b7ef098eedc9b8909abe73b442959cbad26e6412
alcuizarem/luci-go
/common/api/buildbucket/buildbucket/v1/buildbucket-gen.go
Go
go
116,833
permissive
// Copyright 2018 The LUCI Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
1cb98ea5e1740e97f2a87745ac3232a88689e356
e18169ae8d56b25835bf00c6b55affe49d232709
vishvananda/netlink
/netns_test.go
Go
go
2,092
permissive
// +build linux package netlink import ( "os" "runtime" "syscall" "testing" "github.com/vishvananda/netns" ) // TestNetNsIdByFd tests setting and getting the network namespace ID // by file descriptor. It opens a namespace fd, sets it to a random id, // then retrieves the ID. // This does not do any namespace ...
23ddf05906327c0ddb1ea1918270f6e247ce3d05
aa6102ea101819336fcd5d559e13b2b983194666
funkygao/govtil
/net/server/logginghandler/logginghandler.go
Go
go
1,986
permissive
// Package logginghandler provides an HTTP handler wrapper that performs simple // logging for each HTTP request received, and then forwards the request to an // underlying handler. // // Format of logging is: // <logger_timestamp> HTTP(<request_GUID>) <METHOD> from <RemoteAddr> for <URL> // <logger_timestamp> HTTP(<re...
2e83dded0ce24edb91518e2157273fb602105323
6b60cb4c03422ed1a0c09ae825731f1f14bc8a07
PengInGitHub/Learning-Go
/Function/Q8.go
Go
go
289
no_license
package main import ( "fmt" ) type stack struct{ i int data [10]int } func(s *stack) push(k int){ s.data[s.i] = k s.i++ } func(s *stack) pop() int{ s.i-- return s.data[s.i] } func PrintStack(){ var s stack s.push(25) fmt.Printf("stack:v%\n",s) }
8ca72deaf2d7815a7a7f1c40e7db070837713c74
be553f2400e5111bff8d05a97b71726ac63a5b60
br0xen/sunlight-api
/openstates/states/states.go
Go
go
12,412
no_license
package states import ( "errors" "strings" ) // ScrubToAbbr takes a name or abbr and returns an abbr func ScrubToAbbr(nm string) (string, error) { var err error orig := nm if IsValidName(nm) { nm, err = NameToAbbr(nm) } if !IsValidAbbr(nm) { return "", errors.New("Invalid State: " + orig) } return nm, er...
5e84c9cacbd1b798e2614ec224291a074b25fcc5
cceba14fbe350839665b3a45a1dfe41bd61d35a0
demget/telebot
/games.go
Go
go
2,558
permissive
package telebot import ( "encoding/json" "strconv" ) // Game object represents a game. // Their short names acts as unique identifiers. type Game struct { Name string `json:"game_short_name"` Title string `json:"title"` Description string `json:"description"` Photo *Photo `json:"photo"` // (Optio...
0ad27a09838d2acf32025633590ec86a3a2070ba
78e5de0891da5b6c844bd807ebc4044d25d6cfcd
jalemieux/go-cloudstack
/cloudstack43/InternalLBService.go
Go
go
30,210
permissive
// // Copyright 2014, Sander van Harmelen // // 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...
598fe3ffeef0f6ad378b21f19e211fa0f9de2233
46be107833e9f500111fa356f323006a3be5a25a
airdispatch/zooko-go
/rpc/rpc.go
Go
go
631
no_license
package rpc import ( "errors" "getmelange.com/zooko/account" "github.com/melange-app/nmcd/btcjson" ) // Server represents type Server struct { Username string Password string Host string } const ( // This allows for three "transaction-units to occur": // - name_new + fee // - name_firstupdate + fee en...
ee9f382695917f0f9d9828fdcd59a820eef52f92
25e4eda34cad9e47000153c2326a6cf31c0d95d6
jeis2497052/ubiquity
/local/spectrumscale/connectors/resources.go
Go
go
25,077
permissive
/** * Copyright 2017 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
f81b8f5c458bf51ae36802547310bb71cb6dc679
f40ce78b13973c7d1f2209b80dcc156057c73f5a
HexColors60/gate
/pkg/internal/health/service.go
Go
go
925
permissive
// GRPC health check server // (https://godoc.org/google.golang.org/grpc/health/grpc_health_v1) package health import ( "context" "google.golang.org/grpc" rpc "google.golang.org/grpc/health/grpc_health_v1" "net" "time" ) func New(addr string) (run func(stop <-chan struct{}, checkFn CheckFn) error, err error) { ...
ad7e9e7d93a98d244896dbe0d93418a8dccaeba8
580c34a76b253b1479b2ace14446256a6d417052
ferrymanders/openshift-acme
/vendor/github.com/openshift/api/security/v1/zz_generated.deepcopy.go
Go
go
23,960
permissive
// +build !ignore_autogenerated // This file was autogenerated by deepcopy-gen. Do not edit it manually! package v1 import ( core_v1 "k8s.io/api/core/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" reflect "reflect" unsafe "unsafe" ) func init() { SchemeBuilder.Re...
b8fcba1b7b72f2c6951e9859b32d0131ce709d8d
73a014b1e57b376b7640eab458eb82d0dc0367eb
Harzu/rebrain-eventbus-webinar
/rmq/internal/system/metrics/client.go
Go
go
1,257
no_license
package metrics import ( "net/http" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" ) type promMetric interface { // SetToPrometheus is expected to bulk-update specific metrics. SetToPrometheus() } type Client struct { registry *prometheus.Registry ...
2bf9bf04490de1c9a9aaa1ece68fdbbc2cae38a8
2fcb1497f216a11cbbbaab7ad0acb80a4a42ca44
arthaslll/kubernetes
/staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/podsecuritypolicy.go
Go
go
5,277
permissive
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
52dcc90df452bfa10c916cf456a9e1ecc2151b90
a249f7812937f870e1cc4967b14e127d14711a2b
airbnb/istio
/pkg/kube/util.go
Go
go
14,413
permissive
// Copyright Istio Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in wri...
63e3d232cb8a95d3f18b405a7aa20c20dbcdbe74
f3447c918878bd50920fc70746ad97e22ca3269b
roidelapluie/prometheus
/storage/remote/read_handler_test.go
Go
go
11,937
permissive
// Copyright 2021 The Prometheus 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...
bf59a14a8b91e6ec386a4e64f0a8ebcf1906e3cd
c5e5a77341f8d15fc32fd01ca732b165776ebdab
RunSheng-Li/crontab
/demo/etcd/get读取目录下所有kv.go
Go
go
855
no_license
package main import ( "context" "fmt" "github.com/coreos/etcd/clientv3" "time" ) func main() { var ( config clientv3.Config client *clientv3.Client err error kv clientv3.KV getResp *clientv3.GetResponse ) config = clientv3.Config{ Endpoints: []string{"111.229.213.40:2379"}, // 集群列表 ...
82373656ac93d37f559131145662c12d80e34acb
9fb99a4813375e39da7c0015716cf45b0b287975
frankenstyll/gobasic
/.history/pointers/Learn_20211019204325.go
Go
go
714
no_license
package pointers import "fmt" func Learn() { // ตัวแปร ที่เก็บ memory address ของตัวแปรอื่น x := 10 fmt.Println(x) fmt.Println(&x) //0xc00000c098 , & คือจะได้ memory address y := x //จะได้ค่า x =10 fmt.Println(y) fmt.Println(&y) //0xc00000c0e0 , จะได้ memory address ใหม่ fmt.Println("-------") p := &x ...
deea1ea4387a34a889ea3869df03b65f928ed540
bd54342acb8bbf6b639e163f3e158fea2d7a69b5
XiaodongLoong/runc
/libcontainer/cgroups/systemd/v1.go
Go
go
12,829
permissive
// +build linux package systemd import ( "errors" "io/ioutil" "math" "os" "path/filepath" "strings" "sync" systemdDbus "github.com/coreos/go-systemd/v22/dbus" "github.com/opencontainers/runc/libcontainer/cgroups" "github.com/opencontainers/runc/libcontainer/cgroups/fs" "github.com/opencontainers/runc/libc...
1dfbbe21c4ebae34e204581b4fbb8cee2439ad98
e7425e487c5d1ee25ae5b860207d8f20e0c1c615
ahl/noms
/go/merge/three_way_list.go
Go
go
4,747
permissive
// Copyright 2016 Attic Labs, Inc. All rights reserved. // Licensed under the Apache License, version 2.0: // http://www.apache.org/licenses/LICENSE-2.0 package merge import ( "fmt" "github.com/attic-labs/noms/go/types" ) func threeWayListMerge(a, b, parent types.List) (merged types.List, err error) { aSpliceCha...
197effda331d7129571dc237bc9eec4645c5aa53
d868ed3f7fa7f388ab2d3208cabdcdfe21f9bcc9
hybridgroup/gobot
/platforms/beaglebone/doc.go
Go
go
952
permissive
/* Package beaglebone provides the Gobot adaptor for the Beaglebone Black/Green, as well as a separate Adaptor for the PocketBeagle. Installing: Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: package main import ( "time" "gobot.io/x/gobot/v2" "g...
0a867fcd1dcd380c8cbec181ecadd40949657608
d110e2912c59e6282ba2e318ff2226fda4b33255
noblesse3539/golang_Study
/exercise/ch2/exer2_2/exer/main.go
Go
go
393
no_license
package main import ( "strconv" "os" "fmt" "exercise/ch2/exer2_2/lenconv" ) func main() { for _, arg := range os.Args[1:] { l, err := strconv.ParseFloat(arg, 64) if err != nil { fmt.Fprintf(os.Stderr, "exer2_2: %v\n", err) os.Exit(1) } ft := lenconv.Feet(l) m := lenconv.Meter(l) fmt.Printf("...
7f56478bd8d319624b963fe288dfdceaaaecb262
7fb5ea8f9cd57e62dd0cceac845de831e8ac9082
msingle/kubernetes
/pkg/apis/authorization/v1beta1/register.go
Go
go
2,024
permissive
/* Copyright 2015 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, ...
5327fad9dcaef53636280116c456f97593f2ca75
dd8120b0dded49f8d9c978f69a0dee38538b87bb
Kathent/mem-from-db
/manager/tree_test.go
Go
go
627
no_license
package manager import ( "fmt" "testing" ) type indexCo int func (i indexCo) Compare(comparator Comparator) int { if val, ok := comparator.(indexCo); ok { return int(i) - int(val) } return 1 } func TestBinarySearch(t *testing.T) { val := make([]Comparator, 4) val[0] = indexCo(1) val[1] = indexCo(2) val[...
dad866f986c027a0d1328be52315df69d5642692
4c40f27db3e3c576e13d145b2576829b9fecbad3
santiago-rodrig/charcount
/main.go
Go
go
1,293
no_license
package main import ( "bufio" "fmt" "io" "log" "os" "unicode" "unicode/utf8" ) func main() { reader := bufio.NewReader(os.Stdin) cm := make(map[rune]uint) bc := [utf8.UTFMax + 1]uint{} invalidsCount := 0 lettersCount := 0 digitsCount := 0 controlsCount := 0 whiteSpacesCount := 0 symbolsCount := 0 fo...
47a2e63a2fd09bd99f97b927ef7b8a124b81685e
5b2f47a139eb6e9553893b88bccb03302b19e14c
beeceej/go-introduction
/example-2/main.go
Go
go
566
no_license
package main import ( "fmt" "github.com/beeceej/go-introduction/example-2/coolpackage" ) func main() { // We can access the cool values but not the uncool values cool := coolpackage.CoolStruct{CoolValue: "A Cool Value"} fmt.Println(cool.CoolValue) // We can call methods on a struct like fmt.Println(cool.DoS...
c74531b65788526633224570fe53b5db171d79d9
48659b0e6b912e39f7288c2bc50f280b372778c5
Farzad-Jalali/terraform-provider-form3
/form3/resource_lhv_master_account_test.go
Go
go
5,602
permissive
package form3 import ( "fmt" "os" "testing" form3 "github.com/form3tech-oss/terraform-provider-form3/api" "github.com/form3tech-oss/terraform-provider-form3/client/associations" "github.com/go-openapi/strfmt" "github.com/google/uuid" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/has...
9f63b77d1333b19f761f4cf6d349a16dd6c31328
ae9eabd5b460843ea1c85e9286ecf5721fc324fd
deng-hb/km-go
/src/windows/mouse/mouse_hook.go
Go
go
957
no_license
package mouse import ( "fmt" "km/src/windows" "syscall" "unsafe" ) var hook uintptr func Hook(c chan<- windows.MouseEvent) { go func() { hook, _, _ = windows.SetWindowsHookExW.Call(uintptr(14), syscall.NewCallback(func(code int32, wParam uintptr, lParam uintptr) uintptr { if lParam != 0 { c <- windows...
a581f7bfb7012d8971d4da3040ac2315eb60ed88
25d6a382eae0622d84726cacb1480dc59fcdde90
haiyangma/golearn
/src/crawler/zhenai/parser/city.go
Go
go
796
no_license
package parser import ( "crawler/engine" "regexp" ) var ( profileRe = regexp.MustCompile(`href="(http://album.zhenai.com/u/[0-9]+)"[^>]*>([^<]+)</a>`) cityRe = regexp.MustCompile(`href="(http://www.zhenai.com/zhenghun/[^"]+)"`) ) func ParseCity(contents []byte, _ string) engine.ParseResult { matches := profi...
680a42504fe91ae9263f2e29683e86e4a2732f7f
508ed757c98a175f83b67263cd13a7472c048acc
ryanfakir/leetcode_go
/go/src/leetcode_334.go
Go
go
562
no_license
func increasingTriplet(nums []int) bool { if len(nums) < 3 {return false} var small, big = make([]int, len(nums)), make([]int, len(nums)) small[0] = nums[0] big[len(nums)-1] = nums[len(nums)-1] for i := 1; i < len(nums); i++ { small[i] = int(math.Min(float64(small[i-1]), float64(nums[i]))) ...
9e6b1dcfced3a41909b7cf77478723f0b6f55cea
2e980cdc9003e68da7155f2d5b7c60c371cc2f6f
qjpoo/pkg
/args/d1/main.go
Go
go
401
no_license
package main import ( "fmt" "os" ) func main() { // os.args args := os.Args for k, v := range args { fmt.Println(k, "===", v) /* go run main.go -c xxoo 1 2 3 0 === C:\Users\86137\AppData\Local\Temp\go-build981587782\b001\exe\main.exe 1 === -c 2 === xxoo 3 === 1 4 === 2 5 === 3 */ //var xx...
243ba5e11234329f2d5efa2313aa025b170a5149
0f51a9a6e4de83d1ef474af872f2e9f6b9a03624
Jonathan20021/FastTCP
/fastTcp.go
Go
go
2,495
no_license
/* Author: Jonathan Sandoval - https://medium.com/@jonathansandovalf */ package main import ( "context" // Done() struct{} || <- ctx.Done() "flag" "fmt" "log" "net" "strconv" "strings" "sync" "time" ) var ( host = flag.String("host", "127.0.0.1", "Host o dirección IP a escanear") ports = flag.Strin...
dca361eaeeb89007ddb9a8ba92a0269037281ca5
09ef66087b087b2bb3d3406727aedb13df81eb85
mattcui/bosh-agent
/integration/compile_package_test.go
Go
go
8,942
permissive
package integration_test import ( "fmt" "io/ioutil" "os" "os/exec" "path/filepath" "strings" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/cloudfoundry/bosh-agent/agent/action" boshcomp "github.com/cloudfoundry/bosh-agent/agent/compiler" "github.com/cloudfoundry/bosh-agent/agentclient"...
812f17e15159c65e2d018361e6523e4a7731b933
aecb51ecd30b739d656edd1fb8194a0681d999fe
jdrahos/traefik
/provider/kubernetes/kubernetes_test.go
Go
go
52,024
permissive
package kubernetes import ( "errors" "fmt" "reflect" "testing" "time" "github.com/containous/traefik/provider/label" "github.com/containous/traefik/tls" "github.com/containous/traefik/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" extensionsv1...
15e0eba8b468371901ddebbbaa8bccdd9e5c1246
a70093a380c21c825386e3e2aa9b8a3515510a3d
SavoBit/go-elasticsearch
/.doc/examples/src/docs-update-by-query_ea02de2dbe05091fcb0dac72c8ba5f83_test.go
Go
go
1,468
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, DO NOT EDIT package elasticsearch_test import ( "fmt" "os" "strings" "testing" "git...
82af4a75a4971a266f88159bfcbfcc682ab6963f
0a4aa612aae6cf414405d99dbb62bbd40f5328b8
neliorossine/curso_go
/web_get/main.go
Go
go
1,263
no_license
package main import ( "fmt" "io/ioutil" "net/http" "time" ) func main() { cliente := &http.Client{ Timeout: time.Second * 30, } resposta, err := cliente.Get("http://www.google.com.br") if err != nil { fmt.Println("[main] Erro ao abrir a página do Google Brasil. Erro: ", err.Error()) return } defer res...
afb163df1ba4cb9e80b51621fb2bbae7bbe15372
84df73e625e05f5579cf94d265ce6975665fa1b7
zhang0911shuai/leanMicro
/main.go
Go
go
514
no_license
package main import ( "context" "github.com/micro/go-micro/v2" pb "github.com/zhang0911shuai/leanMicro/proto/greeter" "log" ) type Greeter struct { } func (g *Greeter) Hello(ctx context.Context, req *pb.Request, rsp *pb.Response) error { rsp.Greeting = "hello " + req.Name return nil } func main() { service :...
c89780899bc125063cc9f7caac80d96c8063a431
f51620f019502077fc47c0f70915b80a81eb5f17
leogtzr/building-microservices-in-go
/chapter8/jwt/jwt.go
Go
go
1,360
permissive
package jwt import ( "crypto/rsa" "fmt" "log" "time" "github.com/SermoDigital/jose/crypto" "github.com/SermoDigital/jose/jws" "github.com/nicholasjackson/building-microservices-in-go/chapter8/utils" ) var rsaPrivate *rsa.PrivateKey var rsaPublic *rsa.PublicKey func init() { var err error rsaPrivate, err = ...
5b145b12f020b854bdb620350af1d5d74b6b02d2
9c8e8c43e55d1839da2f4ace66f899f3266168a2
LINBIT/drbd-flex-provision
/vendor/k8s.io/kubernetes/cmd/kubeadm/app/util/tokens.go
Go
go
4,635
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, ...
7c2d92f41b56e64256d4acb7bf07ac8779df28b8
16daf646e7dae48325a1973e3a82cc8f433e0932
leeduhem/leetcode-go
/src/p129/p129_test.go
Go
go
414
no_license
package p129 import ( "testing" ) type TreeNode struct { Val int Left *TreeNode Right *TreeNode } func testCase(in *TreeNode, want int, t *testing.T) { got := sumNumbers(in) if got != want { t.Errorf("Case %v: expected %v, got %v", in, want, got) } } func TestSumNumbers(t *testing.T) { in0 := &Tr...
45d943e411037aef89c57469b56e21728664b74e
7570b15683fc3b21d6c8a2f1720d0896ee702ba5
r3boot/collective-herder
/lib/utils/files.go
Go
go
2,285
no_license
package utils import ( "encoding/json" "errors" "gopkg.in/yaml.v2" "strconv" "strings" ) func ParseAsYaml(data []byte) (map[string]interface{}, error) { var ( content map[string]interface{} err error ) if data[0] == '{' { err = errors.New("data looks like JSON") return nil, err } err = yaml.Un...
c9d2d069b82b1eff5677aff9699966cdec322f1a
a47479880f582a0551e830e2eb45c1fd61ea26e6
microsoftgraph/msgraph-sdk-go
/users/item_mail_folders_item_child_folders_request_builder.go
Go
go
10,437
permissive
package users import ( "context" i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models" ia572726a95efa92ddd544552cd950653dc69102383...
313b26763e0bae1befa05d9cc88753c6338cd814
6358cd3ab970cf2c250607e2947735fef1f0fb96
Mirantis/magma
/feg/gateway/services/session_proxy/relay/mocks/CloudRegistry.go
Go
go
1,417
permissive
/* Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR...
64e554d03edea05a430af02ac2a82cf89848514b
99f8e15c548d4ba5aa99217b4c9445f2720bc444
7beCn/go-fly
/controller/visitor.go
Go
go
7,539
no_license
package controller import ( "encoding/json" "fmt" "github.com/gin-gonic/gin" "github.com/taoshihan1991/imaptool/config" "github.com/taoshihan1991/imaptool/models" "github.com/taoshihan1991/imaptool/tools" "github.com/taoshihan1991/imaptool/ws" "math/rand" "strconv" ) //func PostVisitor(c *gin.Context) { // n...
1695888ff6f562268aa413098d70d72ef666883b
70f56559de2a55fd97ec5c6289585c76d435c279
gastromatic/pipelines
/backend/src/apiserver/resource/resource_manager_util.go
Go
go
4,938
permissive
// Copyright 2018 The Kubeflow 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed ...
70db11de25ab22dd175d86667ae8dca321452e94
b7ec6954c20d8bc634a05fce6795586d76ab0826
zengnotes/kwan
/src/store/socket_log.go
Go
go
853
permissive
package store import ( "net" "time" ) type SocketHandler struct { c net.Conn protocol string addr string } func NewSocketHandler(protocol string, addr string) (*SocketHandler) { s := new(SocketHandler) s.protocol = protocol s.addr = addr return s } func (h *SocketHandler) Write(p string) ( err...
9b4d152c7cfb9fceb97892b050eecbdbaae787f0
6dd0f9cb502390d018433770de7cd724ddf67db0
mi4tin/GoTest
/index_test.go
Go
go
436
no_license
package main import ( "testing" "fmt" "strings" ) func BenchmarkT1(b *testing.B) { s:="117.139.247.210,117.139.247.212,117.139.247.212,117.139.247.212,117.139.247.212,117.139.247.212,117.139.247.212,117.139.247.212,117.139.247.212,117.139.247.215," for i:=0;i<b.N;i++{ strings.Index(s,"117.139.247.215,") } } ...
523f8d7889138d135bdd83aeb16c86001e7130f7
2660f3d8ecd42e768fd090924bf3d9226dcf73ec
opencost/opencost
/pkg/kubecost/summaryallocation_json.go
Go
go
4,356
permissive
package kubecost import ( "time" "github.com/opencost/opencost/pkg/util/formatutil" ) // SummaryAllocationResponse is a sanitized version of SummaryAllocation, which // formats fields and protects against issues like mashaling NaNs. type SummaryAllocationResponse struct { Name string `json:"n...
3c8a1adf2162b4dfeff9a49f68b81f304b17c687
b0efa3d7d270791d94e53247a6754dfc151cb72d
qgymje/go_src_code
/encoding/json/encode.go
Go
go
2,689
no_license
package json import ( "bytes" "reflect" "runtime" "strconv" "sync" ) // 如果一个对象实现了Marshaler接口(要有MarshalJSON)方法 // json.Marshal(v) 会调用其自定义的MarshalJSON来办出json encoding // 将一个map或者struct转为json格式的字节数组 func Marshal(v interface{}) ([]byte, error) { e := &encodeState{} // 初始化未必用newStruct方法 err := e.marshal(v) if err ...
cdb7bc5b7c6345bbde51ffd2ce8995d61fd4fc64
12d77289a59ce3de4e32d224aea208578559be72
bogdangomedia/gofeed
/atom/feed.go
Go
go
4,326
permissive
package atom import ( "encoding/json" "time" ext "github.com/bogdangomedia/gofeed/extensions" ) // Feed is an Atom Feed type Feed struct { Title string `json:"title,omitempty"` ID string `json:"id,omitempty"` Updated string `json:"updated,omitempty"` UpdatedPar...
d86046f61d39744f04730c3494f278ef74396006
f6a90bc957419fd54a325266311f8bde50a63fd2
schulzh/zrepl
/daemon/daemon.go
Go
go
5,826
permissive
package daemon import ( "context" "fmt" "os" "os/signal" "strings" "sync" "syscall" "time" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/zrepl/zrepl/daemon/logging/trace" "github.com/zrepl/zrepl/endpoint" "github.com/zrepl/zrepl/util/envconst" "github.com/zrepl/zr...
2c9aee57312ffd888df9e8c1d8b3a6d20393f1ee
efd0f31252acee200acfcaef8d07e1e3a1f7e559
youxitech/AppHub
/middleware.go
Go
go
961
no_license
package main import "github.com/kataras/iris" import "github.com/kataras/iris/context" // for 4xx, 5xx status code type Err struct { Msg string Code int StatusCode int } func errorHandlingMiddleware(ctx iris.Context) { defer func() { if err := recover(); err != nil { switch v := err.(type) { ...
b2da44a2873eda0672709687169d950e01f6f145
fb0605909f27fb99eb374bab3415447ec618daa3
liangyuanpeng/pulsarctl
/pkg/ctl/sinks/restart.go
Go
go
3,801
permissive
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
3fdc7898f3cf44f64255fdfdc4567779b91d56a7
0fbe1e37ea45d6e595bba4d015a9694a35efb0f1
funlake/beego-orm-adapter
/adapter_test.go
Go
go
5,537
permissive
// Copyright 2017 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...
4028863738f57a8a3973889769c114207f0e0320
b9e664ab69ac7cac146fa001a70eda365d2fbfbb
RokHoang/grabvn-golang-bootcamp
/assignments/week-04/todo/server/todo_service_test.go
Go
go
2,238
no_license
// +build integration contract package main import ( "context" "fmt" "log" "net" "net/http" "os" "path/filepath" "testing" "github.com/pact-foundation/pact-go/dsl" grpc_runtime "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/pact-foundation/pact-go/types" "github.com/xuanit/testing/todo/pb"...