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
d7fce92b048e41574b7268b36ad4db2e3329fc82
a37b71e488abde43a2e7e416e30f97963ce3b91a
suhaya3317/matilda
/backend/infrastructure/log.go
Go
go
366
no_license
package infrastructure import ( "context" "matilda/backend/interface/logging" "google.golang.org/appengine/log" ) type LogHandler struct { } func NewLogHandler() logging.LogHandler { logHandler := new(LogHandler) return logHandler } func (handler *LogHandler) LogInfo(ctx context.Context, format string, args i...
be3568adfcb5e811a47a80ec18fcf41d129b6a6c
b2889d357a30e40cd076a6b68135015eabe7c7ec
elmiko/oshinko-rest
/vendor/github.com/openshift/origin/pkg/cmd/cli/cmd/wrappers.go
Go
go
23,845
permissive
package cmd import ( "bufio" "fmt" "io" "os" "strings" "github.com/spf13/cobra" kcmd "k8s.io/kubernetes/pkg/kubectl/cmd" "k8s.io/kubernetes/pkg/kubectl/cmd/config" kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" kvalidation "k8s.io/kubernetes/pkg/util/validation" "github.com/openshift/origin/pkg/cmd/cli...
5db549618ff92dcb4b547a1e712bab40afbb4e4a
ccaf567168788eca748b855e93ddec35d10d6ed8
aliyun/alibabacloud-go-sdk
/rtc-white-board-20201214/client/client.go
Go
go
94,941
permissive
// This file is auto-generated, don't edit it. Thanks. /** * */ package client import ( openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client" endpointutil "github.com/alibabacloud-go/endpoint-util/service" openapiutil "github.com/alibabacloud-go/openapi-util/service" util "github.com/alibabacloud-go/t...
68447a8f5586cfe2496c69fa31c05017dfca0d6f
e0a66f90422e7293529da42a1d931981c5b636d6
BrownHu/FishApi
/src/gm/handler.go
Go
go
779
permissive
package gm import ( "encoding/json" "fmt" "net/http" "github.com/gorilla/mux" ) func Index(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "Welcome!") } func TodoIndex(w http.ResponseWriter, r *http.Request) { todos := Todos{ Todo{Name: "Write presentation"}, Todo{Name: "Host meetup"}, } if er...
236164dbedbb42709cc74bf58665f01464589002
90f74ae7d040460b1d9d727e6768d19f2af1e683
slobberchops/go-fuzidate
/fuzidate/fuzidate_test.go
Go
go
2,325
permissive
/* Copyright 2019 Rafe Kaplan 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 distrib...
24ddbb8eee487fe1b6a81d29ff33e603409ec897
1105534af41a7be678e8447fb261c2e51565a55a
gcrahay/ripugw
/inform/binary/buffer.go
Go
go
1,121
permissive
/* * Copyright (c) 2017 ZAP Québec * Copyright (c) 2020 Gaetan Crahay * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. */ package binary type Buffer []byte func NewBuffer(length uint) Buffer { return make(Buff...
be18103408ebe4a7bbf7fbd5aafe046882711673
444359f7b78092f16f273a38467ffdcf4876d555
devops-online/qed
/cmd/agent_auditor.go
Go
go
6,252
permissive
/* Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, n.A. 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...
598292917cb1676f19bc1a71b30d2829c7f60fb0
b2783d2563cf87597deef35d97d43f135d339fd0
kustomzone/block-train
/packages/model/transaction.go
Go
go
5,785
permissive
// MIT License // // Copyright (c) 2016 GenesisKernel // // 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, modif...
ffd75db5634ae6bcc932e754cdeb58158e1ef591
06dae2b108954debaaa81884b065c410d132909e
mihailselezniov/Deformation
/12/ml_knn7_3.go
Go
go
6,665
no_license
package main import ( "fmt" "math" "sync" "time" "bufio" "os" "strings" "strconv" ) func (s *State) hypot(p1 []float64, p2 []float64) float64{ return math.Max(math.Max(math.Max(p1[0]-p2[0], p1[1]-p2[1]), math.Max(p1[2]-p2[2], p1[3]-p2[3])), math.Max(math.Max(p1[4]-p2[4], p1[5]-p2[5...
8b9ed0a597df83f60953d5fee7feb1d476ee7b6b
4a83c799ea49cb8942e6f6be5364ede988c47366
PaulSonOfLars/rules_go
/go/tools/builders/cgo.go
Go
go
8,214
permissive
// Copyright 2017 The Bazel 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 appl...
7425437c77205a49cb5c600a873a854c0bc4a8e4
f8e135f50008818588beee32d39a825a33591412
NYULibraries/dlts-enm
/db/postgres/models/djangocontenttype.xo.go
Go
go
4,649
permissive
// Package models contains the types for schema 'public'. package models // GENERATED BY XO. DO NOT EDIT. import ( "errors" ) // DjangoContentType represents a row from 'public.django_content_type'. type DjangoContentType struct { ID int `json:"id"` // id AppLabel string `json:"app_label"` // app_...
0eeacac94c2eaf6c568487628ca31aafb2f2f9bc
aac9bf37d31d814c9550185e0e55ab3b58068043
jorgelbg/grafana
/pkg/tsdb/cloudwatch/routes/accounts_test.go
Go
go
4,336
permissive
package routes import ( "context" "fmt" "net/http" "net/http/httptest" "testing" "github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/mocks" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/models" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/models/resources" ...
8f71cd0fec57c0a2326389cbc19ca242dc403da8
e098b78976e9ea0a366323f788ffc620e7cc5b09
gopalanand333/chisel
/main.go
Go
go
4,965
permissive
package main import ( "flag" "fmt" "log" "os" "github.com/morikat/chisel/client" "github.com/morikat/chisel/server" ) var VERSION string = "0.0.0-src" //set via ldflags var help = ` Usage: chisel [command] [--help] Version: ` + VERSION + ` Commands: server - runs chisel in server mode client - runs...
9816b2ba4f389b136c8de9c9fe05e196122fcb0f
fb5f87d34f566a1ed7980b085fb20a2e0d1be524
julwil/bazo-miner
/protocol/utils.go
Go
go
1,383
permissive
package protocol import ( "fmt" "math" "time" rand1 "crypto/rand" rand2 "math/rand" "golang.org/x/crypto/sha3" ) //Serializes the input and returns the SHA3 hash function applied on ths input func SerializeHashContent(data interface{}) (hash [32]byte) { return sha3.Sum256([]byte(fmt.Sprintf("%v", data))) } ...
eaaf3c4c33ea4f44db96a6e520b6020c13fec694
774e161a9f2e2c27621d1e025ccce25eb53e6556
kwkoo/credscontroller
/credscontroller/vendor/github.com/hashicorp/vault/vendor/github.com/oracle/oci-go-sdk/objectstorage/objectstorage_client.go
Go
go
61,041
permissive
// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // Object Storage Service API // // Common set of Object Storage and Archive Storage APIs for managing buckets, objects, and related resources. // package objectstorage import ( "context" "fmt" "g...
5f3a919139cd4fd6492067d6ff61c9ef29c254a5
87b9c3106fbe6d87eb9ac592702dfd24267ac537
storey247/pachyderm
/src/server/cmd/pachctl/shell/completions.go
Go
go
6,264
permissive
package shell import ( "fmt" "io/ioutil" "log" "path" "path/filepath" "strings" "sync" "github.com/pachyderm/pachyderm/src/client" "github.com/pachyderm/pachyderm/src/client/pfs" "github.com/pachyderm/pachyderm/src/client/pps" "github.com/pachyderm/pachyderm/src/server/pkg/cmdutil" "github.com/pachyderm/p...
121ef8d3aa16277a59e934b7c8ea305fe38844e4
bd98a7c19464e20a70560508926e31a643d31b4c
yudaprama/iso20022
/model/Intermediary12.go
Go
go
2,594
permissive
package model // Party that provides services relating to financial products to investors, eg, advice on products and placement of orders for the investment fund. type Intermediary12 struct { // Unique and unambiguous identifier for an organisation that is allocated by an institution, eg, Dun & Bradstreet Identifica...
dd763114706103282f667c2066a131ea32555ff0
87873418de73fc659f2db61e39b980bb2d6b544d
niehengyang/go-gin-api
/model/baseModel.go
Go
go
2,370
no_license
package model import ( "database/sql/driver" "fmt" "github.com/jinzhu/gorm" "time" ) // 1. 创建 time.Time 类型的副本 XTime; type XTime struct { time.Time } const TimeFormat = "2006-01-02 15:04:05" func (t *XTime) UnmarshalJSON(data []byte) error { if string(data) == "null" { return nil } now, err := time.ParseIn...
800537be953d81bd23ff6a51f181b5f73f3a490e
0a64a24d92b9fa879b80d478e1b31487f6eff92c
ygunna/Microservices
/microservice/src/vendor/github.com/hashicorp/vault/builtin/credential/ldap/path_login.go
Go
go
3,250
permissive
package ldap import ( "fmt" "sort" "github.com/hashicorp/vault/helper/policyutil" "github.com/hashicorp/vault/logical" "github.com/hashicorp/vault/logical/framework" ) func pathLogin(b *backend) *framework.Path { return &framework.Path{ Pattern: `login/(?P<username>.+)`, Fields: map[string]*framework.Field...
fa7495aaa33e4de4c8a83e7d6ed2116d04069d75
e028a39fbc78af45e057d3517db8f56387fb87ec
radanalyticsio/oshinko-cli
/vendor/github.com/openshift/origin/pkg/oauth/generated/internalclientset/typed/oauth/internalversion/fake/fake_oauthaccesstoken.go
Go
go
4,263
permissive
package fake import ( oauth "github.com/openshift/origin/pkg/oauth/apis/oauth" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/t...
0d94017b523e0a8ad7356cb7c93bdfd7c186b859
83770c0403273b90a971bf389ff8249a7216d991
tsholmes/leetcode-go
/05/46-remove-boxes/main.go
Go
go
912
no_license
package main import "fmt" func main() { fmt.Println(removeBoxes([]int{1, 3, 2, 2, 2, 3, 4, 3, 1})) } func removeBoxes(boxes []int) int { if len(boxes) == 0 { return 0 } var bs [][2]int boxes = append(boxes, -1) last := boxes[0] count := 0 for _, b := range boxes { if b == last { count++ } else { ...
daa3bc6f23b340322c51cd9b31ab03850e3e9cbf
4edd9a3516d962b15c3c94773a2b0aa5658f9116
benjaminhuanghuang/ben-leetcode
/0318_Maximum_Product_of_Word_Lengths/solution_test.go
Go
go
366
no_license
// https://leetcode.com/problems/maximum-product-of-word-lengths package leetcode0318 import ( "testing" "github.com/stretchr/testify/assert" ) func Test_OK(t *testing.T) { testCases := []struct { input []int ans []int }{ { []int{2, 7, 11, 15}, []int{2, 7, 11, 15}, }, } for _, tc := range testC...
0f5bbaae8b8c00d472aa31beeb425a75f3b2ba51
addf155619df3a9ffdbfe0ccff6dc0f497135563
jp-gorman/go-lambda-invoke
/golambdainvoke/invoke_test.go
Go
go
498
permissive
package golambdainvoke import ( "encoding/json" "log" "testing" ) // relies on the toupperlambda being available and listening on port 8001 func TestSuccessIT(t *testing.T) { input := "hello world" expected := "HELLO WORLD" response, err := Run(8001, input) if err != nil { log.Println(err) t.FailNow() } ...
3cec054265701110cd6736e942de6798d3f8752e
85f44cb082c9041d2177a398acbdf2c52f96dcd6
netsi/gosoline
/pkg/kvstore/ddb.go
Go
go
6,951
no_license
package kvstore import ( "context" "fmt" "sort" "github.com/justtrackio/gosoline/pkg/cfg" "github.com/justtrackio/gosoline/pkg/ddb" "github.com/justtrackio/gosoline/pkg/log" "github.com/justtrackio/gosoline/pkg/mdl" "github.com/justtrackio/gosoline/pkg/refl" ) type DdbItem struct { Key string `json:"key" ...
a066361e2c8099018aa96d7d3a9dcf7c9600a4ed
e0497b0b6f52b1f15d5af95bb88cda926d03fb8f
rai-project/panicparse
/internal/ui_test.go
Go
go
5,794
permissive
// Copyright 2016 Marc-Antoine Ruel. All rights reserved. // Use of this source code is governed under the Apache License, Version 2.0 // that can be found in the LICENSE file. package panicparse import ( "flag" "io/ioutil" "log" "os" "testing" "github.com/maruel/panicparse/stack" ) var testPalette = &Palette...
ea625ce524bf82a64a946f468b10e7245ecb5899
561b6d2d6c9b227b33f6e5eae5e79c2cbce44452
president-underwood/Mapreduce
/main/lockc.go
Go
go
494
no_license
package main import "lockservice" import "os" import "fmt" func usage() { fmt.Printf("Usage: lockc -l|-u primaryport backupport lockname\n") os.Exit(1) } func main() { if len(os.Args) == 5 { ck := lockservice.MakeClerk(os.Args[2], os.Args[3]) var ok bool if os.Args[1] == "-l" { ok = ck.Lo...
c024bd997bb9eaf9b5979752cd95cdfab35f3081
dd8f82226420c246451d431fc7c5217dd19b4213
aws/amazon-ecs-agent
/agent/engine/dockerstate/json_test.go
Go
go
10,923
permissive
//go:build unit // +build unit // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). You may // not use this file except in compliance with the License. A copy of the // License is located at // // http://aws.amazon.com/apache2.0/ // ...
c18707a2cf00f2fdfa204e6277d95f20f43abf30
726edbdaddf41f2acfa0f3c8a7fb0fe4f816d5cf
bdshadow/kubernetes-client-android
/kubernetes-model/vendor/github.com/golang/protobuf/ptypes/duration.go
Go
go
4,481
permissive
/** * Copyright (C) 2015 Red Hat, 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...
50231e53585ad78a912e60c382cdad2ec19bbe30
6618732ec9a0fc02e5fc8e7d9d031865b4124d44
xiaomuqiao/runv
/containerd/api/grpc/server/server.go
Go
go
5,497
permissive
package server import ( "encoding/json" "errors" "fmt" "io/ioutil" "path/filepath" "time" "github.com/cloudfoundry/gosigar" "github.com/docker/containerd/api/grpc/types" "github.com/golang/glog" "github.com/hyperhq/runv/supervisor" "github.com/opencontainers/runtime-spec/specs-go" "golang.org/x/net/contex...
5b1e06e93630c7463849e371af4914777d2b9d0f
c1b80cbee32c77f2d76232662921e4db983ec833
osref/golib
/cache/doc.go
Go
go
538
permissive
// Tideland Go Library - Cache // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // // All rights reserved. Use of this source code is governed // by the new BSD license. // Package cache lazily loads information on demand and caches them. // The data inside a cache has to implement the Cach...
85cc604a1fe5798bfb6dce95c4028903e65af96d
722a7e0c6352caa03bb6ba75f213de79eccba9e6
mkch/rw
/util/icon/icon.go
Go
go
3,664
no_license
package icon // https://msdn.microsoft.com/en-us/library/ms997538.aspx // https://en.wikipedia.org/wiki/ICO_(file_format) import ( "fmt" "io" "io/ioutil" "unsafe" ) type IconDirHeader [6]byte // Reserved must be 0. func (hdr *IconDirHeader) Reserved() *uint16 { return (*uint16)(unsafe.Pointer(&hdr[0])) } // 1...
5fc007b1f1d20bb24ea550e7112f837277fcdc1c
d0cc38d8b86424df783b9be2ee05709e66377d54
ep8/pachyderm
/src/client/portforwarder.go
Go
go
5,296
permissive
package client import ( "fmt" "io" "math/rand" "net/http" "sync" "path" "os" "github.com/facebookgo/pidfile" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/portforward" "k8s.io/client-go/transport/spdy" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" _ "k8s.io/client-go/plugin/pkg/cli...
7983e083e494a4a06acd3c0354de1f206e0be9d0
ceac058dedf9a6c82ec2c0aa2cac7f8413190e9f
Junyong-Suh/review-wiki-go
/handlers/view_handler.go
Go
go
405
permissive
package handlers import ( "net/http" u "github.com/Junyong-Suh/review-wiki-go/utils" ) func ViewHandler(w http.ResponseWriter, r *http.Request) { title, err := u.GetTitle(w, r) if err != nil { return } p, err := u.LoadPage(title) if err != nil { http.Redirect(w, r, "/edit/...
98263b079accfa07bf9f847d5bafa20cf88c23a3
75066b774683c84d5889b56f4bbb59470215a4c3
the-redback/k8s-apiserver-by-apiserver-builder
/pkg/client/informers_generated/internalversion/internalinterfaces/factory_interfaces.go
Go
go
1,318
no_license
/* 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, ...
1339964d970f1b4e1b59605a02a904e26b66c0e5
afe5b0ea36bf397b275c7ebfd81b6a6fcfde8d14
zlcting/golangstuday
/src/Fibonacci.go
Go
go
242
no_license
package main import "fmt" func fibonacci() func() int { sum1 := 0 sum2 := 1 return func() int { out := sum1 + sum2 sum1 = sum2 sum2 = out return out } } func main() { f := fibonacci() fmt.Println(f()) fmt.Println(f()) }
a52c75e729d9e4665ff6ff898be4d12fff825008
96b52d19af24565ea3bb2f285b5dccd26104498f
openshift/test-infra
/prow/pod-utils/decorate/podspec_test.go
Go
go
60,746
permissive
/* Copyright 2018 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, ...
fe4e553c15f23ea05d4d0f2a4e9c8ca0493fcdf9
979c0eed4f13aeffd3407e0139369ec3175f8d07
kindai-csg/UMR
/server/interfaces/controllers/setting_controller.go
Go
go
1,042
no_license
package controllers import ( "github.com/kindaidensan/UMR/usecase" "github.com/kindaidensan/UMR/domain" "github.com/kindaidensan/UMR/interfaces/database" "errors" ) type SettingController struct { interactor usecase.SettingInteractor } func NewSettingController(redisHandler database.RedisHandler) *SettingContro...
c8e48aa741b2c5388a31de409830d9169abe0935
c03dd951fabf62d8fe498cacce1e4c7af2095105
Rjected/lit
/shortaddr/shortadr.go
Go
go
1,748
permissive
package shortadr import ( "bytes" "encoding/binary" "github.com/Rjected/lit/crypto/fastsha256" ) /* initial short address code. You can spin up a bunch of worker goroutines (1 per core?) and give them different IDs. They will try sequential nonces, and report back when they find nonces that have more work than...
4f0910b7ae2e92ca27efcaf999ef9984f773d1a1
5d42a00149b2084df707effe9aecf057cc988838
cryplio/rest-api
/vendor/github.com/pressly/goose/version.go
Go
go
276
permissive
package goose import ( "database/sql" "fmt" ) // Version prints the current version of the database. func Version(db *sql.DB, dir string) error { current, err := GetDBVersion(db) if err != nil { return err } fmt.Printf("goose: version %v\n", current) return nil }
b1e729aa0731cd1f1d66e6b47b0ec3767af62489
1d15088c4b931b9814fc82d815a780cd52f765f1
FastSchnell/everdale-wiki
/pkg/nation_buildings/nation_buildings.go
Go
go
2,302
permissive
package nation_buildings import ( "encoding/csv" "everdale-wiki/pkg/config" "everdale-wiki/pkg/gin_util" "fmt" "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" "io" "os" ) func GetNationBuildings(ctx *gin.Context) { req := new(GetNationBuildingsRequest) err := ctx.ShouldBindWith(req, binding.JSON) if...
06fbdc336a014248921fb56dba3100b984a852af
1d0c985e2192b81382347761461751049b229d7f
hanqiuzh/hypershift
/control-plane-operator/controllers/hostedcontrolplane/oapi/oauth_deployment.go
Go
go
7,144
permissive
package oapi import ( "fmt" "path" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/utils/pointer" "github.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane/config" "github.com/ope...
7a3303b1192b01ef4f521da46c34874212cc8701
5e8790d0821648b6a4990d55539f8cbbc3241e18
stamblerre/go-perun
/backend/sim/channel/backend.go
Go
go
2,630
permissive
// Copyright 2019 - See NOTICE file for copyright holders. // // 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 ap...
9e37a6e6f3f3c78186d86d8443d71703408a497b
ff7a12cab796c430c83a6fb82a07fd5b0fe8f61f
Leeviiii/MyJVM
/src/jvmgo/instructions/control/tableswitch.go
Go
go
1,003
no_license
package control import ( "jvmgo/instructions/base" "jvmgo/rtda" ) /* tableswitch <0-3 byte pad> defaultbyte1 defaultbyte2 defaultbyte3 defaultbyte4 lowbyte1 lowbyte2 lowbyte3 lowbyte4 highbyte1 highbyte2 highbyte3 highbyte4 jump offsets... */ // Access jump table by index and jump type TABLE_SWITCH struct { defaul...
af70d836351a8d708d493873d4f96e282d42074c
c96c6b3df26d2e7ce55dbc6894e8c13f1ff72441
shaladdle/goaaw
/sync/remote/old/client/client-api.go
Go
go
777
no_license
package client import ( "github.com/shaladdle/goaaw/sync/remote/common" ) func (cli *client) Get(id string) error { msg := dGetMsg{ id: id, err: make(chan error), } cli.msg <- msg return <-msg.err } func (cli *client) Put(id string) error { msg := dPutMsg{ id: id, err: make(chan error), } c...
c38dceea731107bee3196cf66f57f9b0ee73af41
05309f8ab306d37878b4d367cb832f6c9226f540
fengfanchao/fabric-sample
/rbft/node/state.go
Go
go
336
no_license
package node import ( "log" ) type State int const ( STATESENDORDER State = iota STATERECVORDER STATESENDREQUEST ) func (n *Node) stateThread() { log.Printf("[State] start the state thread") for { switch n.state { case STATESENDORDER: n.broadCastComMessage() n.state = STATERECVORDER case STATERECV...
3438099d815b363c15a8ae1fce6c0af1954740b5
07b5648ebcb53210804356ae7ba8c53a6a19c193
ralubis/lxd
/lxd-agent/network.go
Go
go
1,538
permissive
package main import ( "crypto/tls" "net" "path/filepath" "sync" "time" "github.com/lxc/lxd/lxd/util" "github.com/lxc/lxd/shared" ) // A variation of the standard tls.Listener that supports atomically swapping // the underlying TLS configuration. Requests served before the swap will // continue using the old c...
615a2425175becd3fc1f4262d6036be40dbd4791
a2d643e6c0c500e5f611ff3b247f7f70da7ad92e
olivere/rabbitmq
/exchanges.go
Go
go
1,245
permissive
package rabbitmq import ( "encoding/json" "net/url" ) func (c *Client) Exchanges() *ExchangesService { return &ExchangesService{c: c} } type ExchangesService struct { c *Client } func (svc *ExchangesService) Do() ([]*ExchangeInfo, error) { params := make(url.Values) res, err := svc.c.Execute("GET", "/api/exc...
07fab4c54de5454fd03f4df879d03044d3a9e2c3
ec53a8aeb0094c18ef93c924275c2d1d75fe035d
oVirt/v2v-conversion-host
/kubevirt-vmware/vendor/github.com/vmware/govmomi/govc/disk/ls.go
Go
go
3,445
permissive
/* Copyright (c) 2018 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed t...
c9a15112684017458afa02dad6791ac6e76c906d
b423ceb7db66ebe20dec107d947ea38277a82077
saitho/git-file-webserver
/git/client.go
Go
go
957
no_license
package git import ( "fmt" "strings" "github.com/saitho/static-git-file-server/config" ) type ClientInterface interface { GetRepositoryBySlug(slug string) *config.RepoConfig SelectRepository(slug string) error GetTags(repo *config.RepoConfig) []GitTag GetCurrentRepo() *config.RepoConfig } type Client struct ...
8d7e7fa4e6361c02f0dfaa97618e6533cd02a7fe
07a51fef730df78ba6d6bfa65ddc111506370ab4
jcockbain/advent-of-code-2020
/go/day2/main.go
Go
go
1,223
no_license
package main import ( input "aoc2020/inpututils" "fmt" "regexp" "strings" "strconv" ) func main(){ fmt.Println("--- Part One ---") fmt.Println(Part1("input.txt")) fmt.Println("--- Part Two ---") fmt.Println(Part2("input.txt")) } func Part1(filename string) int { lines := input.ReadLines(filename) val...
4db582ef6633c6f3b34ab7606d8d346e2f583ef2
ec125cfad6a376e7cb31054157106e4d424e2516
rafaelescrich/black-scholes
/bsm.go
Go
go
2,377
no_license
package bsm import ( "math" "time" "github.com/maurodelazeri/gaussian-distribution" ) // risk free rate var ( rate = 0.0135 ) // Option contract type Option struct { //current(spot) price I float64 //strike price S float64 // implited volatility V float64 //expiration E time.Time // time till expirati...
d36a017ac9bc6169622088dbdef02f5719f658f2
3fc91756ffbe678704efd1c059a55e4487e8e287
sachaos/todoist
/main.go
Go
go
8,276
permissive
package main import ( "errors" "fmt" "os" "runtime" "encoding/csv" "encoding/json" "io/ioutil" "path/filepath" "github.com/fatih/color" "github.com/rkoesters/xdg/basedir" "github.com/sachaos/todoist/lib" "github.com/spf13/viper" "github.com/urfave/cli/v2" ) var ( homePath, _ = os.UserHomeDir()...
ba15ea9cd4ffd794ab3bf690e209083f7ef61612
041f72adea2c3989d8d191271df4cf0b1921bd57
hwhaocool/peas
/peas.go
Go
go
2,092
permissive
package main import ( "fmt" "log" "sync" "os" "syscall" "os/signal" "sync/atomic" "github.com/hwhaocool/peas/agent" "github.com/hwhaocool/peas/server" ) var ( kServerAddress = "localhost:14444" serverConnected int32 stopFlag int32 ) func getEnv(name string) (string, bool) { value := os.Geten...
9fc0d1b4aa4dc49fafcdd15d96e7b8b21aceae75
fbb44e320e50d07a739f01e6d05ac18ff6a02f5c
openapi-env-test/azure-sdk-for-go
/sdk/azidentity/logging.go
Go
go
1,046
permissive
//go:build go1.18 // +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package azidentity import ( "fmt" "strings" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/...
c90aa3a54f639f5a0a8c821b289c2ff977d7bf52
a045dcf2c0ff02f5344da5fd4308de06e4194a44
sinoprobe/chain33
/types/fork.go
Go
go
7,266
permissive
// Copyright Fuzamei Corp. 2018 All Rights Reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package types import ( "strings" ) /* MaxHeight 出于forks 过程安全的考虑,比如代码更新,出现了新的fork,旧的链只要不明确指定 fork的高度,那么默认fork高度为 MaxHeight 也就是新的代码默认不会被启用,知道使用的人明确指定了fork的高度 */ ...
beedaf3cb79aa4cda6d1bc3a3b319a1f0724c884
5f4787cdc2f31e1706ca4af90315b6e2f2d56695
beoran/ffidll
/test/test-ffidll.go
Go
go
727
permissive
package main // import "testing" import dll "ffidll" import . "fmt" import "time" func TestLoad() { lib := dll.Open("../test/hellolib.so") Println(dll.Error()) fun := lib.Sym("hello") _ = fun Println(dll.Error()) Println("CallVoid") // fun.CallVoid() // Doesn't work. We need libffi Println("Prepare") ...
cc14d950e9fc3cc110efe060cd50246c899fc11b
6e6bfa55810372503f06a1ad520b3b500698d650
kutear/wails
/app.go
Go
go
4,324
permissive
package wails import ( "os" "runtime" "syscall" "github.com/syossan27/tebata" "github.com/wailsapp/wails/cmd" "github.com/wailsapp/wails/lib/binding" "github.com/wailsapp/wails/lib/event" "github.com/wailsapp/wails/lib/interfaces" "github.com/wailsapp/wails/lib/ipc" "github.com/wailsapp/wails/lib/logger" "...
1f0a1f9d9c8b6a971e5cff2ea85a899627f32186
c8b86f4c06f2440e8756903e4bcf9b827894e82c
Taekyung2/Go-study
/src/section4/init1.go
Go
go
258
no_license
package main import ( "fmt" ) func init() { fmt.Println("Init method start!") } func main() { //init : 패키지 로드 시에 가장 먼저 호출 //가장 먼저 초기화되는 작업 작성 시 유용하다 fmt.Println("Main method start!") }
06826371fd8847cceda812cf13eec0ab1eee35ef
f8c94d2b85992341609e706809e1e35d74819882
albertchon/cosmos-sdk
/x/distribution/keeper/alias_functions.go
Go
go
728
permissive
package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" ) // get outstanding rewards func (k *Keeper) GetValidatorOutstandingRewardsCoins(ctx sdk.Context, val sdk.ValAddress) sdk.DecCoins { return k....
9d8182c4c1571d1974bc45c786381a6a8f4f0d9c
e29a3746bb5e6bb7f2847fe0c0623bdee4e84f3c
PaulRaUnite/uni-db-index-task
/vendor/gitlab.com/distributed_lab/urlval/errors.go
Go
go
1,200
no_license
package urlval import ( "fmt" "strings" ) // errBadRequest is an error type that can be rendered to client application // using ape package (https://gitlab.com/distributed_lab/ape). // Mostly useful when have a need to render multiple errors: // // errs := errBadRequest{} // for cond { // if cond { // errs["k...
128aa56378f415985094cb13cde0b0b880ee0e0c
f5fbf94ec930cddd665ae0504c5c1e48bdbe026c
paydex-core/paydex-go
/services/compliance/internal/handlers/request_handler_auth.go
Go
go
14,254
permissive
package handlers import ( "bytes" "crypto/sha256" "encoding/base64" "encoding/hex" "encoding/json" "io/ioutil" "net/http" "net/url" "strings" "time" log "github.com/sirupsen/logrus" baseAmount "github.com/paydex-core/paydex-go/amount" "github.com/paydex-core/paydex-go/protocols/compliance" "github.com/...
b1e19bc22910666df1a7605c6e48427c60ae5308
3f0de6e556f239aa323d78fb028e95b58978bbd3
allanhung/cassandra-k8s-operator
/pkg/controller/cassandracluster/generator_test.go
Go
go
4,241
permissive
// Copyright 2019 Orange // // 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,...
b1f2e2e27035d8b12b6de2b20400c8c74f8ad063
0ca5f1bf280cff66c1573b400cb054c1e8983e5a
wlan0/minio
/cmd/data-update-tracker.go
Go
go
17,057
permissive
// Copyright (c) 2015-2021 MinIO, Inc. // // This file is part of MinIO Object Storage stack // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (...
4004d57977bc214d40f1df0b9d5f7b6b9a940b2f
748c2f0f84ace7f6a8bb9f930b85c69db0fb4ea2
flytofly/justledger
/peer/node/start.go
Go
go
27,249
permissive
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package node import ( "fmt" "net" "net/http" "os" "os/signal" "syscall" "time" "github.com/golang/protobuf/proto" "justledger/common/cauthdsl" ccdef "justledger/common/chaincode" "justledger/common/crypto/tlsgen" "justled...
416e1d1d130c0b7cb8620901f42d2f7fdadac18c
cc13de0e18efedbe11e99f2e7906c0fde94b3803
xumc/datadt
/mysqlbinlog.go
Go
go
1,644
no_license
package main import ( "fmt" "github.com/kr/pretty" "github.com/siddontang/go-mysql/canal" "github.com/xumc/datadt/display" "strconv" ) type MysqlBinlogMonitor struct { canal.DummyEventHandler outputer display.Outputer } func(binlog *MysqlBinlogMonitor) Monitor() { cfg := canal.NewDefaultConfig() cfg.Addr = ...
24180dbe07105c7af4530ed759b15b759aebcb4e
fdb405aaa56c400e945e2d91e116ec67fa6e4030
AMJIYU/kscan
/lib/hydra/ftp/ftp.go
Go
go
375
no_license
package ftp import ( "fmt" "github.com/jlaffaye/ftp" "time" ) func Check(Host, Username, Password string, Port int) (bool, error) { conn, err := ftp.DialTimeout(fmt.Sprintf("%s:%d", Host, Port), 5*time.Second) if err != nil { return false, err } err = conn.Login(Username, Password) if err != nil { return ...
f1271e32cb761b1dda015982cb9deaef15e57291
226e66ba34f4ff1a85e93068d6e51652ce6cebb7
krebernisak/libocr
/networking/dht-router/dht.go
Go
go
3,055
no_license
package dhtrouter import ( "context" "fmt" "sync" "github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/peer" dht "github.com/libp2p/go-libp2p-kad-dht" "github.com/smartcontractkit/libocr/offchainreporting/types" "github.com/pkg/errors" ) // This code is borrowed from the go-ipfs bootstr...
7008e947e8ff5fd852e0278fdedafde1b92bb25d
4dc2af3827ca496b6e835a37faa5e24a48368076
mark-rushakoff/platform
/query/functions/max_test.go
Go
go
3,542
permissive
package functions_test import ( "testing" "github.com/influxdata/platform/query" "github.com/influxdata/platform/query/execute" "github.com/influxdata/platform/query/execute/executetest" "github.com/influxdata/platform/query/functions" "github.com/influxdata/platform/query/querytest" ) func TestMaxOperation_Ma...
d37e07d7637a84ea312ad6c7e266e23641d50f5c
c43bece3042d0836fbe2cd9a859d5459930402ca
manhtai/golang-mongodb-chat
/main.go
Go
go
1,283
permissive
package main import ( "log" "net/http" "os" "github.com/gorilla/mux" "github.com/manhtai/golang-mongodb-chat/controllers" "github.com/manhtai/golang-mongodb-chat/models" ) func main() { port := os.Getenv("PORT") if port == "" { panic("PORT must be set!") } port = ":" + port // Start 2 channels to chat...
08041245a43b803419f883fe0aab367bd1df9146
92552c32c5f34c1dcaf1aec03a26b0b881a2457f
maxthomas/hardhat
/cmd/hardhat/app/version.go
Go
go
369
permissive
package app import ( "fmt" "github.com/spf13/cobra" ) func init() { RootCmd.AddCommand(versionCmd) } var versionCmd = &cobra.Command{ Use: "version", Short: "Print the version number of Hardhat", Long: `All software has versions. This is Hardhat's`, Run: func(cmd *cobra.Command, args []string) { fmt.Pri...
d84d8bfd27150a842837b27470cd44a63790b966
f2d087e369770846606926468679f41674d71f9d
jsonkey/vitess
/go/vt/tabletserver/tx_engine.go
Go
go
8,598
permissive
// Copyright 2016, Google Inc. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package tabletserver import ( "sync" "time" log "github.com/golang/glog" "golang.org/x/net/context" "github.com/youtube/vitess/go/timer" "github.com/youtu...
fd9c19dde85c2c531b02a595210dae8dca4fa65b
0e3457d2e476be10d2b62c12061ca8037d1d1159
acoshift/go-firebase-admin
/vendor/cloud.google.com/go/trace/apiv2/trace_client.go
Go
go
5,382
permissive
// Copyright 2017, Google LLC 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 applicable...
3f31b18fbc546e5b21d8281d705daf60e85f96db
c83a2610e72f92a2e5a4e8543af271419d082a84
dav1x/wavefront-kubernetes-collector
/plugins/discovery/manager.go
Go
go
3,163
permissive
package discovery import ( "time" gm "github.com/rcrowley/go-metrics" log "github.com/sirupsen/logrus" "github.com/wavefronthq/wavefront-kubernetes-collector/internal/configuration" "github.com/wavefronthq/wavefront-kubernetes-collector/internal/discovery" "github.com/wavefronthq/wavefront-kubernetes-collector...
71df22dd86d0e0b78f78e5eb4b79aa57534e0d6b
bb45c6bb824f024fef88c533373dda642f8ab794
puneetsingh166/tm-load-test-test
/x/feegrant/keeper/genesis_test.go
Go
go
2,996
permissive
package keeper_test import ( "testing" "github.com/stretchr/testify/suite" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" codectypes "github.com/puneetsingh166/tm-load-test/codec/types" "github.com/puneetsingh166/tm-load-test/crypto/keys/secp256k1" "github.com/puneetsingh166/tm-load-test/sim...
9e7abf302049b71f5fac93d813fc2fe3e2229876
6e3fcc07abad3ec5e102fd6e178a95092326a07d
gditsec/youtube
/video.go
Go
go
4,268
permissive
package youtube import ( "encoding/json" "errors" "fmt" "net/url" "regexp" "strconv" "time" ) type Video struct { ID string Title string Description string Author string ViewCount string PublishDate string UploadDate string Duration time.Duratio...
6013fcc4e2478582610be6e7801374f893eec8ff
cefade442e71dc541b802517e97e2aae14ef099b
nnzhaocs/distributioncache
/registry/registry.go
Go
go
10,023
permissive
package registry import ( "crypto/tls" "crypto/x509" "fmt" "io/ioutil" "net/http" "os" "time" "rsc.io/letsencrypt" log "github.com/Sirupsen/logrus" logstash "github.com/bshuster-repo/logrus-logstash-hook" "github.com/bugsnag/bugsnag-go" "github.com/docker/distribution/configuration" "github.com/docker/d...
36fe44a0be20453d6fc3b7532add9baa173e5b5d
5931825c24ae4c59c0b62c09872bbb8880bd5d73
prologic/LadyLua
/cmd/standalone/main.go
Go
go
971
permissive
package main import ( "embed" "github.com/tongson/LadyLua" "github.com/tongson/gl" "github.com/yuin/gopher-lua" "os" "runtime" ) //go:embed src/* var mainSrc embed.FS func main() { runtime.MemProfileRate = 0 defer gl.RecoverPanic() L := lua.NewState() defer L.Close() ll.LoadGlobalGo(L, "fs") ll.LoadGloba...
69f727a3e19f4fc8dff8f9503222a1bda1506af7
3b9f651ccce1397e50eefaa0592f2dbf2724ecbb
baranalhas/golang-learning-library
/maps/demo1.go
Go
go
438
no_license
package maps import "fmt" func Demo1(value string) string { sozluk := make(map[string]string) sozluk["table"] = "Masa" sozluk["book"] = "Kitap" sozluk["pencil"] = "Kalem" delete(sozluk, "book") deger, varMi := sozluk["table"] fmt.Println(deger, varMi) deger, varMi = sozluk["book"] fmt.Println(deger, varMi)...
a2264cb36b48059e2473e31d9e436534ba136f10
ff0b7991fb5d94f7120747284e1f25c0e0e0d107
gcurtis/stripe-go
/testhelpers/refund/client.go
Go
go
962
permissive
// // // File generated from our OpenAPI spec // // // Package refund provides the /refunds APIs package refund import ( "net/http" stripe "github.com/stripe/stripe-go/v72" ) // Client is used to invoke /refunds APIs. type Client struct { B stripe.Backend Key string } // Expire is the method for the `POST /v...
71c00231b9cc512de5b271f675699064e80feaad
6f4937ff0d604842daff8cc1009bf9868252cc48
cuirixin/phoenix_gocore
/middleware/gin/commonlog/hook_rotated.go
Go
go
1,422
no_license
/** * @Author: victor * @Description: * @File: rotated * @Version: 1.0.0 * @Date: 2020/4/5 11:19 上午 */ package commonlog import ( "github.com/lestrrat-go/file-rotatelogs" "github.com/rifflock/lfshook" log "github.com/sirupsen/logrus" "time" ) func NewLfsHook(logName string, maxRemainCnt uint) log.Hook { ...
c26048ee8f88c7cd95f4afcf1d04b135788a6234
ec14dbe183231c052a4b0a814dbd147d586f621a
bekdev/ds-juggler
/main.d/main.go
Go
go
1,981
no_license
/* * @author Emmanuel Kofi Bessah * @email ekbessah@uew.edu.gh * @created Sat Jun 30 2018 11:41:21 * @copyright © 2018 University of Education, Winneba */ package main import ( "encoding/json" "fmt" "log" "net/http" juggler "bekinsoft.com/ds-juggler" "bekinsoft.com/eritars/iam-ms/datasource" "be...
e9cad0b89c0ac5ca4c39b5a0319e3410d8998041
8e8b154b4de7ac1b01f4559495f25b90f12c1dbb
igromanru/software
/pangolin/domain/middle/sdk.go
Go
go
6,409
permissive
package middle import ( "github.com/deepvalue-network/software/libs/hash" "github.com/deepvalue-network/software/pangolin/domain/middle/instructions" "github.com/deepvalue-network/software/pangolin/domain/middle/instructions/instruction" "github.com/deepvalue-network/software/pangolin/domain/middle/labels" "githu...
7ac59e95f164ddd33f4f58ad5a75ee2cfa4a08d4
5773073d903554c063545c55c9e94be9c05f8e28
cloudflare/go
/src/cmd/go/internal/modload/stat_openfile.go
Go
go
791
permissive
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build (js && wasm) || plan9 // On plan9, per http://9p.io/magic/man2html/2/access: “Since file permissions // are checked by the server and group informat...
3ce234d03ceaace2fe6a03433fb6a0155fe9e42d
db2bebceb70daef06baec0c0b333c761f68ca234
qghappy1/golua
/compiler/codegen.go
Go
go
31,241
no_license
package compiler import ( "golua/number" ) const MAXARG_Bx = 1<<18 - 1 // 262143 const MAXARG_sBx = MAXARG_Bx >> 1 // 131071 var arithAndBitwiseBinops = map[int]int{ TOKEN_OP_ADD: OP_ADD, TOKEN_OP_SUB: OP_SUB, TOKEN_OP_MUL: OP_MUL, TOKEN_OP_MOD: OP_MOD, TOKEN_OP_POW: OP_POW, TOKEN_OP_DIV: OP_DIV, ...
3a746cce2a68de46d23782f29f2c2d4af0533487
ee4121cadfd462535c565bcbe820cbe3b0cc66c2
rootfs/serving
/vendor/github.com/google/go-containerregistry/ko/publish/daemon.go
Go
go
1,549
permissive
// Copyright 2018 Google LLC 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 applicable l...
ad7d667fee05903cbfc4e041d496aad2aba263f8
7c0fb3f6b63c05354c67654ea5d5dd6e28e61906
NBR41/go-testgoa
/controllers/relation_prints_editors.go
Go
go
4,419
no_license
package controllers import ( "github.com/NBR41/go-testgoa/app" "github.com/goadesign/goa" ) // RelationPrintsEditorsController implements the relationPrintsEditors resource. type RelationPrintsEditorsController struct { *goa.Controller fm Fmodeler l Lister } // NewRelationPrintsEditorsController creates a rela...
aa9c5ea02bb3fdf4c5d604affdcefb9271c2ba74
03bcb467458df6617916e5dd95e4fe9029935457
faddat/hub-1
/x/swap/keeper/keeper.go
Go
go
899
permissive
package keeper import ( "fmt" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" params "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/tendermint/tendermint/libs/log" "github.com/sentinel-official/hub/x/swap/expected" "github.com/sentinel-official/hub/x/swap/types" ) typ...
637d6a53275467293990339556fa6ae0be59e060
12bdff675b8b3d181a77b445e49ec7c5583b452d
roytman/ovsdb-etcd
/pkg/ovsdb/codec.go
Go
go
1,008
no_license
package ovsdb import ( "io" "net/rpc" "net/rpc/jsonrpc" "strings" ) type Codec struct { code rpc.ServerCodec } func (c *Codec) ReadRequestHeader(r *rpc.Request) error { e := c.code.ReadRequestHeader(r) if e != nil { return e } dot := strings.LastIndex(r.ServiceMethod, ".") needClass := false if dot < 0 ...
be8d46fb0b254ba105dba7940292cc6c47cba938
a078f192f2ee67126444500be957d807414cf91d
segmentio/kafka-go
/balancer_test.go
Go
go
10,233
permissive
package kafka import ( "fmt" "hash" "hash/crc32" "testing" ) func TestHashBalancer(t *testing.T) { testCases := map[string]struct { Key []byte Hasher hash.Hash32 Partitions []int Partition int }{ "nil": { Key: nil, Partitions: []int{0, 1, 2}, Partition: 0, }, "partitio...
73925bf28c0d72a38aaf4d80686739d8d4ae2045
c2c9c055b562b8d98551361b596ea8def1e1a8fb
alibaba/terraform-provider
/vendor/github.com/hashicorp/terraform/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go
Go
go
14,681
permissive
package storage import ( "encoding/xml" "errors" "fmt" "io" "net/http" "net/url" "strconv" "strings" "time" ) // Container represents an Azure container. type Container struct { bsc *BlobStorageClient Name string `xml:"Name"` Properties ContainerProperties `xml:"Properties"` Met...
ae3010fb3a095af5fad898ce9e722433b583970f
5132f5b42ffd10818b3f4578479bcaebb3f09900
aliliin/Learn-golang
/src/l_package/select1.go
Go
go
317
no_license
package main import ( "fmt" "time" ) func main() { ch1 := make(chan int) ch2 := make(chan int) go func() { ch1 <- 100 }() select { case <-ch1: fmt.Println("case 1 执行") case <-ch2: fmt.Println("case 2 执行") case <-time.After(3 * time.Second): fmt.Println("case 3 执行 ..timeout..") } }
c7226f9676aee763011325da41893ce8faaae825
ccc9ae47d45479738a7ecfa6a49bf4ab8c699156
UnknowName/goexamples
/packages/context.go
Go
go
3,681
no_license
package packages import ( "context" "fmt" "log" "net/http" "sync" "time" ) /* Context用于跟踪Goroutine链的,比如一个Goroutine又启动了很多Goroutine,而这些都要被取消 但需要配合Select语法一起使用 */ // 相关子Goroutine取消后全部取消 func Context() { go http.ListenAndServe(":8099", nil) ctx, cancel := context.WithCancel(context.Background()) go func() { ...
0e1d206e78e9f2989d2dfa36936354b753f20392
85917bb1f2d9c8d6377f8d75874447d22282d7a8
xptd/Go_WorkSpace
/csdnSpider/gbk2utf/gbk2utf.go
Go
go
2,147
no_license
package gbk2utf import ( "fmt" "golang.org/x/text/encoding/simplifiedchinese" ) const ( GBK string = "GBK" UTF8 string = "UTF-8" UNKNOWN string = "UNKNOWN" ) func IsGBK(bytes []byte) bool { // fmt.Println("IsGBK") len := len(bytes) if len <= 0 { return false } var i int = 0 for i < len { if by...
a195821b239ba1209a63f94026e55998e7aa0110
3d9fd1831721ae7ae00a607d7861f1f8463c938f
ffuf/ffuf
/pkg/ffuf/optrange.go
Go
go
1,665
permissive
package ffuf import ( "encoding/json" "fmt" "strconv" "strings" ) //optRange stores either a single float, in which case the value is stored in min and IsRange is false, //or a range of floats, in which case IsRange is true type optRange struct { Min float64 Max float64 IsRange bool HasDelay bool }...
b8375c9d7abb684e768aaf9e6106a96087f24c7d
f9614fc32f8ccd65eaa99172788199729e585825
redhatxl/service-monitor
/agent/main.go
Go
go
880
permissive
package main import ( "flag" "fmt" "os" "github.com/anchnet/service-monitor/agent/cron" "github.com/anchnet/service-monitor/agent/funcs" "github.com/anchnet/service-monitor/agent/g" "github.com/anchnet/service-monitor/agent/http" ) func main() { cfg := flag.String("c", "cfg.json", "configuration file") ver...
a1b7608e5fc47e0cf9ebb55f4c29cf46c4553752
ed107de9bb0635e8f20cdf46a20967aa6627e89c
khekrn/TechTalk
/cpu-cache/cacheline/listvsarray_test.go
Go
go
960
no_license
package cacheline import ( "strconv" "testing" ) func TestSlice(t *testing.T) { v := insertSlice(10) t.Log(v) deleteSlice(v) } func benchmarkSlice(b *testing.B, n int) { for bn := 0; bn < b.N; bn++ { s := insertSlice(n) deleteSlice(s) } } func TestList(t *testing.T) { const size = 10 v := insertList(si...
f10085843bb72cd2eac01a3e76fc963ad878bf78
55e630f1d3d8a8b699cc70ced869913ce040b30b
Gouplook/rpcdemo
/lang/const/const.go
Go
go
460
no_license
/******************************************** @Author :yinjinlin<yinjinlin_uplook@163.com> @Time : 2021/1/4 11:20 @Description: *********************************************/ package _const // 全局定义错误code const ( Hi = "10001" IS_NOT_IMAGE = "10002" IMG_TYPE_ERR = "10003" UPLOAD_FAIL = "10004" FILE...
4244342bc93f61a52267f59cff4ba43246d1fbc2
a545b536b33d117f3b0e7d4148da93cb1ff9da9e
wk8/go-ordered-map
/json.go
Go
go
4,515
permissive
package orderedmap import ( "bytes" "encoding" "encoding/json" "fmt" "reflect" "unicode/utf8" "github.com/buger/jsonparser" "github.com/mailru/easyjson/jwriter" ) var ( _ json.Marshaler = &OrderedMap[int, any]{} _ json.Unmarshaler = &OrderedMap[int, any]{} ) // MarshalJSON implements the json.Marshaler ...
0913e60c2c86aa5db129815c4477f6821721f0a1
f07de56e6a25a517ce3cb5960e00e3d45f408f22
gotestyourself/gotestsum
/cmd/flags_test.go
Go
go
936
permissive
package cmd import ( "testing" "gotest.tools/v3/assert" ) func TestNoSummaryValue_SetAndString(t *testing.T) { t.Run("none", func(t *testing.T) { assert.Equal(t, newHideSummaryValue().String(), "none") }) t.Run("one", func(t *testing.T) { value := newHideSummaryValue() assert.NilError(t, value.Set("output...
882e51bf81f8a0fdf5063bad0dd9a15b9ed9f0bb
5e6877196f25861fc5d12527dd016a781bb2fdcb
bububa/opentaobao
/api/tbitem/AlibabaItemOperateUpshelf.go
Go
go
527
permissive
package tbitem import ( "github.com/bububa/opentaobao/core" "github.com/bububa/opentaobao/model/tbitem" ) // AlibabaItemOperateUpshelf 商品上架 // alibaba.item.operate.upshelf // // 商品上架 func AlibabaItemOperateUpshelf(clt *core.SDKClient, req *tbitem.AlibabaItemOperateUpshelfAPIRequest, session string) (*tbitem.Alibaba...