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
07d138752e5d65887979d1b31920c30e5e269bbd
401160b182a88cdfadebb1dca31ecf1b40613232
brettbuddin/victor
/pkg/chat/adapter.go
Go
go
740
permissive
package chat import ( "fmt" "github.com/brettbuddin/victor/pkg/store" "github.com/gorilla/mux" ) var adapters = map[string]InitFunc{} func Register(name string, init InitFunc) { adapters[name] = init } func Load(name string) (InitFunc, error) { a, ok := adapters[name] if !ok { return nil, fmt.Errorf("unko...
45e77a364b574dbe5cabd1e4a5990f61ae607df0
4b9ba88f97341a099e446c58c2b00bafa85f56b2
vsmayberry/DictionaryParser
/definition_parser.go
Go
go
2,449
no_license
package main import ( "errors" "fmt" "regexp" "strings" ) func isValidDefinition(definitionString string) (Definition, error) { definitionString = removeInvalidCharacters(definitionString) definition, err := isWordDef(definitionString) return definition, err } func isWordDef(definition string) (Definition, er...
ad1093f1d0ca31cc39f1b88daf193c8889595579
2e529241616b08f08708fb6b921e8bc5326fd8f4
wowucco/go-admin
/tests/common/auth.go
Go
go
2,002
permissive
package common import ( "fmt" "github.com/wowucco/go-admin/modules/auth" "github.com/wowucco/go-admin/modules/config" "github.com/gavv/httpexpect" "net/http" ) func authTest(e *httpexpect.Expect) *http.Cookie { printlnWithColor("Auth", "blue") fmt.Println("============================") // login: show pri...
7051f4e47e5ed18fd5709ac5e8469e8480aaba26
aaa3a9b4add04ffd8733a8d7a1eaf3874de72be6
bitum-project/bitumdata
/db/bitumsqlite/blocksretrieval_test.go
Go
go
961
permissive
package bitumsqlite import ( "testing" ) func TestEmptyDBGetBestBlockHash(t *testing.T) { db, err := ReusableEmptyDB() if err != nil { t.Fatalf("Failed to obtain test DB: %v", err) } str := db.GetBestBlockHash() if str != "" { t.Fatalf("GetBestBlockHash() failed: expected empty string, returned %v", str) ...
2e2ae8451d5b03472ab36db33766e06c8c77cfe3
bc1422cef3bed2ff192c2a92ba68033ee00f6221
ChainSafe/cosmos-sdk
/x/evidence/abci.go
Go
go
883
permissive
package evidence import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" "github.com/cosmos/cosmos-sdk/x/evidence/keeper" "github.com/cosmos/cosmos-sdk/x/evidence/types" ) // BeginBlocker iterates through and ...
e72fa468cedc63065843ccfda36334fb5af02bd6
d372f2314cacfa6f9ffe68c95b44b8dbb3df6d85
amorenoz/sriov-network-device-plugin
/vendor/github.com/jaypipes/ghw/cpu_windows.go
Go
go
1,532
permissive
// +build !linux // Use and distribution licensed under the Apache license version 2. // // See the COPYING file in the root project directory for full text. // package ghw import ( "github.com/StackExchange/wmi" ) const wmqlProcessor = "SELECT Manufacturer, Name, NumberOfLogicalProcessors, NumberOfCores FROM Win32...
9bdaa6d8dbb5927601c0e4543d81e8defa25c3de
b200a4188653fd26e9dbb55e2a2144f523853327
plan-crypto/node
/plan-master/x/structure/keeper/keeper.go
Go
go
5,915
no_license
package keeper import ( "fmt" "github.com/plan-crypto/node/x/coins" "github.com/tendermint/tendermint/libs/log" planTypes "github.com/plan-crypto/node/x/plancoin/types" "github.com/plan-crypto/node/x/structure/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) // Keeper o...
d7a399013141fd8ed6d06e6fdc42bad33f628f61
e10221597337573d3c7c1ac860cae4b3ba6d3e17
SpringerPE/cf-mgmt
/space/users.go
Go
go
5,896
permissive
package space import ( "fmt" "strings" "github.com/pivotalservices/cf-mgmt/cloudcontroller" "github.com/pivotalservices/cf-mgmt/ldap" "github.com/pivotalservices/cf-mgmt/uaac" "github.com/xchapter7x/lo" ) // UserMgr - interface type encapsulating Update space users behavior type UserMgr interface { UpdateSpac...
fe53c5b9a3eddb5205a4d94c1f2df6c9fff0d4ba
78871b554155e44053312eaa56b8bc4937d58889
SkylakeCoder/go-cc
/src/main.go
Go
go
376
permissive
package main import ( "chess" "runtime/pprof" "os" "flag" "log" ) var depth = flag.Int("d", 4, "-d=num") var pvPath = flag.String("pvpath", "pv.json", "-pvpath=xxx") func main() { flag.Parse() f, _ := os.Create("profiles/profile.data") pprof.StartCPUProfile(f) defer pprof.StopCPUProfile() log.Println("dept...
e34a61a5e0985327db34c6044227cbe2b7e50055
b7b5fc98d4b863cb0db5f9b3405487798c0c2731
ProofSuite/amp-matching-engine
/e2e/init.go
Go
go
4,831
permissive
package e2e import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "net/http/httptest" "testing" "github.com/Proofsuite/amp-matching-engine/app" "github.com/Proofsuite/amp-matching-engine/contracts" "github.com/Proofsuite/amp-matching-engine/crons" "github.com/Proofsuite/amp-matching-engine/daos" "...
794ccbedbe9ec1ab7cbe26f62e0283ee2cb428c9
c17c6acca690f87aa750d71dbcd743c6d47c3edf
leighmcculloch/gochecknoglobals
/checknoglobals/check_no_globals.go
Go
go
4,487
permissive
package checknoglobals import ( "fmt" "go/ast" "go/token" "go/types" "strings" "golang.org/x/tools/go/analysis" ) // allowedExpression is a struct representing packages and methods that will // be an allowed combination to use as a global variable, f.ex. Name `regexp` // and SelName `MustCompile`. type allowed...
da0ad92f135c0e82b8064e85763003914ca12bb6
5c3e468bfc484a0d3c3b1c4fb10ddfcec0f2ad87
isabella232/pipeline
/lib/cadence-aws-sdk/clients/ec2stub/interface.go
Go
go
120,079
permissive
// Generated by github.com/temporalio/temporal-aws-sdk-generator // from github.com/aws/aws-sdk-go version 1.35.7 package ec2stub import ( "github.com/aws/aws-sdk-go/service/ec2" "go.uber.org/cadence/workflow" "github.com/banzaicloud/cadence-aws-sdk/clients" ) // ensure that imports are valid even if not used by...
89b31fc27194ff37f850edfa9d9985cb742daf28
5e52328c52b5822eed798a0e91451a46aa0c61e7
henryluki/word_filter
/word_filter/loader.go
Go
go
896
no_license
package main import ( "github.com/go-fsnotify/fsnotify" "github.com/huichen/sego" "log" ) var segmenter sego.Segmenter // init func InitLoader() { LoadDict() go func() { RunWatcher("data/sensitive.txt") }() } // load dict func LoadDict() { dict := "data/sensitive.txt" segmenter.LoadDictionary(dict) } // ...
a1388842dd6fa23217429a067031f7d2f5586d9c
a05d558eca745296b4158c0fb8f887ad76c50587
buriedgod/ion-sfu
/pkg/buffer/queue.go
Go
go
2,515
permissive
package buffer import ( "sync" log "github.com/pion/ion-log" ) const maxDisorder = 30 type PacketQueue struct { pkts [][]byte pool *sync.Pool head int tail int size int maxSize int headSN uint16 duration uint32 } func NewPacketQueue(pool *sync.Pool, size int) *PacketQueue { return...
af88a4d92e0741fee3854695478a63532d6de0dd
cb6bf10245705416d664232f01b5c9e76a160365
ssssssix/poker
/src/cg/center.go
Go
go
5,725
no_license
//中央服务器 package cg import ( "encoding/json" "errors" "fmt" //"github.com/bitly/go-simplejson" "github.com/bradfitz/gomemcache/memcache" "ipc" "labix.org/v2/mgo" "labix.org/v2/mgo/bson" "sync" ) type User struct { UserId bson.ObjectId `bson:"_id,omitempty"` // 必须要设置...
d957a895a21fbece666c35908065567b66a88d8f
fc1c8165df1a0d05d432e47889fe8ccb0b943c7f
peterfroehlich/bosun
/vendor/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go
Go
go
3,658
permissive
// Copyright (c) 2013, Suryandaru Triandana <syndtr@gmail.com> // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package storage import ( "bytes" "os" "sync" "github.com/syndtr/goleveldb/leveldb/util" ) const typeShift = 3 type me...
5246e07979785e2493b77e79d4de74eea2f54467
448efd16bff8662167f7fc3f07e2011ab5967f6f
renesugar/gedcom
/html/individual_dates_test.go
Go
go
468
permissive
package html_test import ( "github.com/elliotchance/gedcom" "github.com/elliotchance/gedcom/html" "testing" ) func TestIndividualDates_WriteTo(t *testing.T) { c := testComponent(t, "IndividualDates") doc := gedcom.NewDocument() elliot := individual(doc, "P1", "Elliot /Chance/", "4 Jan 1843", "17 Mar 1907") c...
a5e5a32c3f0cf2fd10f61762f3927337a2e44cb1
a39dc93a7bd21ca80ff38797350dbc3feb8b6e1e
vtumuluri/cockroach
/pkg/security/tls_test.go
Go
go
2,152
permissive
// Copyright 2014 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, ...
1fc73e88b6d19d103c7ca3ab9ed675909d36f7c5
7b41a4daf67e8dc5df7a645d9c5f016c5e5914eb
bmurithi/magma
/orc8r/cloud/go/services/state/state/main.go
Go
go
1,126
permissive
/* * Copyright (c) Facebook, Inc. and its affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ package main import ( "database/sql" "magma/orc8r/cloud/go/blobstore" "magma/orc8r/cloud/go/dat...
2d0a97194cde2f425b93e971456cf41be7d7051f
911db552e6435269f7add811ad766cb17736ea97
vkareh/uhc-sdk-go
/clustersmgmt/v1/flavour_builder.go
Go
go
3,398
permissive
/* Copyright (c) 2019 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 agreed to in writing, software...
da7147077ccf65708fde0f584762864526914381
282b680a1247726ffaf25298e69fca92d33858e6
stronker/authx
/internal/app/authx/manager/authx.go
Go
go
17,651
permissive
/* * Copyright 2019 Nalej * * 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...
fbec8dbc2ccd9cae201b619675055e06165dbd4f
2c9cc776f5f80a93d26e4a70b8b74ee442e6c825
tesharp/terraform-provider-spacelift
/spacelift/resource_environment_variable_test.go
Go
go
3,640
permissive
package spacelift import ( "fmt" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" . "github.com/spacelift-io/terraform-provider-spacelift/spacelift/internal/testhelpers" ) func TestEnvironmentVariableResource(t *testing.T) { ...
52866b3b3e2030a8fc8695c1d7a6f0b024925425
d974bb1cc3bacb164ceaa854127d34636d90580f
s-matyukevich/cilium
/pkg/fqdn/cache_test.go
Go
go
30,801
permissive
// Copyright 2018 Authors of Cilium // // 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 ...
35beef37032e7fbc6ac779b51c414944ead8638d
aaee2d2e7fc4178674949fa6fd2772dd2e2cdead
sonda2208/google-api-go-client
/bigqueryreservation/v1alpha2/bigqueryreservation-gen.go
Go
go
119,335
permissive
// Copyright 2020 Google LLC. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code generated file. DO NOT EDIT. // Package bigqueryreservation provides access to the BigQuery Reservation API. // // For product documentation, see: https://cloud.google.com/bigq...
d9d24721b61190db7a8426568550845d4e194594
d58e553433fd514e709ab36d4ecdc3e20345a58f
bdshadow/kubernetes-client-android
/kubernetes-model/vendor/github.com/openshift/origin/pkg/router/f5/testing/deepcopy.go
Go
go
3,693
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...
3895a2fc22b10dcefa14767c28d1cc5242c6b733
9877c077ebaa22aef7a5511f505e6e147ead872f
bengreenier/azbrowse
/cmd/azbrowse/selfupdate.go
Go
go
1,209
permissive
package main import ( "bufio" "fmt" "log" "os" "github.com/blang/semver" "github.com/rhysd/go-github-selfupdate/selfupdate" ) func confirmAndSelfUpdate() { latest, found, err := selfupdate.DetectLatest("lawrencegripper/azbrowse") if err != nil { log.Println("Error occurred while detecting version:", err) ...
501816f8b935aa4ec8efba93f417255b9714353b
cee144e7666bb779251ed4a86243d79d465f398a
billziss-gh/golib
/retry/retry_test.go
Go
go
527
permissive
/* * retry_test.go * * Copyright 2018-2021 Bill Zissimopoulos */ /* * This file is part of golib. * * It is licensed under the MIT license. The full license text can be found * in the License.txt file at the root of this project. */ package retry import ( "fmt" "testing" "time" ) func TestRetry(t *testin...
65ee05b4d2cbe76dcc0eccd118195e63a3d3c689
8c0c3e944b4b41526b6ed2795f1061d5aa09462b
ZacharyChang/leetcode
/challenge/week1/006.group-anagrams/solution.go
Go
go
849
permissive
package leetcode func groupAnagrams(strs []string) [][]string { res := make([][]string, 0) anagramMap := make(map[int][]string) for _, str := range strs { sum := getSumPoint(str) if anagramMap[sum] == nil { anagramMap[sum] = []string{str} } else { anagramMap[sum] = append(anagramMap[sum], str) } } f...
21261f4a5ee038acefe4f696406b97ccc1afbf4b
ed4072fe83a2f203a96e8d273f1a1967330bd73e
sgtest/monorepo-test-3
/kubernetes-5/pkg/client/informers/informers_generated/internalversion/rbac/internalversion/clusterrole.go
Go
go
2,498
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, ...
1cca7ebb06fb6cb668e89eaea23ffe57150ea9e1
6969f34015b70a44570482a65fa41e8f2188c280
kirelagin/telego
/tglog/repo/mongo/users.go
Go
go
1,934
permissive
package mongo import ( "context" "github.com/mitinarseny/telego/tglog/repo" log "github.com/sirupsen/logrus" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" ) const ( usersCollectionName = "users" ) type UsersRepo struct ...
48fb7fb9a8cf5e83d9b14db478360d1e88222f8c
82f66c09adc8ffd411e399776e54cf7626c0eada
Kushmaro/ecctl
/pkg/user/roles_test.go
Go
go
3,035
permissive
// Licensed to Elasticsearch B.V. under one or more contributor // license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright // ownership. Elasticsearch B.V. licenses this file to you under // the Apache License, Version 2.0 (the "License"); you may // not use ...
7a2917dc3bb31ae74989c7ebaabbf50cb995a435
b6c29bb5001f55b7c11392ddf4159e1d0aa8745b
shankarramshivram/kubernetes-event-exporter
/pkg/sinks/tmpl_test.go
Go
go
1,244
no_license
package sinks import ( "github.com/opsgenie/kubernetes-event-exporter/pkg/kube" "github.com/stretchr/testify/require" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "testing" "time" ) func TestLayoutConvert(t *testing.T) { ev := &kube.EnhancedEvent{} ev.Namespace = "default" ev.Type = "Warning" ev.InvolvedObject....
1b694d3c2a7608d873c5505176b790238c12831f
19a8a7e6d14cc3bfc1077a1f5118f41eb0747d05
cfklkj/namespacelibs
/FlyLibs/Help/go/base.go
Go
go
532
no_license
/* get go get -u -v github.com/nsf/gocode odbc https://www.cnblogs.com/zsy/p/5226740.html https://studygolang.com/articles/8314 https://blog.csdn.net/kenkao/article/details/47857795 go git merge --abort json type S2CDirInfo struct{ HomePath string `json:"homePath"` //需要这个(`json:"homePath"` )才能转json Chi...
ff00901c77164f1c8433a2eec7336575f5180bbe
9e4318bce953698bbcf112f568eac4330aaab3d2
joe9724/LCollector-
/model/user.go
Go
go
4,659
no_license
package model import ( "gopkg.in/mgo.v2/bson" ) /** 用户信息 */ type User struct { UserId bson.ObjectId `json:"user_id" bson:"_id,omitempty"` // 用户唯一ID UserName string `json:"user_name" bson:"user_name"` // 用户名(不可重复) Password string `json:"-"` ...
73099d3a646cfc7b3e656f046911f69f3311a5f1
2d0cf75faa1c89b0e4385bcaa4f989394c38593f
phoenixking25/multi-tenancy
/incubator/hnc/e2e/tests/subnamespace_test.go
Go
go
1,095
permissive
package test import ( "os/exec" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Subnamespaces", func() { const ( prefix = namspacePrefix+"subnamespace-" nsA = prefix+"a" nsB = prefix+"b" ) BeforeEach(func() { cleanupNamespaces(nsA, nsB) }) AfterEach(func() { cleanupNames...
82ac7c629a1cf48b31485ad985b33ad108e1f6f8
991fdfb39f0edc043419cd73c85f9f49215bffe7
kubermatic/machine-controller
/pkg/cloudprovider/util/cloud_init_settings_test.go
Go
go
2,241
permissive
/* Copyright 2021 The Machine Controller 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 w...
481ffd5f453dac09fe8f090514c17fc3d78edf6d
b1c508a06b74beac486b4b96ae0fac3d45909edd
cwen-coder/tinMongo
/handler/dbHandler.go
Go
go
649
permissive
package handler import ( // "github.com/go-martini/martini" "github.com/martini-contrib/render" ) func DbHome(r render.Render) { r.HTML(200, "db/home", map[string]interface{}{}) } func DbNewCollection(r render.Render) { r.HTML(200, "db/newCollection", map[string]interface{}{}) } func DbTransfer(r render.Render)...
11581c3c20e6bbe956f5439510ec1a828bbcaa9e
c5dd01683a1e6c0d5769e8b0112877ec8e11369b
aponte411/data-structures
/linear/linked_list/linked_list_test.go
Go
go
438
no_license
package linked_list import ( "testing" ) func TestSLList(t *testing.T) { list := new(SinglyLinkedList) list.AddToHead(1) list.AddToHead(2) list.AddToEnd(4) list.AddToEnd(77) list.AddAfter(1, 9) res := list.Count if res != 5 { t.Errorf("Expected 5 nodes in singly linked list, got %v", res) } list.Iterate...
62cbf7fb73a656e111b0b518c3102e37035bbe10
03c6f28e304afd150d0f32204351d0cb78aeb8a3
OlegLoewen/test-infra-1
/pkg/testrun_renderer/tests.go
Go
go
1,397
permissive
// Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in complian...
9967fa09dd0ea295e3e0fefe13e4c14f252bff90
2b2c7a39c87ea7e2b74a986d8989a65d7203e829
maplestoria/diff-redis
/app.go
Go
go
997
permissive
package main import ( . "diff-redis/src" "gopkg.in/alecthomas/kingpin.v2" "os" ) var ( app = kingpin.New("diff-redis", "Find out the missing keys") source = app.Flag("source", "host:port").Required().Short('s').String() sourcePassword = app.Flag("source-password", "Password of source").Short(...
b58a303fd21b71d352494895c75f2facce1ba253
32ccf7e3136dc8ce9be2fdb6646555d9c2f86899
golang/tools
/cmd/signature-fuzzer/internal/fuzz-generator/arrayparm.go
Go
go
2,429
permissive
// Copyright 2021 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 generator import ( "bytes" "fmt" ) // arrayparm describes a parameter of array type; it implements the // "parm" interface. type arrayparm struct { ...
48043e75b84e21d984c59d5eb42e28e52a436e6e
3a7fa2a89f69d51dbece635307a5802cd4e0b005
edouard-lopez/elvish
/eval/str/str.go
Go
go
1,110
permissive
// Package str exposes functionality from Go's strings package as an Elvish // module. package str import ( "strings" "github.com/elves/elvish/eval" ) var Ns = eval.NewNs().AddBuiltinFns("str:", fns) var fns = map[string]interface{}{ "compare": strings.Compare, "contains": strings.Contains, "contains-...
3124eb533a74e3296cab9d045b49949786c4d28c
c37724c66ea8d9d52575dd1d2efc2757f662056a
gauravvsharma18/pub-sub
/consumer/main.go
Go
go
2,152
no_license
package main import ( "fmt" "sync" "encoding/json" "gopkg.in/confluentinc/confluent-kafka-go.v1/kafka" "consumer/mail" "consumer/sms" "consumer/requestbody" ) func parse_data(data string)(string,string){ var body requestbody.RequestBody; json.Unmarshal([]byte(data), &body); phone:=body.Phone; email:=bo...
26dab838afa5a60aaed3f5c84873b7ae30b1d30a
61ca8e44efcd5417f9e74f986723067878cecf47
r4b3rt/terway
/daemon/eip.go
Go
go
3,815
permissive
package daemon import ( "fmt" "net" "github.com/AliyunContainerService/terway/pkg/tracing" "github.com/AliyunContainerService/terway/pkg/aliyun" "github.com/AliyunContainerService/terway/types" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) // eip resource manager for pod public ip address type eipRe...
8f5cabb416cd304630700b3110e8e8b8703379a9
235c83505cd5bed59d74edac2c069b58469e7549
Marlonen/RockGO
/network/netapi.go
Go
go
5,220
permissive
package network import ( "errors" "fmt" "github.com/zllangct/RockGO/component" "github.com/zllangct/RockGO/logger" "github.com/zllangct/RockGO/utils" "reflect" "runtime/debug" ) type MessageProtocol interface { Marshal( interface{})([]byte,error) Unmarshal( []byte, interface{})error } type NetAPI interface...
0a7badcd59555b45559bd3e31383df72632920a5
5cfefc2735d12164b3dbae5745fc2f253aa10fb4
godbus/dbus
/_examples/monitor.go
Go
go
1,095
permissive
package main import ( "fmt" "os" "github.com/godbus/dbus/v5" ) func main() { conn, err := dbus.ConnectSessionBus() if err != nil { fmt.Fprintln(os.Stderr, "Failed to connect to session bus:", err) os.Exit(1) } defer conn.Close() rules := []string{ "type='signal',member='Notify',path='/org/freedesktop/...
4cbd8c908a52a22cbc214f40e84a12140bc69684
511815da5e47c5f8bece2c2bd3f0dfcd7fc38408
codenotary/immudb
/cmd/immudb/command/service/commandline.go
Go
go
1,951
permissive
/* Copyright 2022 Codenotary 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 to in...
57a7853d212508df8bfb836e65da7171725458ee
bbcf29e1ed8f985141650ac89bf010068b454f73
INOS-soft/mender-cli
/cmd/portforward_udp.go
Go
go
5,323
permissive
// Copyright 2021 Northern.tech AS // // 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 ...
63c9c7455ce1638d91f8154cdb777415df230566
fbec5de427d893c4fc10cf6871da7d024b53e3dc
0rz1/bitcask
/loader_test.go
Go
go
1,336
permissive
package bitcask import ( "io/ioutil" "os" "strconv" "testing" "github.com/0rz1/bitcask/set" ) func TestLoadFile(t *testing.T) { path, err := ioutil.TempDir(".", "tmp") if err != nil { t.Fatal() } defer func() { err := os.RemoveAll(path) if err != nil { t.Fail() } }() locs := []*location{ {fil...
c10a44a16462469d937b330d2451da9a1a6d0953
42243dda8b72e7a6272c88aca1146ac9915a1e62
NanoSecCo/log4go
/filelog_linux.go
Go
go
227
permissive
//+build linux package log4go import( "os" "os/signal" "syscall" ) func notifySignals(s chan os.Signal){ signal.Notify(s, syscall.SIGQUIT, syscall.SIGKILL, syscall.SIGINT, syscall.SIGTERM, syscall.SIGTSTP, ) }
c45d74eddf7e575d57e868fa9f1f0dcdf4e04b49
8ae09ef0d71110aa6d42f0952c005a956f51b593
goapt/acm
/logger.go
Go
go
367
no_license
package acm import "log" type logger interface { Debug(...interface{}) Info(...interface{}) Error(...interface{}) } type defualtLogger struct { } func (l *defualtLogger) Error(v ...interface{}) { log.Println(v...) } func (l *defualtLogger) Info(v ...interface{}) { log.Println(v...) } func (l *defualtLogger) ...
5fcfa3f4b8b53007e2f19cc7aaa32fe9446e9ffe
05253d72e97e749c33180c626f7f69c706f300b3
foresta/goblueprints
/chat/room.go
Go
go
2,185
no_license
package main import ( "log" "net/http" "github.com/foresta/goblueprints/trace" "github.com/gorilla/websocket" ) type room struct { // forwardは他クライアントに転送するためのメッセージを保持するチャネル forward chan []byte // joinはチャットルームに参加しようとしているクライアントのためのチャネル join chan *client // leaveはチャットルームから退室しようとしているクライアントのためのチャネル leave chan *c...
501470d1d21f7de54ffa5fe4442d649541a5cb54
4d59c7d547f9603fb27743b343bcd646d6b04b30
thiagomarcal/rest-api
/routes/person.go
Go
go
1,224
no_license
package routes import ( "encoding/json" "net/http" "github.com/gorilla/mux" "github.com/thiagomarcal/rest-api/models" ) // RouteError teste type RouteError struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` } // GetPeople Display all from the people var func GetPeople(w ...
6c1d0e1563199f144f6e91b0eb5736552ac2ed9c
423948b87921645b3e36a9a44570686ab010a82a
stefantds/csvdecoder
/example_custom_decoder_test.go
Go
go
1,457
permissive
package csvdecoder_test import ( "encoding/json" "fmt" "strings" "github.com/stefantds/csvdecoder" ) type Point struct { X int Y int } // DecodeField implements the csvdecoder.Interface type func (p *Point) DecodeField(field string) error { // the decode code is specific to the way the object is serialized. ...
a0a78e976e028439c8fb680f63112cb412490991
b18165af0bffcabd575c0f4a425bc3be65b6e316
sebest/rest-layer
/method_get.go
Go
go
1,261
permissive
package rest import ( "strconv" "golang.org/x/net/context" ) // listGet handles GET resquests on a resource URL func (r *request) listGet(ctx context.Context, route route) { page := 1 perPage := 0 if !r.skipBody { if route.resource.conf.PaginationDefaultLimit > 0 { perPage = route.resource.conf.PaginationD...
6fca957bd633fe1c800bef95cefe5a062e2791f2
277c2b1f4f67d6b4ba41031c11258fdcc538a363
sherwinp/lxd
/lxd/storage/backend_lxd.go
Go
go
21,035
permissive
package storage import ( "fmt" "io" "os" "regexp" "github.com/lxc/lxd/lxd/db" "github.com/lxc/lxd/lxd/migration" "github.com/lxc/lxd/lxd/operations" "github.com/lxc/lxd/lxd/state" "github.com/lxc/lxd/lxd/storage/drivers" "github.com/lxc/lxd/shared" "github.com/lxc/lxd/shared/api" ) type lxdBackend struct ...
e5e75ba3916daee66a9f6fd2ab10d438b17dea53
f12e80c34d4091be75309b05d2a3e9943bc7c423
PrasadG193/kanister
/pkg/log/log.go
Go
go
5,043
permissive
package log import ( "context" "encoding/json" "os" "strings" "time" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/kanisterio/kanister/pkg/caller" "github.com/kanisterio/kanister/pkg/config" "github.com/kanisterio/kanister/pkg/field" ) // Level describes the current log level. type Leve...
11bb84c3ff06e7bde771b5a3f069b7a90248e9b4
5d2fafe5d68e33252a47410345424e835cafe3f3
mchmarny/dapr-tracing-demo
/src/subscriber/vendor/github.com/cloudevents/sdk-go/v2/binding/binary_writer.go
Go
go
1,466
permissive
package binding import ( "context" "io" "github.com/cloudevents/sdk-go/v2/binding/spec" ) // BinaryWriter is used to visit a binary Message and generate a new representation. // // Protocols that supports binary encoding should implement this interface to implement direct // binary to binary encoding and event to...
bc89faaa90996869fafeefbd217626b0df3cf51c
dcf7473f30df41cac458b343dbe392cc9b1f23c7
LaCumbancha/reviews-analysis
/cmd/nodes/prettiers/top-users/main.go
Go
go
2,323
permissive
package main import ( "fmt" "github.com/pkg/errors" "github.com/spf13/viper" "github.com/LaCumbancha/reviews-analysis/cmd/common/utils" "github.com/LaCumbancha/reviews-analysis/cmd/nodes/prettiers/top-users/core" log "github.com/sirupsen/logrus" logb "github.com/LaCumbancha/reviews-analysis/cmd/common/logger" ...
429c1cc33069c80e4b6c5f33dad86a18d1343c47
24e650476cdc58d7769feae1a6b719a9fe4087f3
hideshi/echo-sample
/utils/util.go
Go
go
551
no_license
package utils import ( "crypto/sha256" "fmt" "strconv" "time" ) func GetCurrentUnixTime() string { return strconv.Itoa(int(time.Now().Unix())) } func GetExpirationOfActivationKey(expirationOfActivationKey int64) string { return strconv.Itoa(int(time.Now().Unix() + expirationOfActivationKey)) } func GenerateAc...
3660a978cab86def9ae3f60f6bdc5beea5cbf3de
1a23b96bb67221cfc75dc14603e0ae7801dc4f83
joyal1986/go2hal
/halaws/transport.go
Go
go
772
permissive
package halaws import ( kitlog "github.com/go-kit/kit/log" kithttp "github.com/go-kit/kit/transport/http" "github.com/gorilla/mux" "github.com/weAutomateEverything/go2hal/gokit" "github.com/weAutomateEverything/go2hal/machineLearning" "net/http" ) /* MakeHandler returns a rest http handler to send alerts. The ...
03c311d1f795f414d00cbeb64101f7c37fd207a3
7f47cfd6994efa2b8d5d54a4b65f80594ee5c5d0
bvantari/PromotionServiceStateful
/PromotionsService.go
Go
go
3,498
no_license
package main import ( "encoding/json" _ "encoding/json" "fmt" "github.com/gorilla/mux" _ "github.com/gorilla/mux" gorilla "github.com/gorilla/schema" "strconv" //"github.com/json-iterator/go" "log" "net/http" _ "net/http/pprof" ) var decoder = gorilla.NewDecoder() var users map[string]User var id int typ...
9242e078b244bfc70112a581a9a6f52927ac3792
21be98e7d1a693aa690948eada58a4df8a9ec187
maguroguma/go-competitive
/contests/2021/05/20210508_ABC200/e/e.go
Go
go
6,619
permissive
/* URL: https://atcoder.jp/contests/abc200/tasks/abc200_e */ package main import ( "bufio" "errors" "fmt" "io" "math" "os" "strconv" ) var ( println = fmt.Println yes, no, invalid = "Yes", "No", -1 n, k int ) func main() { defer stdout.Flush() n, k = readi2() } /*****************************...
acb0c906cb59f5f41770c8c8ea7c76c903a5fbb2
2b7759172733ec9c9b7ea1e40fbfd43427220f67
sallyom/krew
/cmd/validate-krew-manifest/main.go
Go
go
6,514
permissive
// Copyright 2019 The Kubernetes Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ...
3f3220d358d5409710ec81784e18ff0d7123dcfa
87f415cc04c48f3882b683f9c713c20b4ca5d016
CodeOfTheKnight/Kaori
/server.go
Go
go
11,297
permissive
package main import ( "context" "fmt" "github.com/CodeOfTheKnight/Kaori/kaoriDatabase" "github.com/CodeOfTheKnight/Kaori/kaoriLog" "github.com/CodeOfTheKnight/Kaori/kaoriSettings" "github.com/CodeOfTheKnight/Kaori/kaoriUtils" "github.com/didip/tollbooth" "github.com/didip/tollbooth/limiter" logger "github.com...
df2229878d011a1084b7ef6f479824cdb8cd219d
223f43b3fceed3fa60174119f88ebf6ef2c9b509
latenssi/sprawl
/database/inmemory/memory_storage_test.go
Go
go
3,668
permissive
package inmemory import ( "testing" "github.com/sprawl/sprawl/config" "github.com/sprawl/sprawl/errors" "github.com/sprawl/sprawl/interfaces" "github.com/stretchr/testify/assert" "go.uber.org/zap" ) const testConfigPath = "../config/test" const dbPathVar = "database.path" const testID = "0" const testMessage =...
c79998f40c3bc504c25e6741f41da05bc66cadb6
9e3ab3f3806d6bc293a7eb60fa1b370f2fde006c
notestaff/dxfuse
/metadata_db.go
Go
go
46,298
permissive
package dxfuse import ( "context" "database/sql" "encoding/base64" "encoding/json" "fmt" "log" "math" "path/filepath" "os" "strings" "time" "github.com/dnanexus/dxda" ) const ( nsDirType = 1 nsDataObjType = 2 ) type MetadataDb struct { // an open handle to the database db *sql.DB dbF...
a77625799d253ee8246b4ba1726644fe1f729040
63b490ae8254d1822109a57b7ac9fdc4f30d5820
AP2008/flytectl
/cmd/get/task.go
Go
go
6,974
permissive
package get import ( "context" "github.com/flyteorg/flytectl/cmd/config" taskConfig "github.com/flyteorg/flytectl/cmd/config/subcommand/task" cmdCore "github.com/flyteorg/flytectl/cmd/core" "github.com/flyteorg/flytectl/pkg/ext" "github.com/flyteorg/flytectl/pkg/printer" "github.com/flyteorg/flyteidl/gen/pb-go...
ed88cfafc51b8d2d78a79b355469b65eee64b20b
1340c336c87f9e0e50c9f18de3b04f267830fac1
mikeshultz/wikionastick
/wikionastick.go
Go
go
4,682
permissive
/* wikionastick Markdown documentation Web server to serve documentation from a thumbdrive. */ package main import ( "os" "path" "fmt" "strings" "io/ioutil" "net/http" "path/filepath" "github.com/jessevdk/go-flags" log "github.com/sirupsen/logrus" "text/template" "github.com/a8m/mark" ) var PWD string var...
28b7ea8341e83bbf2dc8e05833cdd8d226d89d3a
78eadd98e76e5e4fb82374b0b1c4ebe9ee13f91d
tcolgate/argo
/test/e2e/functional_test.go
Go
go
4,940
permissive
package e2e import ( "strings" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/test/e2e/fixtures" "github.com/argoproj/argo/util/argo" ...
066cbe9a92ac203d4e55930b38f607424c104aff
1a0ed0b8a8c5425291ed730f70f9930cb0dfaf6e
RBSystems/atlona-event-forwarder
/server.go
Go
go
4,314
permissive
package main import ( "context" "io/ioutil" "net/http" "os" "time" "github.com/byuoitav/atlona-event-forwarder/connection" "github.com/gorilla/websocket" "github.com/labstack/echo" "github.com/byuoitav/common/db/couch" "github.com/byuoitav/common/log" "github.com/byuoitav/common/structs" ) var ( address...
9a7bf9f954a2cb2c06204764af4800c1f236f3e9
f7d2b3787e0b0ed19bb178bd675d04edc87926ce
DyingLight123/testgithub
/test/controllers/BaseController.go
Go
go
448
no_license
package controllers import ( "fmt" "github.com/astaxie/beego" ) type BaseController struct { beego.Controller //username string } func (base *BaseController) CheckLogin() { base.SetSession("username", "admin1") a := base.GetSession("username") fmt.Println(base.CruSession) if a == nil { urlstr := base.URLF...
7ff24c31a0f6aeb3a87e8d9cf44ec7d5d16e77b6
f92c334007da5093ec6e595bd715e9c2ce81d08a
sklava/sumologic-cloudfoundry-nozzle
/sumoCFFirehose/sumoLogicAppender.go
Go
go
12,878
permissive
package sumoCFFirehose import ( "bytes" "compress/gzip" "encoding/json" "errors" "fmt" "net/http" "reflect" "strconv" "strings" "time" "github.com/SumoLogic/sumologic-cloudfoundry-nozzle/eventQueue" "github.com/SumoLogic/sumologic-cloudfoundry-nozzle/events" "github.com/SumoLogic/sumologic-cloudfoundry-n...
1a7ec41f1b3b1d6e9fe661ccf314095e6536a0b0
97966dd1c42986081774a5b3da35415a8242830e
ayan-b/learning-go
/1-Basics/1-Flow-Control-Statements/1.1.02-for-is-gos-while.go
Go
go
209
permissive
/* For is Go's "while" At that point you can drop the semicolons: C's while is spelled for in Go. */ package main import "fmt" func main() { sum := 1 for sum < 1000 { sum += sum } fmt.Println(sum) }
7053d5b4974b84bb53192801a7087604a6777676
e287db15b7b6e4fc4de636093cd2c39c36e31813
CrackerCat/fuchsia
/tools/integration/fint/should_build.go
Go
go
5,232
permissive
// Copyright 2021 The Fuchsia 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 fint import ( "context" "fmt" "io/ioutil" "os" "path/filepath" "strings" "go.fuchsia.dev/fuchsia/tools/integration/fint/filetype" "go.fuc...
62824226293d82b6af4287dc5cae0f3bd2fc8b5f
470267c2322ffa105a5997a5fb6b5a759e2afe8a
isutare412/MukGo
/server/db/config.go
Go
go
336
no_license
package db // ServerConfig defines various configurations. type ServerConfig struct { // RabbitMQ connection settings RabbitMQ struct { User string Password string IP string Port int } // MongoDB connection settings MongoDB struct { User string Password string IP string Po...
222824ec3a429ee76abd59fb788cfac6dbbe9a64
ebde608b2a5627926fb685924dc615fe73615cec
risooonho/spac
/server/server/start.go
Go
go
3,132
permissive
package server import ( "fmt" "github.com/20zinnm/entity" "github.com/20zinnm/spac/common/net" "github.com/20zinnm/spac/common/world" "github.com/20zinnm/spac/server/bounding" "github.com/20zinnm/spac/server/despawning" "github.com/20zinnm/spac/server/health" "github.com/20zinnm/spac/server/movement" "github....
7dcf884e451781575c826fe5dc2d910c60e7a953
de09a5333c78c5844a4978b3c12e43b80dd635a1
SevenPlusPlus/zadig
/pkg/tool/codehub/tree.go
Go
go
1,882
permissive
/* Copyright 2021 The KodeRover 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, s...
6907b91f6924f6847800b9588b7750c42131cf2c
ef6c5338323d95c7fc61b0c88f482c52d68ba6aa
codeskyblue/wide
/output/processes.go
Go
go
2,079
permissive
package output import ( "os" "sync" "github.com/b3log/wide/session" "github.com/golang/glog" ) // Type of process set. type procs map[string][]*os.Process // Processse of all users. // // <sid, []*os.Process> var processes = procs{} // Exclusive lock. var mutex sync.Mutex // add adds the specified process to ...
7e5f86c2592ee2c798054cefbd0506be83ad834d
f928df28b320acb0d6f21d3a4efb532815ead5db
phenix-gao/badger
/levels_test.go
Go
go
34,820
permissive
/* * Copyright 2019 Dgraph Labs, Inc. and Contributors * * 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 appli...
2aba37eaa4e4cd44fe78fb4d548b2b62fe5b1cff
5bbdee7ebd9f5e917e6dd2dae7fcfd0a57dec70b
tuxgoose/test-infra
/development/tools/jobs/incubator/compass/healthchecker_test.go
Go
go
3,818
permissive
package compass_test import ( "testing" "github.com/kyma-project/test-infra/development/tools/jobs/tester" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) const healthcheckerJobPath = "./../../../../../prow/jobs/incubator/compass/components/healthchecker/healthchecker.yaml" func Tes...
238f53c223b01688a953df5f63c31b54a57acc10
d583f579f36f0347618b95f863df5a54d74041a7
alex-action/minio
/cmd/fs-v1-multipart.go
Go
go
31,182
permissive
/* * Minio Cloud Storage, (C) 2016 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
f7d6e5d325d66aa998f9b5024434f1dbed83aef8
107e31c8e2b9c39580c3106f05bc3ca920d64b99
llir/ll
/ast/factory.go
Go
go
19,745
permissive
// generated by Textmapper; DO NOT EDIT package ast import ( "fmt" "github.com/llir/ll" ) func ToLlvmNode(n *Node) LlvmNode { switch n.Type() { case ll.APINotesField: return &APINotesField{n} case ll.AShrExpr: return &AShrExpr{n} case ll.AShrInst: return &AShrInst{n} case ll.AddExpr: return &AddExpr{...
f95bcb265135f3f113bca58fef68373b2c03d4a9
0e0e4a7db47ac66441e1fbd7e6263c4477e70ab9
snyk/kin-openapi
/routers/gorillamux/router.go
Go
go
5,438
permissive
// Package gorillamux implements a router. // // It differs from the legacy router: // * it provides somewhat granular errors: "path not found", "method not allowed". // * it handles matching routes with extensions (e.g. /books/{id}.json) // * it handles path patterns with a different syntax (e.g. /params/{x}/{y}/{z:.*...
6fda5db1e0d8ddef3742be7156e1e9f68da7cf23
531258411a5776c1d3f974ac6729772f9a02e714
scholar-ink/payment
/hangpay/order_harge.go
Go
go
2,214
no_license
package hangpay import ( "encoding/json" "errors" ) type OrderCharge struct { BaseCharge } type OrderChargeConf struct { Money string `json:"money"` //交易金额 SubMerchantNo string `json:"subMerchantNo"` //子商户号 OrderNo string `json:"orderNo"` //订单号 PayType string `jso...
37ed78696120a02cb86235ce4c0511c67551711c
aabcc82ebd2db4389bd05083b18134466673f31d
nya3jp/tast-tests
/src/chromiumos/tast/remote/bundles/cros/wifi/roam_ap_gone.go
Go
go
6,745
permissive
// Copyright 2020 The Chromium OS 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 wifi import ( "context" "time" "chromiumos/tast/common/crypto/certificate" "chromiumos/tast/common/shillconst" "chromiumos/tast/common/w...
83f3c80c6b74da0808b8cb21acb790366c052a12
5984fec2d603116b346f3bc92572d0bdf94eee38
k8sp/kubernetes
/pkg/master/reconcilers/mastercount.go
Go
go
7,573
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, ...
f679b6395143d3dd07bc7c54e2bf79b8ab5d5c4c
6ee86c6455254076b777c16b359920ed20e04565
shipan3452/crawler
/zhenai/parser/city.go
Go
go
909
no_license
package parser import ( "awesomeProject/crawler/config" "awesomeProject/crawler/engine" "log" "regexp" ) var ( cityRe = `<a href="(http://album.zhenai.com/u/[0-9]+)"[^>]*?>([^<]+)</a>` cityUrlRe = regexp.MustCompile( `href="(http://www.zhenai.com/zhenghun/[^"]+)"`) ) func ParseCity(content []byte,_ string...
e1cd92e4c3cc6b7aa4825c4f605a3c2312995150
133bacc1bd694fcbbdc4ab1f61d5f565f0ef31ac
donaminos/sourcegraph
/enterprise/lib/codeintel/lsif/test/cmd/lsif-validate/internal/validation/validators_edge.go
Go
go
5,747
permissive
package validation import ( "strings" reader "github.com/sourcegraph/sourcegraph/enterprise/lib/codeintel/lsif/protocol/reader" reader2 "github.com/sourcegraph/sourcegraph/enterprise/lib/codeintel/lsif/test/internal/reader" ) // validateContainsEdge ensures that a range edge attaches a document to a set of range...
dc66c5c2f7f01bdf1be8465a042b2c0ab6b2af56
0d39cba7cc3f72e1027a8da73f32d37c1c4041e9
nooras/GoLang
/src/github.com/nooras/firstapp/section1/anonymouslambda.go
Go
go
409
no_license
package main import ( "fmt" "sync" ) func main(){ // func(){ // fmt.Println("Hello") // }() // func(){ // fmt.Println("World") // }() // fmt.Println("!!") //wait groups wg := &sync.WaitGroup{} //add , done and wait //mutexes wg.Add(2) go func(){ fmt.Println("Hello") wg.Done() }() go func(){ ...
7b83443628c978df9d40fc47a671e9a78a689a57
13beff149f8c53c2daebd64d8377ed6a810c57b4
tmaczukin/doctl
/commands/commands_test.go
Go
go
9,701
permissive
/* Copyright 2018 The Doctl 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 applicable law or agreed to ...
636d1555549b89b7851cdaa14840bd9d1421c449
a8ee33f71c74b88b76efd2f3927d75979fc85ddf
alisdairrankine/turner
/random-points.go
Go
go
456
no_license
package turner import ( "math/rand" ) func RandomPointInUnitSphere() Vec3 { p := Vec3{} for { p = Vec3{rand.Float64(), rand.Float64(), rand.Float64()}.MultiplyScalar(2).Minus(Vec3{1, 1, 1}) if p.SquaredLength() < 1 { break } } return p } func RandomPointInUnitDisc() Vec3 { p := Vec3{} for { p = Vec...
8fc77af98cdd8174c0ed711adbb65bd262860fb4
a866df60128b832205c68e4ba0bcac5ce6d2c2df
E1101/LearningGolang
/105_samples_and_techniques/_samples/pulls different data feeds from the web/search/feed.go
Go
go
732
permissive
package search import ( "encoding/json" "os" ) const dataFile = "data/data.json" // Feed contains information we need to process a feed. type Feed struct { Name string `json:"site"` URI string `json:"link"` Type string `json:"type"` } // RetrieveFeeds reads and unmarshals the feed data file. func RetrieveFeed...
59fce8a7fac96049a08f621ddfb619bf96866fa5
0a7722e539dcc3639170f7d3597e3396128258ee
GambuzX/learning-go
/API/simple_api.go
Go
go
598
no_license
package main import ( "log" "net/http" ) func apiResponse(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") switch r.Method { case "GET": w.WriteHeader(http.StatusOK) w.Write([]byte(`{"message" : "GET method requested"}`)) case "POST": w.WriteHeader(http.StatusO...
b8e8797161247469b40e508b8b3e8c50592ae540
6c42a5256efdf8b26c237e2af9aff49673ac8571
usnistgov/dastard
/ringbuffer/ringbuffer.go
Go
go
8,037
permissive
package ringbuffer import ( "fmt" "os" "syscall" "time" "unsafe" "github.com/fabiokung/shm" ) type bufferDescription struct { magic uint32 version uint32 writePointer uint64 readPointer uint64 bufferSize uint64 packetSize int64 } // RingBuffer describes the shared-memory ring buffer fil...
63eff0f463bad1974375876d017a659a5a3cc4ca
8a2d8ea7de294b122369bf1d2b260e3754d8a921
18814110859/goProject
/func1/main.go
Go
go
463
no_license
package main import "fmt" type MyStruct struct { i int j int } // 传递struct指针时,会拷贝struct指针 然后分配一个新的内存 来 存储这个指针 func myFunction(b *MyStruct) { b.i = 41 b.j = 31 fmt.Printf("in my_function - b=(%v, %p, %p)\n", b, b, &b) } func main() { b := &MyStruct{i: 40, j: 30} fmt.Printf("before calling - b=(%v, %p, %p)\n",...
8c79facc6ce44d6fed0c1ad2f6841173c8e6991d
b6efc9c6bd08bf84e3d24132069da8f65d22b64f
whoisashok/xendit
/xendit_services/errors.go
Go
go
4,056
no_license
package paymentservice import "errors" var ( // ErrBadRouting is returned when an expected path variable is missing. ErrBadRouting = errors.New("inconsistent mapping between route and handler") ErrRequiredNewPassword = errors.New("Required new password") ErrRequiredConfirmedPassword = errors....
2b3072e22ceb13dd9db15fb3292b14277a30f233
880f7389dd31a46996739661a76912ddc04d35c4
jonsen/bhyveapi
/src/manager.go
Go
go
2,316
permissive
// Copyright 2014, Jonsen Yang. 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 import ( "encoding/json" "fmt" "github.com/go-martini/martini" "github.com/martini-contrib/render" "net/http" ) type vmInfo struct { Name ...
1b66783c338f72aa81a73cb28aa4c7d2fba38890
9a2f3ce5d595e534e5b76f799fbcff8bafaaf25c
cnorton-webdev/xTeVe
/src/internal/imgcache/cache.go
Go
go
3,246
permissive
package imgcache import ( "fmt" "io" "io/ioutil" "net/http" "net/url" "os" "path/filepath" "strings" "sync" ) // Cache : Cache strcut type Cache struct { path string cacheURL string caching bool images map[string]string Queue []string Cache []string Image imageFunc sy...
682ac25489f8ed4cede45e7945814b58e021f7dd
9ad03b79cf455fa04f6804264bcec928ae470840
lsw45/go_practice
/example/context/base_method_test.go
Go
go
3,309
no_license
// Copyright 2016 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 context_test import ( "context" "fmt" "net" "testing" "time" ) func TestDeadlineExceededIsNetError(t *testing.T) { err, ok := context.DeadlineEx...