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
39577599d8654d67da1af6d71004bf72a112cde4
6c487bf487f63f1b72041c650ebfe813e7085950
ninefive/opms
/models/users/positions.go
Go
go
2,890
no_license
package users import ( "fmt" "github.com/ninefive/opms/models" "github.com/ninefive/opms/utils" "github.com/astaxie/beego" "github.com/astaxie/beego/orm" ) type Positions struct { Id int64 `orm:"pk;column(positionid);"` Name string Desc string Status int } func (this *Positions) TableName() string ...
6780098ef194a39366a1cad274a04b3c66be2b30
00c5c3318f7a644f7ce244df784f2dd2bdee1070
Deckhandfirststar01/kubernetes
/pkg/volume/iscsi/iscsi.go
Go
go
5,171
permissive
/* Copyright 2015 The Kubernetes 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 ag...
ab6af3771e78a177812b5e309621bd2730132591
fdb7d056ad2f7e054e7d4e1c6dbcf2e14a67ed68
caseyding/kubernetes
/test/e2e/util.go
Go
go
4,679
permissive
/* Copyright 2014 Google 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 ...
5fd2ca096a7876050051ab06d101cecf64c0a568
219f4c58b239ad579f35e87bd89fe31478725eca
kallewoof/lnd
/fundingmanager.go
Go
go
125,879
permissive
package lnd import ( "bytes" "encoding/binary" "fmt" "sync" "time" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/davecgh/go-spew/spew" "github.com/go-errors/errors...
507439793b9b2f4d014588c9afe59a3127829012
8f3205eb68a3519f7df6c262037a92127a9452f8
ashatch/adventofcode2019
/day04-part1/plib/elfpass.go
Go
go
1,063
no_license
package plib import ( "fmt" "strconv" ) func PasswordToDigitSequence(pass int) []int { str := fmt.Sprintf("%d", pass) sequence := []int{} for _, c := range str { cstr, _ := strconv.Atoi(string(c)) sequence = append(sequence, cstr) } return sequence } func HasTwoAdjacentDigits(sequence []int) bool { seq...
ea0a81ab927882a515d03d93d1370d34e5f16315
f6a3c208592d6aeaf04b64356fdaabcba9880216
rexfordcode/codefights
/challenge/betterOrderTraversal.go
Go
go
3,224
no_license
/* There are several ways to traverse a binary tree. Let's talk about some of the most popular ways! In-order traversal involves looking at the left subtree, then the current node, then the right subtree. This will visit the values of a binary search tree in ascending order. Pre-order traversal involves looking at th...
2b3721c3dac334cae6a487a48bf253eb4d00ee29
411d71eedb24e57750e84037d8fdb8fcfd683494
mdnasirhossain/master_academy
/Template/main.go
Go
go
2,422
no_license
package main import ( "database/sql" "fmt" "net/http" "text/template" _ "github.com/go-sql-driver/mysql" ) var db *sql.DB var err error func init() { // Open up our database connection. // I've set up a database on my local machine using phpmyadmin. // The database is called testDb db, err = sql.Open("mys...
ff6d5f30bc9e3f51f5837c528ed3a0221aa75bab
d6457536c9e2e1868ec7c436323bf62686f76606
TachibanaGin/-KubeOperatorDemoCrdEnd
/controller/get.go
Go
go
3,449
no_license
package controller import ( client_go "Crd-End/client-go" "Crd-End/redis" "context" "encoding/json" "fmt" "github.com/gin-gonic/gin" Z "github.com/go-redis/redis/v7" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "math" "strconv" "time" ) func GetFrontLis_Bak(c *gin.Context) { redisKey := "frontList" pa...
9661c3e1a6986193e68da3a4e8d49659765bcba2
e67e6ce7efbb7b16f817e463b8d664d6773afb9a
Lawrence-git/Hello-Go
/gopl/ch1/dup2.go
Go
go
571
no_license
package main import ( "bufio" "fmt" "os" ) func dup2Main() { counts := make(map[string]int) files := os.Args[1:] if len(files) == 0 { countLines(os.Stdin, counts) } else { for _, v := range files { f, err := os.Open(v) if err != nil { fmt.Fprintf(os.Stderr, "dup2:%v\n", err) } countLines(f,...
9b92c970b448915500ca49bc1947f9e8df105d4b
7b9e1f922211cb2c81fdc2270d2944b7eed244b8
kinvolk/cilium
/cilium/cmd/policy_delete.go
Go
go
1,505
permissive
// Copyright 2017 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 ...
8b6033805215b0efad481f615d6504a3418062b8
6cc56ee3fe745fc53e16d708ee850bfbe216d83c
xcoulon/toolchain-operator
/pkg/controller/cheinstallation/cheinstallation_controller.go
Go
go
9,343
permissive
package cheinstallation import ( "context" toolchainv1alpha1 "github.com/codeready-toolchain/api/pkg/apis/toolchain/v1alpha1" "github.com/codeready-toolchain/toolchain-common/pkg/condition" "github.com/codeready-toolchain/toolchain-operator/pkg/apis/toolchain/v1alpha1" "github.com/codeready-toolchain/toolchain-o...
63155c50e4f0468510ce3d9d58e7b2e8f5ff6fcb
855523b7fd2e094b7fc577da5743253999e8c597
karuppiah7890/tanzu-framework
/cmd/managers/featuregate/main.go
Go
go
2,164
permissive
// Copyright 2021 VMware, Inc. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package main import ( "flag" "os" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" k8sscheme "k8s.io/client-go/kubernetes/scheme" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/co...
f4f39bbff7490cc6a18617e158f2b255f5b3576c
c20ee88eabd74fbd47646f81afd2d107d69a3cfc
Tacks9/go_code_practice
/chapter_6_struct_method/02_creates-an-instance-of-a-structure-using-a-factory-method.go
Go
go
2,594
no_license
package main import ( "fmt" "unsafe" "./matrix" ) /* 结构体 如果 File 是一个结构体类型,那么表达式 new(File) 和 &File{} 是等价的 */ type File struct { fd int // 文件描述符 name string // 文件名称 } /* 结构体工厂 工厂实例化了类型的一个对象 */ func NewFile(fd int, name string) *File { if fd < 0 { return nil } return &File{fd, name} } func main() { ...
4123906a622b8d5f7ef441cffb877f9fb4f9570d
163b2cdfec082c91989c642f2cbbf0a256a3d3fb
rodriguesdossantosvincent/loginsrv
/httpupstream/backend.go
Go
go
2,073
permissive
package httpupstream import ( "errors" "fmt" "net/url" "strconv" "time" "github.com/rodriguesdossantosvincent/loginsrv/login" "github.com/rodriguesdossantosvincent/loginsrv/model" ) // ProviderName const const ProviderName = "httpupstream" const defaultTimeout = time.Minute func init() { login.RegisterProv...
6f77935df1f073d5162d55d4f0452c8d9f421eab
65366a09b417c6d33c327ee2ff3659af29f2b9b5
jbelmont/triangle-devops-ignite-talk-reverse-engineering
/hammingDistance/hammingDistance_test.go
Go
go
755
permissive
package hammingDistance import "testing" func TestHammingDistance(t *testing.T) { dst, err := hammingDistance("x", "xx") if dst != 0 && err.Error() != "Strings must of the same length" { t.Error("distance should be zero and should receive an error when strings are of different length") } dist, err := hammingDi...
5139ed2bd6b43135d9eeb6c7f3ad680085060afd
ea353a88044e852125907f7d0b40148de250c96c
pelsmicode/QuejasBackend
/service/deparment_service.go
Go
go
684
no_license
package service import ( "github.com/pelsmicode/QuejasBackend/model" "github.com/pelsmicode/QuejasBackend/repository" ) type DepartmentService interface { GetDeparments() ([]model.Department, error) GetDeparmentByID(id int) (model.Department, error) } type DefaultDepartmentService struct { R repository.Departme...
32bd09577b8ce732b383b7077a28a9a40fdf45c1
0e121933ba549fa2fcc01bc24b2ebfbff7cb45cf
DanielChuDC/capsule
/e2e/enable_node_ports_test.go
Go
go
1,726
permissive
//+build e2e // Copyright 2020-2021 Clastix Labs // SPDX-License-Identifier: Apache-2.0 package e2e import ( "context" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" capsulev1beta1 "github....
788f818352fb8a80439c0f2e425b39bc939d03f3
807d99faddb29bbfc06a1ddc669cab814834b6fe
vinesnts/URI-questions
/1911/1911.go
Go
go
921
no_license
package main import ( "fmt" ) type Aluno struct { nome, assinatura string } func main() { var n int fmt.Scan(&n) for n != 0 { var alunos []Aluno for i := 0; i < n; i++ { var aluno Aluno fmt.Scan(&aluno.nome, &aluno.assinatura) alunos = append(alunos, aluno) } var m int ...
e19322566664e7e6b8e2c9ddf8d9307b99973fc1
82633eb1baa58decad332399e108091935316dcb
vladiskuz/magma
/symphony/graph/ent/equipmentport/equipmentport.go
Go
go
4,245
permissive
// Copyright (c) 2004-present Facebook All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code generated (@generated) by entc, DO NOT EDIT. package equipmentport import ( "time" "github.com/facebookincubator/ent" "github.com/facebookinc...
73de94bc72116bd296c9300d94b06007e98f65b8
b043f62a2662714575ec7dbabcef808852e05622
ALTA-BE-Capstone-Project/berbagi
/models/serviceCart.go
Go
go
1,263
no_license
package models import ( "time" "gorm.io/gorm" ) type ServiceCart struct { VolunteerID uint `json:"volunteer_id"` UserID uint `json:"recipient_id" form:"recipient_id"` AddressID uint `gorm:"not null" json:"recipient_address_id" form:"recipient_address_id"` StartDate time.T...
5686ae42592e12880ddee1303a741350c9d5b663
003da4608a9dfaef09357da6480a8a922939b992
Unixeno/gootprint
/frame/for.go
Go
go
706
permissive
package frame import ( "bytes" ) type ForFrame struct { *baseFrame varName string } func NewForFrame(path string) *ForFrame { return &ForFrame{baseFrame: NewBaseFrame(path)} } func (frame *ForFrame) GenBeginning(genEnv *baseEnv, content []byte) []byte { return content } func (frame *ForFrame) GenEnding(genEnv...
2dfae9d04392d1db37422ace7ae9d31c7b40d499
c38a262dc637add32eb280a63832c5341d2afa80
grafana/plugin-validator
/pkg/analysis/passes/gosec/types.go
Go
go
503
permissive
package gosec type Issue struct { Severity string `json:"severity"` Confidence string `json:"confidence"` RuleID string `json:"rule_id"` Details string `json:"details"` File string `json:"file"` Code string `json:"code"` Line string `json:"line"` } type Stats struct { Files int `jso...
ed0f0247567bb93c2e34508ba1691429958548c8
ebd0dd7519bf9180310158520a312ee32d2aad85
sapcc/kubernetes-operators
/openstack-seeder/vendor/k8s.io/kubernetes/pkg/volume/azure_dd/azure_mounter.go
Go
go
6,634
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, ...
3c6303319df120e1fa8378ee0a7af27eb8b1ebad
619e25d3dfa0db1f9951b13ba642e56b296041ca
jnemeiksis/ceph-api
/api/api.go
Go
go
3,848
no_license
package api import ( "encoding/json" "io/ioutil" "log" "net/http" "time" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/signer/v4" ) // Buckets array type Buckets []string // Bucketstats - bucket stats json structure type Bucketstats struct { Bucket string `json:"bucket"` Num...
05e4b0233e1f88e1ca747da972cf48a30c46e648
f2fa97c6865a8bafef8bc4a05beaf8ae1d33943c
conradoqg/cachet-monitor
/monitor.go
Go
go
13,358
permissive
package cachet import ( "sync" "time" "strconv" "os/exec" "github.com/Sirupsen/logrus" ) const DefaultInterval = time.Second * 60 const DefaultTimeout = time.Second const DefaultTimeFormat = "15:04:05 Jan 2 MST" const DefaultHistorySize = 10 type MonitorInterface interface { ClockStart(*CachetMonitor, Monitor...
eead32584db7a45a27982031b0cb2444ce36666d
0b7b817c38ed28a4cd7e88a61c75bec016d0308c
andresftb/google-api-go-client
/binaryauthorization/v1beta1/binaryauthorization-gen.go
Go
go
137,202
permissive
// Copyright 2021 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 binaryauthorization provides access to the Binary Authorization API. // // For product documentation, see: https://cloud.google.com/bina...
7e8c679e7199e868f39628191237c3d88cd4b3ac
ca809e93fbb29cd9602f3c41195304787ca02859
Daniel-Alderman77/go-cloud-functions-talk
/pubsub/fn.go
Go
go
299
permissive
package pubsub import ( "context" "log" ) // Message is the payload of a Pub/Sub event type Message struct { Data []byte `json:"data"` } // PrintMessage consumes a Pub/Sub and prints message. func PrintMessage(ctx context.Context, m Message) error { log.Println(string(m.Data)) return nil }
6d9ac06fbf12484006a9aecf806cdb1c85657614
52656936f05141ee0b823d15ed1af9023143448e
AndreasBurger/gardener
/pkg/apis/extensions/validation/containerruntime_test.go
Go
go
4,471
permissive
// Copyright 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License....
e8941da2f39a9e4d316ae90abdc04f76c07da739
18fd46982973befb6cf644ad08cf778a22aa7523
Azure/azure-sdk-for-go
/sdk/data/aztables/zt_table_recorded_tests.go
Go
go
3,742
permissive
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package aztables import ( "context" "encoding/json" "fmt" "testing" "time" "github.com/stretchr/testify/require" ) type endpointType string const ( storageEndpoint endpointType = "storage" cosmosEndpoint endpoi...
da521d63d6e3975781993b6b8f0dfd45ba122490
2c3a94f3092d8771e53055c79319cb13e135a589
petermlm/RiftForum
/src/youtube.go
Go
go
1,326
permissive
package main import ( "errors" "fmt" "net/url" "regexp" ) func youtube_videos_list(topic *Topic) string { yt_links := get_youtube_links_from_topic(topic) return make_bbcode_list_youtube(yt_links) } func get_youtube_links_from_topic(topic *Topic) map[string]bool { yt_links := make(map[string]bool) re := regex...
3f3c0ecc4a36b09e9947620e2e628feb7401888c
71aed0f253e68bf2bee7fecfd5a841ce19c96c66
gernest/yukio
/pkg/events/events.go
Go
go
2,138
permissive
package events import ( "context" "regexp" "strconv" "github.com/gernest/yukio/pkg/models" "github.com/prometheus/client_golang/prometheus" ) const ( Domain = "domain" Referer = "referer" Path = "path" EventName = "name" EntryPage = "entry_page" ExitPage = "exit_page" UserID = "user_id" Se...
deb4c5a3dea69cd5260380e6aef15b080d58095f
c88740c0d6e9e2d5ffbb799d60de20dc51bd15ef
Pestdoktor/dendrite
/currentstateserver/api/wrapper.go
Go
go
3,320
permissive
package api import ( "context" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/util" ) // GetEvent returns the current state event in the room or nil. func GetEvent(ctx context.Context, stateAPI CurrentStateInternalAPI, roomID string, tuple gomatrixserverlib.StateKeyTuple) *gomatrixserverlib.Head...
c26f9cf853e011e0e7fa9f39d7b665682a246e58
d25110e1d20a1623bef22a250ad0719a8762704d
sjhitchner/trackly
/infrastructure/rest/rest.go
Go
go
3,087
permissive
package rest import ( "bytes" "encoding/json" "errors" "fmt" "log" "net/http" "os" "os/signal" "runtime" "syscall" "time" ) const ( HeaderContentType = "Content-Type" ContentTypeJSON = "application/json" ) type Response struct { Status int `json:"status"` Version string `json:"versio...
6bae761803889b5be9f1e5c863936d3120071aa7
067e507c20f0a8f17cb0d34528756fe2dda6c097
hugmatj/oci-go-sdk
/applicationmigration/source.go
Go
go
5,080
permissive
// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. // This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei...
1dd507a420cb4bba6372ba8261b4bca9de82f8ee
2d00a6ce59ef4bad4c204f130657def8bcde2b7b
GourmetArt/trillian
/log/sequencer.go
Go
go
18,715
permissive
// Copyright 2016 Google 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...
ab7814c67a55213c8c08130d94c2d4f0519ac66b
3ad251df26d223e7ef5af292403b65e243bd25f4
graup/aergo
/syncer/hashfetcher.go
Go
go
6,333
permissive
package syncer import ( "sync" "time" "github.com/aergoio/aergo/internal/enc" "github.com/aergoio/aergo/message" "github.com/aergoio/aergo/pkg/component" "github.com/aergoio/aergo/types" "github.com/pkg/errors" ) type HashFetcher struct { compRequester component.IComponentRequester //for communicate with oth...
c55ab347366998973f3f792f2fa5afdda258f4bc
d403fd14b5c63d23b13f881a4b6f807068edfe52
ioito/onecloud
/pkg/notify/tasks/verification_send_task.go
Go
go
4,042
permissive
// Copyright 2019 Yunion // // 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 writi...
6ffd46369412a7f85ffc6e4fb282c784007b2b6a
3cfcbc6cb007e0a0635d02cb46573027e88cf890
devonartis/kubernetes
/pkg/controller/node/controller_utils.go
Go
go
10,111
permissive
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
1124f8e91021121f89a94e303c3bfee45c58afcb
4323c66b0612286238a9c72fa479d8dc343ed359
lawensong/kubernetes
/pkg/kubectl/history.go
Go
go
12,319
permissive
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
94f94f456b640a737cb507fa7fba0582c65483f8
085d233f1be1b3e96a99e9cd1cdbe07ffa659d8e
sacharya/assisted-service
/pkg/s3wrapper/util.go
Go
go
6,119
permissive
package s3wrapper import ( "bytes" "context" "encoding/json" "io" "io/ioutil" "net/http" "net/url" "os" "strings" "github.com/openshift/assisted-service/internal/isoeditor" "github.com/openshift/assisted-service/internal/isoutil" "github.com/pkg/errors" "github.com/prometheus/common/log" "github.com/sir...
eb3c066c5ce898eb1976dcd17ae1178ed82a5cb2
39eb66d3f9eafafd07bde266d115b4539fb780ac
mcduan/identity-toolkit-go-client
/gitkit/gitkit.go
Go
go
12,980
permissive
// Copyright 2014 Google 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...
469b9610cffff846018b9692cfd9f9963a37caa8
8a338f0ba6a56a852aa70c3af93784ffd2a21e89
lchia/boringssl
/ssl/test/runner/handshake_messages.go
Go
go
54,904
permissive
// Copyright 2009 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 runner import ( "bytes" "encoding/binary" ) func writeLen(buf []byte, v, size int) { for i := 0; i < size; i++ { buf[size-i-1] = byte(v) v >>= ...
4a5490728b6111533d668d39afa82ac450b747d7
d11d726823c24d4f0d718921838c8dea0cac154a
artas728/VictoriaMetrics
/app/vmalert/main.go
Go
go
8,570
permissive
package main import ( "context" "flag" "fmt" "net/url" "os" "strconv" "strings" "time" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/config" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/datasource" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier" "github.com/VictoriaM...
8fecc5756ff668c5bd4a7ea25481388e680be1b3
1de6040efd9f545669ea09c50ec5d94f3707bfa7
Azure/azure-kusto-go
/kusto/utils/once_test.go
Go
go
2,110
permissive
package utils import ( "errors" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func Test(t *testing.T) { t.Parallel() tests := []struct { name string withInit bool failOnce bool err error }{ { name: "Test Success", withInit: false, }, { ...
87bd5a119f83a830e953334f260404ce20385d23
2fc6b73ace98dc7ae402f7c5f5b4f68dae02f645
iBakuman/hanime
/cmd/utils/types.go
Go
go
990
permissive
package utils type Video struct { HentaiVideo HentaiVideo `json:"hentai_video"` VideosManifest VideosManifest `json:"videos_manifest"` StreamIndex int OutputPath string } type HentaiVideo struct { Name string `json:"name"` Slug string `json:"slug"` Description string `json:"...
03612b003db0bff64e38627b6fd10065ee0865b5
9b22da446056ca7ed204860a40226d7084c3416c
wwjiang007/go-taireum
/cmd/puppeth/wizard_node.go
Go
go
6,342
permissive
// Copyright 2017 The go-ethereum Authors // This file is part of go-ethereum. // // go-ethereum is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
3b86ff7feb0562763be8908796d976afb5d9bd59
b20b0813440387b725187e6af494fc9302ecdc8f
MarkusTeufelberger/ripple
/data/signing.go
Go
go
1,046
permissive
package data import ( "fmt" "github.com/donovanhide/ripple/crypto" ) func CheckSignature(h Hashable) (bool, error) { switch v := h.(type) { case *Validation: if err := NewEncoder().Validation(v, true); err != nil { return false, err } return crypto.Verify(v.SigningPubKey.Bytes(), v.Signature.Bytes(), v.H...
061b31a88ee8900ee4baa435828ac56aefcb91e8
65eeb3ab4cc6f2bf70b28429085cff5f21b3df76
adnanbrq/nanoleaf-go
/authentication.go
Go
go
1,344
no_license
package nanoleaf import ( "encoding/json" "fmt" "net/http" ) // NanoAuth authorization type NanoAuth struct { nano *Nanoleaf } // addUserResponse mimics the response when adding a new user type addUserResponse struct { Token string `json:"auth_token"` } // newNanoAuth returns a new instance of NanoAuth func ne...
0822ec530ba939c9acb50a2c08d793da047d2ecd
9d0b24e533df72f71ecbb24b9465d213a64bcc3d
go-playground/locales
/mas_KE/mas_KE_test.go
Go
go
18,772
permissive
package mas_KE import ( "testing" "time" "github.com/go-playground/locales" "github.com/go-playground/locales/currency" ) func TestLocale(t *testing.T) { trans := New() expected := "mas_KE" if trans.Locale() != expected { t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale()) } } func TestPluralsR...
688864e5483caa8b7b1eead07d100da70b3b5766
ba2aaef3d5a796460093aba699a04dceb7c0cbe0
jsvensson/adventofcode
/2018/day02-b/main.go
Go
go
1,256
no_license
package main import ( "fmt" "time" "github.com/jsvensson/adventofcode/2018/utils" ) const data = "../data/02.txt" func main() { start := time.Now() ch := make(chan string) go utils.ReadLines(data, ch) fmt.Printf("Common: %s (%s)", solve(ch), time.Since(start)) } func solve(input <-chan string) string { ids...
1d9f0bd93fc2e55e7c3aeca5d74e806fffb82ead
e5be4837838d889a725836e4594094129c313ee7
waldofx/gamePrice-API
/controllers/sellers/response/sellers.go
Go
go
670
no_license
package response import ( "gameprice-api/business/sellers" "time" ) type Sellers struct { ID int `json:"id"` Name string `json:"name"` URL string `json:"url"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } func FromDomain(domain sellers.Domain) Sellers { ...
eee61d5491001d81ae2e766bf26f2d6270267eb0
a4c978b7ce582d7580ede6352a0cb20f09a0a5ad
philbrookes/origin
/pkg/cmd/server/api/types.go
Go
go
15,312
permissive
package api import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" "github.com/GoogleCloudPlatform/kubernetes/pkg/util" ) // NodeConfig is the fully specified config starting an OpenShift node type NodeConfig struct { api.TypeMeta // NodeName is the ...
5735fff0f0117359aacdce3af3c7666b187d53da
f2b0cc0faf357a8edce7cd66491de50750ecd610
mengning/docker
/integration-cli/docker_api_swarm_test.go
Go
go
30,268
permissive
// +build !windows package main import ( "fmt" "net/http" "os" "path/filepath" "strconv" "strings" "sync" "syscall" "time" "github.com/docker/docker/pkg/integration/checker" "github.com/docker/engine-api/types/swarm" "github.com/go-check/check" ) var defaultReconciliationTimeout = 30 * time.Second func...
d8e96da6491083df8003b7990cecbc5fc2dfadc6
541adfb7bd7d09dd719dc24921da8faacf07118a
ZonghaoWang/gotch
/example/debug-memory/cpu.go
Go
go
3,096
permissive
package main // helper to debug memory blow-up import ( "sync" "syscall" "time" ) // Go-ized http://man7.org/linux/man-pages/man2/sysinfo.2.html type SI struct { Uptime time.Duration // time since boot Loads [3]float64 // 1, 5, and 15 minute load averages, see e.g. UPTIME(1) Procs uint64...
6aa618ac9ac8395a819aca1fffdf4a7b4d19c36d
d842c04eac05c890343b30e47b7977c42519b559
DanielAtella/terraform-provider-thunder
/thunder/resource_thunder_slb_ssl_forward_proxy_test.go
Go
go
674
permissive
package thunder import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) var TEST_SLB_SSL_FORWARD_PROXY_RESOURCE = ` resource "thunder_slb_ssl_forward_proxy" "SSLForwardProxy" { sampling_enable { counters1 = "all" } } ` //Acceptance test func TestAccSlbSSLForwardProxy_create(t *t...
36ed99383bb1aa1e0788861440faee2dfd787e90
870f38e658b24a6085592cda2bde17827d21fe6f
iwilltry42/types
/apis/management.cattle.io/v3public/zz_generated_k8s_client.go
Go
go
1,614
permissive
package v3public import ( "context" "sync" "github.com/rancher/norman/controller" "github.com/rancher/norman/objectclient" "github.com/rancher/norman/objectclient/dynamic" "github.com/rancher/norman/restwatch" "k8s.io/client-go/rest" ) type Interface interface { RESTClient() rest.Interface controller.Starte...
1c66520a8253e199afa99543d67f84598e9b4d45
3468371bd71b300c1381f99ea9efa9867ae29431
dcxcn/gf-vue-admin
/server/router/workflow.go
Go
go
385
permissive
package router import ( v1 "server/app/api/v1" "server/app/middleware" "github.com/gogf/gf/frame/g" ) // InitWorkflowRouter 注册功能api路由 func InitWorkflowRouter() { WorkflowRouter := g.Server().Group("workflow").Middleware(middleware.JwtAuth).Middleware(middleware.CasbinMiddleware) { WorkflowRouter.POST("createW...
6521b4573f10db2bb144698ab1480a739e0ebd04
15d5372f1e9cd2c47e36e949278c4deac40cab19
ericdeshayes/quickfix
/fix50sp1/crossordercancelreplacerequest/CrossOrderCancelReplaceRequest.go
Go
go
10,863
permissive
//Package crossordercancelreplacerequest msg type = t. package crossordercancelreplacerequest import ( "github.com/quickfixgo/quickfix" "github.com/quickfixgo/quickfix/enum" "github.com/quickfixgo/quickfix/fix50sp1/discretioninstructions" "github.com/quickfixgo/quickfix/fix50sp1/displayinstruction" "github.com/qu...
42b5ea33ce058e66358032cf2cb5fa2780191fbe
c644e4db7cdecb1ca93fec55f4509e305406ff15
benburkert/openpgp
/packet/symmetric_key_encrypted_test.go
Go
go
2,651
no_license
// Copyright 2011 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 packet import ( "bytes" "encoding/hex" "io" "io/ioutil" "testing" "github.com/benburkert/openpgp/algorithm" ) func TestSymmetricKeyEncrypted(t ...
0b165513c0f4a6e4bf01461f05228e7a68acd509
e66c588b18de6ff9c66d87715e6f5e2f953899c9
haishuangsu/iris
/websocket.go
Go
go
4,561
permissive
package iris import ( "github.com/iris-contrib/logger" irisWebsocket "github.com/iris-contrib/websocket" "github.com/kataras/go-websocket" "github.com/kataras/iris/config" ) // --------------------------------------------------------------------------------------------------------- // ----------------------------...
71599eb1d28479eaefc82076cfa1c6c33026d68a
f39499898c922ccbd5c47381ebcc53ccc3086989
jamct/traefik
/pkg/config/file/raw_node.go
Go
go
3,299
permissive
package file import ( "reflect" "sort" "strconv" "strings" "github.com/containous/traefik/pkg/config/parser" ) func decodeRawToNode(data map[string]interface{}, rootName string, filters ...string) (*parser.Node, error) { root := &parser.Node{ Name: rootName, } vData := reflect.ValueOf(data) decodeRaw(roo...
a38d08e9bbd660cb296fce05bde205c5568fc237
88a2a85595c3091611a3092157f17fcbe2d54ecb
balena-os/balena-engine
/layer/filestore_unix.go
Go
go
395
permissive
//go:build !windows // +build !windows package layer // import "github.com/docker/docker/layer" import "runtime" // setOS writes the "os" file to the layer filestore func (fm *fileMetadataTransaction) setOS(os string) error { return nil } // getOS reads the "os" file from the layer filestore func (fms *fileMetadat...
b51232e24b24cca68b9efdd473e3026754e290ab
4e6f78572494f495a9ee50ab1ad7e640fddc490b
MayaCodemanager/go-maya
/les/randselect.go
Go
go
5,331
no_license
// Copyright 2016 The go-maya Authors // This file is part of the go-maya library. // // The go-maya library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at ...
6802b40f19599ed744402f1d27be6be93bc30aff
91ad726ae3b706e0b86355f072e29a27149242ef
naokiiiii/keycloak-proxy
/doc.go
Go
go
24,543
permissive
/* Copyright 2015 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 writing, soft...
da652bf51a6defd777f4432d58098c216082c6c1
27efaedd05cab3c49869d4fb87ca57b36a5671a4
iandanarko/grpc-sample
/server/main.go
Go
go
341
no_license
package main import ( "log" "net" pb "github.com/iandanarko/grpc-sample/proto" "google.golang.org/grpc" ) const ( port = ":3000" ) func main() { lis, _ := net.Listen("tcp", port) s := grpc.NewServer() pb.RegisterProductInfoServer(s, &server{}) if err := s.Serve(lis); err != nil { log.Fatalf("failed to s...
faa917efb9e7f7c79aff86b55eb615696a9e41f7
20221c328407c75c20194fbb3ab6efe70e2ebf1a
nghialv/promviz
/cmd/k8s-config-reloader/vendor/golang.org/x/net/html/token_test.go
Go
go
14,635
permissive
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package html import ( "bytes" "io" "io/ioutil" "reflect" "runtime" "strings" "testing" ) type tokenTest struct { // A short description of the test ca...
7d99bf438f8753811f81a2fb14c8a092e5e8a8bc
9cb84e0a88d081b869ec5f8e41bbf3bcf0bedb6e
adrianpastore/miniCursoGo
/aplicacaoWEB7/main.go
Go
go
2,983
no_license
package main import ( "fmt" "log" "net/http" "regexp" "strconv" "text/template" pacoteContatos "github.com/hallanneves/miniCursoGo/aplicacaoWEB7/contatos" ) var contatos []pacoteContatos.Contato var templates = template.Must(template.ParseFiles("novo.html", "lista.html")) var validPath = regexp.MustCompile(...
ee0b8bdad1c313be1e1ad0bcdb5cece6d2a515cc
0c1822f762c19da09cb54be471d5955e541ffd8b
jltournay/databricks-sdk-golang
/aws/jobs.go
Go
go
6,726
permissive
package aws import ( "encoding/json" "net/http" "github.com/jltournay/databricks-sdk-golang/aws/models" ) // JobsAPI exposes Jobs API endpoints type JobsAPI struct { Client DBClient } func (a JobsAPI) init(client DBClient) JobsAPI { a.Client = client return a } // Create creates a new job func (a JobsAPI) Cr...
3fd8bc9e8e95afc970c269d3dcb51ff4ec1d2388
f33479c24a0975f583057da486ab6e60d02f1331
huangzisheng/etcd
/proxy/grpcproxy/util.go
Go
go
2,335
permissive
// Copyright 2017 The etcd Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
6f43f33ed892f677ccc6411ee15484c9ed4069c0
60837e4448844d51bce40442f23fb0da38366c6a
szark/logrus2
/writer_test.go
Go
go
656
permissive
package logrus2_test import ( "log" "net/http" "github.com/szark/logrus2" ) func ExampleLogger_Writer_httpServer() { logger := logrus.New() w := logger.Writer() defer w.Close() srv := http.Server{ // create a stdlib log.Logger that writes to // logrus.Logger. ErrorLog: log.New(w, "", 0), } if err :=...
9e4ddd249002178fd4d1c5fe25207e7194be4527
1aaf95802e6aa5967b83719825d997086b7bc759
LeeKeBo/dfc_backend
/app/controller/fileTranslatgeController.go
Go
go
4,450
no_license
// 这里是先创建SSH连接再进行文件传输,主要使用了SSH库和github.com/pkg/sftp这个包 package controller import ( "dfc_backend/app/util" "fmt" "github.com/gin-gonic/gin" "github.com/pkg/sftp" "golang.org/x/crypto/ssh" "net" "net/http" "os" "path" "time" ) type SSHInfo struct { user string password string host string port ...
96f8699afc665f8e48ff34518c335f9e22868575
d42fd754a17a2e54225de13ea406c3c375a2ed80
fujin/chef-golang
/api.go
Go
go
13,211
permissive
package chef import ( "bufio" "bytes" "crypto/rsa" "crypto/sha1" "crypto/tls" "crypto/x509" "encoding/base64" "encoding/pem" "errors" "fmt" "io" "io/ioutil" "math/big" "net/http" "net/url" "os" "path" "path/filepath" "regexp" "strings" "time" ) // Chef is the type that contains all of the relevan...
6974571fde7b5c7000f625da62e71e3846d7bdff
e507b7e114d0522d169ece4a68b1b5fffe2e224b
cx20/hello
/go/opengl1.1_glfw/triangle/hello.go
Go
go
890
no_license
package main import ( "github.com/go-gl/gl/v2.1/gl" "github.com/go-gl/glfw/v3.3/glfw" ) func main() { glfw.Init(); window, _ := glfw.CreateWindow(640, 480, "Hello, World!", nil, nil) window.MakeContextCurrent() gl.Init() for !window.ShouldClose() { drawTriangle() window....
3250cdc5ac3c51affbd1059ebb6cb507e9c06609
166a35d48b515e0062651801060d7ef518e0f042
hiscaler/ip-location
/src/location/location.go
Go
go
2,134
no_license
package location import ( "bytes" "errors" "golang.org/x/text/encoding/japanese" "golang.org/x/text/encoding/korean" "golang.org/x/text/encoding/simplifiedchinese" "golang.org/x/text/encoding/traditionalchinese" "golang.org/x/text/transform" "io/ioutil" "strings" ) type Location struct { rawData string...
2ae0d4ceb145b6bba35a36b045d2d667a65ca18b
fbbbdec1ed0d43972205575aa6c0c367af78bb3f
VG-Tech-Dojo/vg-1day-2018-05-13
/piro/bot/poster.go
Go
go
640
no_license
package bot import ( "context" "github.com/VG-Tech-Dojo/vg-1day-2018-05-13/piro/model" ) type ( // Poster はInに渡されたmessageをPOSTするための構造体です Poster struct { In chan *model.Message } ) // Run はPosterを起動します func (p *Poster) Run(ctx context.Context, url string) { for { select { case <-ctx.Done(): close(p.In...
a263207e5e8dd2cd153e983350de864831b94fb1
4087a07d24017196185a7e7c68ddb63073014fe4
zhaojyun/influxdb
/kv/auth_test.go
Go
go
2,041
permissive
package kv_test import ( "context" "testing" "github.com/influxdata/influxdb" "github.com/influxdata/influxdb/kv" influxdbtesting "github.com/influxdata/influxdb/testing" "go.uber.org/zap/zaptest" ) func TestBoltAuthorizationService(t *testing.T) { influxdbtesting.AuthorizationService(initBoltAuthorizationSer...
b1469852f93d5d076c06bc2a4f7e5f985bbcda6c
976f1bd7faeba70e26403ec9023ae2cdb798024e
cormoran/test2doc
/doc/parse/extract.go
Go
go
1,258
permissive
package parse import ( "regexp" "strings" ) const camelCase = "[A-Z]?[^A-Z]*" // GetTitle extracts a title from the function name, // where longFnName is of the form: // github.com/cormoran/test2doc/example.GetWidget // and the out title would be: // Handle Get Widget func GetTitle(longFnName string) string { sho...
6de7272c003a447ab2207a4fa428fa5a0a68946e
5c110bde957aa3ce5d691deec19d1bca0990851b
Fs02/rel
/errors_test.go
Go
go
1,921
permissive
package rel import ( "errors" "testing" "github.com/stretchr/testify/assert" ) func TestNoResultError(t *testing.T) { assert.Equal(t, "Record not found", NotFoundError{}.Error()) } func TestConstraintType(t *testing.T) { assert.Equal(t, "CheckConstraint", CheckConstraint.String()) assert.Equal(t, "NotNullCons...
b5352fcbbe2548323f40f98574f85c729c7fe9b8
b71c153d7c9243eca675e7ddd0779ed518841947
gophersgang/antibody
/antibody_test.go
Go
go
1,701
permissive
package antibody_test import ( "bytes" "io/ioutil" "os" "strings" "testing" "github.com/getantibody/antibody" "github.com/stretchr/testify/assert" ) func TestAntibody(t *testing.T) { assert := assert.New(t) home := home() bundles := []string{ "# comments also are allowed", "caarlos0/ports kind:path # c...
415787d82b30e376477c8241a412fcf8a34c4468
d8fcaf6b4d1e7fb6b68172e23ceebaec15fdcdca
Nordix/multus-cni
/pkg/netutils/netutils_test.go
Go
go
36,332
permissive
// Copyright (c) 2019 Multus 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...
a4847ee461e6e840eabfb191a24b322fcefdaa0f
046aef4446e15365a3e335515e0e7dc3a6e6f458
bogdandrutu/opentelemetry-collector-contrib
/receiver/webhookeventreceiver/receiver.go
Go
go
473
permissive
// Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 package webhookeventreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/webhookeventreceiver" import ( "errors" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" ) func...
657d56e9e89897a6831f44d884527f8d11b2c920
8cefd895bca671e6563b6d63440e2b48923d1560
fakeNetflix/titus-executor
/executor/runtime/docker/capabilities.go
Go
go
2,204
permissive
package docker import ( "github.com/Netflix/titus-executor/executor/runtime/docker/seccomp" runtimeTypes "github.com/Netflix/titus-executor/executor/runtime/types" "github.com/docker/docker/api/types/container" "fmt" ) const ( SYS_ADMIN = "SYS_ADMIN" // nolint: golint ) func addAdditionalCapabilities(c *runtim...
6afc371b0b5bb73d2926b9c5b06b6d2cb0c8a976
b94f069441773a0fc7ad5669f584153daf0f549f
pprogrammer93/goridepay-driverworker
/model/invalidate/invalidate.go
Go
go
367
no_license
package invalidate import ( "time" ) // InvalidOrder will store data used by invalidator type InvalidOrder struct { OrderID int Timestamp int64 } // NewInvalidOrder is official way to create new variable with InvalidOrder type func NewInvalidOrder(orderID int) *InvalidOrder { return &InvalidOrder{ OrderID: ...
00d6d828a2c0c3424891618967c92f31d63d8072
0328e2b67e8a7c452bbf85a57e715d1d90ddca8a
hikaru-ida/todo
/command/delete.go
Go
go
918
no_license
package command import ( "database/sql" "flag" "fmt" "log" "strings" ) type DeleteCommand struct { } func (c *DeleteCommand) Run(args []string) int { var all bool flags := flag.NewFlagSet("delete", flag.ContinueOnError) flags.BoolVar(&all, "all", false, "delete all task") if err := flags.Parse(args); err !...
66432caa3f78ec40aceb98e6879c85fe9230891d
dcab2d48caa4916283e5fb96f387b403d465d1c9
motdotla/carte
/app.go
Go
go
3,269
no_license
package main import ( "github.com/go-martini/martini" "github.com/handshakejs/handshakejserrors" "github.com/joho/godotenv" "github.com/martini-contrib/binding" "github.com/martini-contrib/render" "github.com/scottmotte/cartelogic" "net/http" "os" ) const ( LOGIC_ERROR_CODE_UNKNOWN = "unknown" ) var ( DB_E...
88d48029220fd1d902d055a66391ec9b610ac132
337f986542cd63b8cee61b836820d9a855c51af0
v13s/fabric-smart-client
/platform/view/sig.go
Go
go
3,849
permissive
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package view import ( "github.com/hyperledger-labs/fabric-smart-client/platform/view/driver" "github.com/hyperledger-labs/fabric-smart-client/platform/view/view" ) // Signer is an interface which wraps the Sign method. type Signer ...
4b32774f6fef468c445fda5b7b5590e288a4e645
8977457c44547dfaf2672f23c751683763790710
twkun/GoBatis
/goparser/statement.go
Go
go
926
no_license
package goparser import ( "strings" ) func isExceptedStatement(name string, fragments, fullnames []string) bool { name = strings.ToLower(name) for _, fragment := range fragments { if strings.Contains(name, fragment) { return true } } for _, fullname := range fullnames { if name == fullname { return t...
4d54d3f87f874a1b577a43b1bda175f15173bef7
b14e15a6d909b9426688f83a0b73d329a859ef11
chocoyama/GoPractice
/goroutine/6. Workerの起動.go
Go
go
569
no_license
package main import ( "fmt" "log" ) /* 「<-chan」を返り値の型にしているので、呼び出し先からは書き込みできなくなっている */ func worker(msg string) <-chan string { receiver := make(chan string) for i:=0; i<3; i++ { go func(i int) { msg := fmt.Sprintf("%d %s done", i, msg) receiver <- msg // goroutineの中で送信をし...
010bfe7a5b47b91532ff658865cac44f4f885435
26d18e17ad03b64295e09e67e425e44c2e45dcd5
LonelyPale/minio
/cmd/postpolicyform.go
Go
go
6,209
permissive
/* * Minio Cloud Storage, (C) 2015 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...
c7ca33e034196a9831089124b2934f02dc657410
d7cca4644a4c19ce79e077f7367d1ffe32f78068
maximiano86/go-training
/more_code/coding_tasks/GoBasics/10.go
Go
go
260
permissive
package main import "fmt" func main() { shape := "circle" radius := 3.2 const pi float64 = 3.14159 circumference := 2 * pi * radius fmt.Printf("Shape: %q\n", shape) fmt.Printf("Circle's circumference with radius %f is %f\n", radius, circumference) }
c881d0fe15c63c94c7449551eea68a6a00ca3252
628214afb2a6b2ce8fabd4d7db5c53c780f67d8c
denysaleksandrov/tcactl
/lib/models/vim_vmware.go
Go
go
6,737
permissive
// Package models // Copyright 2020-2021 Author. // // 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...
ab885fe76b2212c15b430567d4aa607f71090abb
a9d798b39153351469e38b837213d9f3217c23e0
boshuzhang/goweb
/src/os/error_unix.go
Go
go
668
permissive
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris package os import "syscall" func isExist(err error) bool { err = underlyingErro...
1849429dd4dfb37b5432fcdf49984711b056efc1
b5daa1c39f629b1f9e0b044077070e1a83468a4d
bsl333/golang-fundamentals
/section11-application/sorting/sort.go
Go
go
1,474
no_license
package main import ( "fmt" "sort" "strings" ) type person struct { First string Age int } type byAge []person type byName []person func (ba byAge) Len() int { return len(ba) } func (ba byAge) Less(i, j int) bool { return ba[i].Age < ba[j].Age } func (ba byAge) Swap(i, j int) { ba[i], ba[j] = ...
2f8f31274f59d6396645f3d823bcc075ebbe6dd4
6cb3f3c3eb88ee1b00f893d6a708ce8a3244a1c3
shkelqimbehluli/go-sdk
/web/view_result_test.go
Go
go
2,993
permissive
package web import ( "bytes" "html/template" "net/http" "strings" "testing" "github.com/blend/go-sdk/assert" "github.com/blend/go-sdk/env" "github.com/blend/go-sdk/exception" "github.com/blend/go-sdk/webutil" ) type testViewModel struct { Text string } func TestViewResultRender(t *testing.T) { assert := ...
21d8ca4ba4d589b65ff9ff26ce89ad4f3d291712
99eeefa93f9cfa3e8ed90406f0e5ae904e670a5a
syumai/til
/typeparams/go117/type-3-2.go
Go
go
231
no_license
// WIP package main import "fmt" type Signed interface { type int, int8, int16, int32, int64 // type list } func printSignedSlice[T Signed](i T) { fmt.Println(i) } func main() { printSigned(1) // Function type inference }
bb0b56e4e1d6946950e72391615466ee6b4c836e
5f693b04b42111a7dbc40753e96bdc907a2dcca1
drags/pinboard-tagger-backend
/middleware.go
Go
go
1,520
no_license
package main import ( "fmt" "net/http" "strings" ) // Ensure's an appropriately formed Pinboard-Auth header is present. Cannot assert // on format of API keys since the format has changed over the years without expiring // previous format keys. Auth against the Pinboard API is _explicitly_ not done here // to avoi...
eb750b693fa35f471302e8b6a2d656bf5de3f5c2
40aaa5d8b2ed29d485c8b4c742a25ea3435ce8b9
lpabon/openstorage-docker-server
/pkg/server/volume.go
Go
go
30,917
permissive
package server import ( "encoding/json" "fmt" "net/http" "strconv" "strings" "github.com/gorilla/mux" "github.com/libopenstorage/openstorage/api" "github.com/libopenstorage/openstorage/api/errors" clustermanager "github.com/libopenstorage/openstorage/cluster/manager" "github.com/libopenstorage/openstorage/v...
a74a5028ea1861546afc2b7537185a0d8542a1f4
a4b8182aab986c89e3453071ad2f870313b2d49e
ChesterJFGould/Language
/location/location.go
Go
go
940
permissive
package location import ( "fmt" "strings" "strconv" ) type Location struct { File string Line uint Column uint } func (l Location) String() string { // Replace all spaces in file name with zero width spaces // Althought this kind of feels like a hack it's kind of // what zero width spaces are meant for. l....
f0af2804b6b1504c143aaebdd2e6602dc3e7977c
6464c8afcf10dcbdbcc206812ba558017f16583c
chenyao11235/go-wheel
/net-http-web/middleware/main.go
Go
go
1,008
no_license
//改包展示了如何给web服务器添加一个中间件,使得每个请求都要经过这些中间件 //1. 使用httprouter作为server处理器,处理器实现了Handler接口,该接口需要实现httpServe方法 //2. 修改默认的处理器可以在创建Serve的时候通过Handler字段指定,也可以在http.ListenAndServe方法中通过参数指定 package middleware import ( "github.com/julienschmidt/httprouter" "net/http" ) type middleWareHandler struct { r *httprouter.Router } //...
343428041abc2f892dc7e7250399d1e759e37504
6c923da9a074377d6072283336eb39a21f51c0d4
remo5000/magma
/symphony/graph/ent/customer_query.go
Go
go
19,336
permissive
// Copyright (c) 2004-present Facebook All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code generated (@generated) by entc, DO NOT EDIT. package ent import ( "context" "database/sql/driver" "errors" "fmt" "math" "strconv" "github...