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
7595ddd31bc733a22ec7ce53dc55f03762e0386e
906efae677c7604df5460ae193c56a6ef6632248
wangy1931/grafana
/pkg/models/user.go
Go
go
2,875
permissive
package models import ( "errors" "time" ) // Typed errors var ( ErrUserNotFound = errors.New("User not found") ) type User struct { Id int64 Version int Email string Name string Login string Password string Salt string Rands string Company ...
42b27a4dc2dd943201fd584130e22c9ef03fe6b8
c197a10f5335f65eec79860fc589d0c9e1a955a3
CMSgov/easi-app
/pkg/models/html.go
Go
go
2,110
permissive
package models import ( "context" "encoding/json" "errors" "fmt" "html/template" "io" "github.com/cmsgov/easi-app/pkg/sanitization" ) // HTML represents html code. It is sanitized when unmarshaled from graphQL or when converted to HTML to only allow specific tags type HTML string // ToTemplate converts and s...
86062c2cf3f8b0351ac08546326f87a796d50517
e8ae609b266ea044744c6255fa2ee8b990e190b4
iYefeng/traits
/jvm/src/jvm/rtda/heap/class_member.go
Go
go
1,273
permissive
package heap import ( "jvm/classfile" ) type ClassMember struct { accessFlags uint16 name string descriptor string class *Class } func (self *ClassMember) copyMemberInfo(memberInfo *classfile.MemberInfo) { self.accessFlags = memberInfo.AccessFlags() self.name = memberInfo.Name() self.descriptor...
5b75bd5aa54b3bbd350dbd0a136bc76b417e008a
c83ba672bcf0ac51ed7fbb6f8e7c7b8df5634f18
sgibson53/work-go
/src/examples/fetchall/main.go
Go
go
1,005
no_license
// Fetchall fetches URLs in parallel and reports their times and sizes. package main import ( "fmt" "io" "io/ioutil" "net/http" "os" "time" ) func main() { start := time.Now() ch := make(chan string) for _, url := range os.Args[1:] { go fetch(url, ch) // start goroutine } outputFile, err := os.Create("re...
37f704354e9551451920628fc6974d13d96a80b0
5c79041de0d43b4e20bc90d56bfb0c9c9266a17c
bbokorney/shout
/template_config.go
Go
go
359
permissive
package main import ( "fmt" "path/filepath" "text/template" ) // ParseTemplates parses templates func ParseTemplates(templatesDir string) (*template.Template, error) { t, err := template.ParseGlob(filepath.Join(templatesDir, "*")) if err != nil { return nil, fmt.Errorf("Error parsing templates in dir %s: %s", ...
1e42506401019c7bbca36276245f12a4f54e1701
0553d49251398aec179d057de4dbfa4ee664bcdb
AndoniG/go
/Web/main.go
Go
go
405
no_license
package main import ( "fmt" "net/http" "io" ) type webWritter struct { } func (webWritter) Write (p []byte) (int, error){ fmt.Println(string(p)) return len(p), nil } func main(){ response, err := http.Get("http://google.com") if err != nil { fmt.Println(err) } e := webWritter{} // COPY REQUIERE UNA IN...
995fc68490ac36a4d0a1a07940046eb2e74fb770
dc28995ce8e3ea1e294722b167340b02d2577f1f
yadisnel/go-ms-plugins
/config/source/configmap/watcher.go
Go
go
1,860
permissive
package configmap import ( "errors" "time" "github.com/yadisnel/go-ms/v2/config/source" v12 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" ) type watcher struct { opts source.Options name string namespace string client *kuber...
a96a56e636f9c24796fe8191c65ae0f0d830ce97
6912086f80c65ab46c053fd49e0c6ade41caf613
turingchain2020/plugin
/plugin/dapp/autonomy/doc.go
Go
go
4,137
permissive
// Copyright Turing Corp. 2018 All Rights Reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //Turingchain投票治理系统旨在为turingchain链提供一种社区发展自治的系统,可以由利益相关者制定规则。 //Turingchain投票治理系统中参与投票治理主要由董事会以及全体持票人。 //董事会主要参与日常项目的执行决策;董事会的产生由提案人提案董事会成员(暂定30),由全体持票人投票,超过50%的持票...
24169ae813b552c49453665c84b4591aa12f3369
662528d8615e0a089197299d4f7616a959ee5a9d
elaurendeau/ArduinoTutorial-go
/1-blink-led/main.go
Go
go
460
no_license
package main import ( "time" "gobot.io/x/gobot" "gobot.io/x/gobot/drivers/gpio" "gobot.io/x/gobot/platforms/firmata" ) func main() { firmataAdapter := firmata.NewAdaptor("COM3") led := gpio.NewLedDriver(firmataAdapter, "8") work := func() { gobot.Every(1*time.Second, func() { led.Toggle() println("Li...
83b99a14b5b02ef7d859d2bca3486f74c806c534
745e5f2bb4054efd86ff1ef1bd3587e9472edc5e
chris-tomich/passportjs-auth-in-golang
/sample/sample_service.go
Go
go
724
no_license
package main import ( "goji.io" "github.com/chris-tomich/passportjs4go" "golang.org/x/net/context" "net/http" "goji.io/pat" ) const ( key = "My-Secret-Key" redisAddress = "172.16.1.2:6379" redisStoreIndex = 0 ) func main() { mux := goji.NewMux() mux.UseC(passportjs4go.AuthorizationMiddleware(key, redisAddr...
a3a7d5c9c7aa4964aef41a01043e854a34581171
8d154fb8343bd2a5542a62e0595906bd90bc7745
chris-tomich-msft/azure-storage-azcopy
/cmd/jobsShow.go
Go
go
6,711
permissive
// Copyright © 2017 Microsoft <wastore@microsoft.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modif...
9abf5d21ca3b842978a7c6625b7c50258ba9c691
df4a142615136785b6f0a02978021eaa7fec71ed
jco1904/dataplaneapi
/handlers/global.go
Go
go
3,050
permissive
// Copyright 2019 HAProxy Technologies // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
9931288d9dd655916faaf6a0b47721111d017b79
de5093dd4c920022e99ce94b2c30d34501e27609
mxlogin/cfrpki
/validator/lib/cert.go
Go
go
14,811
permissive
package librpki import ( "bytes" "crypto/x509" "encoding/asn1" "encoding/hex" "errors" "fmt" "net" "time" ) // https://tools.ietf.org/html/rfc6487 // https://tools.ietf.org/html/rfc3779 var ( IpAddrBlock = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 1, 7} AutonomousSysIds = asn1.ObjectIdentifier{1, 3, ...
90a6af280fc9c3eb1b6c50e816a6df3dc7053b77
2db4a6970b674dd88a7f8d07c3e9b53dc1968320
peonone/gearman
/server/config.go
Go
go
278
permissive
package server import ( "time" ) type Config struct { BindAddr string LogFilePath string LogToStderr bool Verbose bool QueueType string QueueDriver string QueueDataSource string QueueTableName string RequestTimeout time.Duration }
f2bc13841310e2cee1043a458360ecce15a7460a
49c8900acbf784606a7f177c7017c606784e24d2
goller/semaphore
/mem.go
Go
go
787
no_license
package semaphore import ( "errors" "golang.org/x/net/context" ) type MemLockClient struct { sem Semaphore } // Creates a new in-memory client. Useful for testing in place of etcd. func NewMemLockClient(ctx context.Context) (*MemLockClient, error) { return &MemLockClient{}, nil } func (m *MemLockClient) Init(c...
e5a1e1759b9501dec9a11b11f6d687f0f9784c96
e270b0007126ad744de8835f607062e3a06e4b53
chenggiant/jvm.go
/jvmgo/instructions/math/mul.go
Go
go
1,060
permissive
package math import ( "github.com/zxh0/jvm.go/jvmgo/instructions/base" "github.com/zxh0/jvm.go/jvmgo/rtda" ) // Multiply double type DMUL struct{ base.NoOperandsInstruction } func (self *DMUL) Execute(frame *rtda.Frame) { stack := frame.OperandStack() v2 := stack.PopDouble() v1 := stack.PopDouble() result := v...
9c9c0b1dab0ea2832d6e6b77443f532f307189bc
c19cb75629953890a4754e8db62124fe07909b93
ivan4th/wb-rules
/wbrules/cell_test.go
Go
go
6,488
no_license
package wbrules import ( "strings" "testing" wbgo "github.com/contactless/wbgo" "github.com/stretchr/testify/assert" ) type cellFixture struct { t *testing.T driver *wbgo.Driver broker *wbgo.FakeMQTTBroker client wbgo.MQTTClient model *CellModel cellChange chan string } func NewCellFixture(t *testin...
1837d9317570e4ee32cb45e05c57bfa903f11394
2bbe36e0740279fe4dd44c79980d6f6e2d8790dd
kekleovr/go-twitch
/api/helix/rate-limiter.go
Go
go
1,986
permissive
package helix import ( "strconv" "sync" "time" "github.com/Adeithe/go-twitch/api/request" ) // RateLimiter stores data used to keep track of the Twitch API Ratelimit. type RateLimiter struct { Bucket int Remaining int Reset time.Time await chan bool open bool close bool mx sync.Mutex } // IRa...
a8c95b0ae93433eaa177f7524ccc8b3017fcab9d
386c7a415713b7633a2ea1426a47b4f017a9933c
kubevirt/hyperconverged-cluster-operator
/controllers/operands/quickStart.go
Go
go
5,423
permissive
package operands import ( "context" "errors" "os" filepath "path/filepath" "reflect" "strings" log "github.com/go-logr/logr" consolev1 "github.com/openshift/api/console/v1" extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimach...
9a5b8ea901dc2dc40fc01192d8ae68039b837462
5ab2f53366618430604c3df5e3e0117f8ace3fc2
mxandeco/jx
/pkg/jx/cmd/step_create_task.go
Go
go
36,325
permissive
package cmd import ( "fmt" "io/ioutil" "os" "path/filepath" "strconv" "strings" "time" "github.com/ghodss/yaml" "github.com/jenkins-x/jx/pkg/apis/jenkins.io/v1" "github.com/jenkins-x/jx/pkg/config" "github.com/jenkins-x/jx/pkg/gits" "github.com/jenkins-x/jx/pkg/jenkinsfile" "github.com/jenkins-x/jx/pkg/j...
ce881ecf8470da786f8874e99e464e3d14e01c02
65cf22a68b65cf7ad8243a07a644bd7acce8465c
sudeepgoyal75/terraform-provider-nuagenetworks
/4.0.6.1/nuagenetworks/resource_nuagenetworks_job.go
Go
go
35,515
no_license
package nuagenetworks import ( "github.com/hashicorp/terraform/helper/schema" vspk "github.com/tpretz/vspk-go/vspk/4.0.6.1" ) func resourceJob() *schema.Resource { return &schema.Resource{ Create: resourceJobCreate, Read: resourceJobRead, Update: resourceJobUpdate, Delete...
71440d2e06e5e1243e0d0a4ea8389364f66864b8
89605c26d9d7f03584a40e9315032e68a61ee543
mochi5o/TIL
/sokusyu-go/func.go
Go
go
891
no_license
package main import "fmt" func main() { // 関数の実行 result := add(1, 2) fmt.Println(result) // 多値を受け取る関数の実行 a, b := swap("hello", "fukuoka.go") fmt.Println(a, b) // errorが発生したら戻り値のerrの内容を出力する result, err := div(2, 0) if err != nil { fmt.Printf("error: %s", err) // %sにはerrが入る } else { fmt.Println(result) ...
f15271ccc4df2893d753dbdb1ee384695e5e52b2
1192be6cc990d2232e83000d85f379f1114529fd
zjs1224522500/GoLearn
/loopsAndFunctions/exercise.go
Go
go
417
no_license
package main import ( "fmt" "math" ) // Small Diffeneces const Small = 1.0 / (1 << 20) // Sqrt Exported method func Sqrt(x float64) float64 { z := 1.0 for i := 0; i < 10; i++ { diff := (z*z - x) / (2 * z) if math.Abs(diff) < Small { break } z -= diff fmt.Println(z) } return z } func main() { fm...
887b42e2c1177ed3cd8a688a9427c56f06bf7d28
8c2b8cc66d56e8b5d35dec953d86988733e6a417
dajiang000/goDemo
/src/GoStudy/read/demo2/main.go
Go
go
331
no_license
package main import ( "bufio" "fmt" "io" "os" ) func main() { file, err := os.Open("E:/一些论文/haha.txt") if err != nil { fmt.Println("打开文件错误", err) } defer file.Close() read := bufio.NewReader(file) for { str, err := read.ReadString('\n') if err == io.EOF { break } fmt.Print(str) } }
b34938b759f7fd5d94a0a510183ae25df2a70b7c
4dd67eb5fdc9b272a2a64d88bf6e6104bf315c60
phuongdateh/golang
/LearnBackEnd/main.go
Go
go
2,590
no_license
package main import ( "encoding/json" "fmt" "io/ioutil" "log" "net/http" "github.com/gorilla/mux" ) type event struct { ID string `json:"ID"` Title string `json:"Title"` Description string `json:"Description"` } type allEvents []event var events = allEvents{ { ID: "1", Title: ...
f005535f3c3ae70937fbb17e275e2562375d7573
be08a742e2fb7ee716aa4fca6fbb49b55105917a
qmwd2006/jfrog-cli-go
/jfrog-cli/artifactory/commands/npm/install.go
Go
go
20,473
permissive
package npm import ( "encoding/json" "errors" "fmt" "github.com/buger/jsonparser" "github.com/jfrog/gofrog/parallel" "github.com/jfrog/jfrog-cli-go/jfrog-cli/artifactory/utils" "github.com/jfrog/jfrog-cli-go/jfrog-cli/artifactory/utils/npm" "github.com/jfrog/jfrog-cli-go/jfrog-cli/utils/ioutils" "github.com/j...
8c07d432ccf0b9a3b95f1e2f37e6794500eddf56
26132cf3eacacb8708c7496e811ed03ed1f85fd3
Sparika/GoNiKo
/main.go
Go
go
2,378
no_license
package main // http://hackmd.diverse-team.fr/s/HkPqyy8-G# import ( "fmt" "io/ioutil" "time" "net/http" "encoding/json" "github.com/apaxa-go/eval" ) type JWT struct { Sub string `json:"sub"` Iat int64 `json:"iat"` Exp int64 `json:"exp"` } type MSG struct { Login string `json:"...
f5eec3be578888b5dc434b9cc32d11b304a27096
5896ffc3b00d225a610e87a0a654935979741366
EzraWen/gin-study
/database/mysql.go
Go
go
346
no_license
package database import ( "database/sql" _ "github.com/go-sql-driver/mysql" "log" ) var Database *sql.DB func init() { var err error Database, err = sql.Open("mysql", "root:123456@tcp(127.0.0.1:3306)/shop?parseTime=true") if err != nil { log.Fatal(err.Error()) } err = Database.Ping() if err != nil { lo...
507a9cfbff8df6e14c0cc0d86cae19168bb1124e
1ee69324d63683a73edc67c8bc607113a2cb814f
rahulchheda/kopia
/cli/command_repository_repair.go
Go
go
2,409
permissive
package cli import ( "context" "github.com/pkg/errors" "github.com/kopia/kopia/internal/gather" "github.com/kopia/kopia/repo" "github.com/kopia/kopia/repo/blob" "github.com/kopia/kopia/repo/content" ) var ( repairCommand = repositoryCommands.Command("repair", "Repairs repository.") repairCommandRecoverForm...
ef2f12d7c5ea7e478e28c21b31fa3267bc5497bb
0764cbc1868d1376c057d80bf1b24768cc0d64fd
rawgni/nsq
/nsqd/disk_queue_snapshot.go
Go
go
10,146
permissive
package nsqd import ( "bufio" "encoding/binary" "fmt" "github.com/absolute8511/nsq/internal/levellogger" "io" "os" "sync" ) // note: the message count info is not kept in snapshot type DiskQueueSnapshot struct { // 64bit atomic vars need to be first for proper alignment on 32bit platforms queueStart diskQueu...
721394bea95b7fee2a97ff68e2cfae8c552b81b6
b0b8916926d24e8e0b14e3033c1db390613f3506
MyPureCloud/platform-client-sdk-go
/platformclientv2/dialercallabletimesetconfigchangetimeslot.go
Go
go
4,889
permissive
package platformclientv2 import ( "github.com/leekchan/timeutil" "reflect" "encoding/json" "strconv" "strings" ) // Dialercallabletimesetconfigchangetimeslot type Dialercallabletimesetconfigchangetimeslot struct { // SetFieldNames defines the list of fields to use for controlled JSON serialization SetFieldName...
8c8d87b4904335a1db943ebe0f16b6589755f600
de0c581166572d589440adc714c1ebad5d8324c6
intuit/foremast
/foremast-barrelman/vendor/k8s.io/kubernetes/pkg/volume/scaleio/sio_util.go
Go
go
10,393
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, ...
0682727a28b0011dadeffe4745b4cc91e67acce5
f9dd40073c285df9881067c8be61690c11fe24f3
smurf28/lc_practice
/.leetcode/104.二叉树的最大深度.go
Go
go
503
no_license
/* * @lc app=leetcode.cn id=104 lang=golang * * [104] 二叉树的最大深度 */ package leetcode // @lc code=start /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ func maxDepth(root *TreeNode) int { if root == nil { return 0 } L := max...
4cb011265363028b04a953d5ce733d7e57b41e5b
0278aeb9c288102912e65624f1e77f0a4fea4981
iamtraining/leetcode
/Queue & Stack/Perfect Squares/main.go
Go
go
582
no_license
package main import ( "fmt" "math" ) func main() { fmt.Println(numSquares(1000)) fmt.Println(numSquares(2)) fmt.Println(numSquares(3)) fmt.Println(numSquares(4)) fmt.Println(numSquares(5)) fmt.Println(numSquares(6)) fmt.Println(numSquares(7)) } func numSquares(n int) int { if n == 0 { return 0 } dp :=...
fb3962e687d6e8140c2d59020277daa88c624731
39c3fe0f1b99dff8345b02499fbe6f452637bd29
gitamenet/v2ray-core
/external/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_handler.go
Go
go
3,626
permissive
package ackhandler import ( "fmt" "time" "github.com/gitamenet/v2ray-core/external/github.com/lucas-clemente/quic-go/internal/congestion" "github.com/gitamenet/v2ray-core/external/github.com/lucas-clemente/quic-go/internal/protocol" "github.com/gitamenet/v2ray-core/external/github.com/lucas-clemente/quic-go/inte...
851490ad96fe83491a3306dabca36a822cffb9bc
fd921c724716a5f18307306b4b6a91b4d2a0a9a5
arrowfeng/kubernetes
/test/integration/scheduler/scheduler_test.go
Go
go
23,033
permissive
/* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
9adae92582a70a87b6846b7181b65df64810da4a
5ecf502e4f88ba87ce3962104a0b52904d9f55f4
tidb-dashboard-bot/tidb-dashboard
/pkg/utils/topology/store.go
Go
go
4,670
permissive
// Copyright 2020 PingCAP, 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 i...
80f59db610b31c3404a5a1af0ded8160097c063f
6bb3bf9e142abc80044dea2c1cf22b6086d25693
ozonva/ova-film-api
/internal/saver/saver.go
Go
go
789
no_license
package saver import ( "github.com/ozonva/ova_film_api/internal/flusher" "github.com/ozonva/ova_film_api/internal/movies" "time" ) type Saver interface { Save(movie movies.Movie) Close() } func NewSaver( capacity int, flusher flusher.Flusher, timeout time.Duration, ) Saver { saver := saver{ movies: make...
b16be4c4fd5a38dab31fc2d499e0ced2fd4fd5e2
10f6c1118fcb9e1bd6b26bc21d45b9821c00f5eb
inwinstack/pango
/netw/tunnel/gre/fw.go
Go
go
3,690
permissive
package gre import ( "fmt" "encoding/xml" "github.com/inwinstack/pango/util" ) // FwGre is the client.Network.GreTunnel namespace. type FwGre struct { con util.XapiClient } // Initialize is invoked by client.Initialize(). func (c *FwGre) Initialize(con util.XapiClient) { c.con = con } // ShowL...
2a5f29c1adca5de115846327acf75a2d81baa00d
b48b907151d99788796d14332f31aa47e8ca44ed
jaxon-gao/go-filecoin
/internal/pkg/config/config.go
Go
go
12,362
permissive
package config import ( "encoding/json" "fmt" "io/ioutil" "os" "reflect" "regexp" "strings" "github.com/filecoin-project/go-address" "github.com/pkg/errors" "github.com/filecoin-project/go-filecoin/internal/pkg/types" ) // Config is an in memory representation of the filecoin configuration file type Confi...
551f90215117b40c9b43bbe5357762194da1061e
29fbaaaa3241c13f2d9aea94e7769930a502cbd3
zombiezen/acbuild
/util/fsdiffer/temporal_test.go
Go
go
4,505
permissive
// Copyright 2015 The appc 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...
3e36159334388e64f6150efb2e32347bca3f806b
9b660e9ad3b0c363130b96dd30235c673e118d99
imsilence/htcache
/server/server.go
Go
go
624
no_license
package server import ( "fmt" "htcache/cache" "htcache/server/cluster" ) type Server interface { Listen(addr string) error } type NewFunc func(cluster.Node, cache.Cache) (Server, error) var providers map[string]NewFunc = make(map[string]NewFunc) func Register(name string, new NewFunc) { if _, ok := providers[...
afd23eab1447031424b8786b4e4ff7b4c779621f
2b3f4b6f97326ac5810dde9d2bd7f23d1203e5d3
sacloud/libsacloud
/v2/helper/service/sshkey/service.go
Go
go
902
permissive
// Copyright 2016-2022 The Libsacloud 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...
bd506f22686ce0eb650b281c7dfb615ba86797f3
e72c116a8849ee2c37ceadf826ee571f2046dec3
riimi/turi
/handler/login.go
Go
go
1,355
no_license
package handler import ( "fmt" "log" "mq/academy/repo" "mq/academy/session" "net/http" ) type LoginRequest struct { Name string `json:"name"` Passwd string `json:"passwd"` } type LoginResponse struct { Session *session.Session `json:"session"` Error string `json:"error"` } func Login(gr repo....
2f3653c91448ebfb54d3af20f9b2df8fbd26613d
3d6bb0c6835ad4c1ece968cb813594d34364524a
juanvallejo/installer
/vendor/sigs.k8s.io/cluster-api/util/util.go
Go
go
4,997
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, ...
7396755c3af1a3667a45b764aac0ed0a03df2c3c
2f62fec78ae82df8cc4b9aad8a62a87c77763240
WindSpiritSR/casdoor
/object/adapter.go
Go
go
3,156
permissive
// Copyright 2021 The casbin Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by a...
d9b87986d0bbafeb370b3c0d70fda6872a5724de
9ea0a96b82a4dfd0a7da9eb1aebbb918c231fdb0
UtopiaCoinOrg/politeia
/politeiawww/cmd/politeiawwwcli/commands/subscribe.go
Go
go
2,433
permissive
package commands import ( "bytes" "crypto/tls" "encoding/json" "fmt" "net/http/cookiejar" "net/url" "os" v1 "github.com/UtopiaCoinOrg/politeia/politeiawww/api/www/v1" "github.com/UtopiaCoinOrg/politeia/util" "github.com/gorilla/websocket" "golang.org/x/net/publicsuffix" ) // SubscribeCmd opens a websocket...
e2606aea9d5f65af7761389ead2a3fe6eb607386
53865732b2a0fa0586dfe2e2cbced79e336d6fdc
morezig/go-odoo
/api/mail_mass_mailing_test.go
Go
go
1,800
no_license
package api import ( "github.com/morezig/go-odoo/types" ) type MailMassMailingTestService struct { client *Client } func NewMailMassMailingTestService(c *Client) *MailMassMailingTestService { return &MailMassMailingTestService{client: c} } func (svc *MailMassMailingTestService) GetIdsByName(name string) ([]int64...
410ce9990dd73ccda3de2ffc573581fc823d332a
aa569fc3afde9595c59760811cd60afa9afffcf4
DataDog/datadog-agent
/pkg/logs/message/message.go
Go
go
3,823
permissive
// Unless explicitly stated otherwise all files in this repository are licensed // under the Apache License Version 2.0. // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. package message import ( "context" "time" "github.com/DataDog/datado...
b3fded89eed5c90bf101500d133e9136faa1281e
b5f4525f8f8a63c0a77f873d7fb01619418d736c
scalingdata/goleveldb
/leveldb/session.go
Go
go
11,891
permissive
// Copyright (c) 2012, 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 leveldb import ( "fmt" "io" "os" "sync" "sync/atomic" "github.com/scalingdata/goleveldb/leveldb/errors" "git...
e0ad99ec3973e7ea21252c9a8442e8971dea8d1d
cd40cb3f769d38da71e7a17fdee3ae444f2015f5
nicola-spb/locales
/so_SO/so_SO_test.go
Go
go
18,764
permissive
package so_SO import ( "testing" "time" "github.com/nicola-spb/locales" "github.com/nicola-spb/locales/currency" ) func TestLocale(t *testing.T) { trans := New() expected := "so_SO" if trans.Locale() != expected { t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale()) } } func TestPluralsRange(t *...
19144166df517609de52e8146e3627af598249b5
b841e0d84b59e4ede57e15c791947e082c0094c6
BearCloud/fa20-project-starter
/profiles/main.go
Go
go
1,088
no_license
package main import ( "log" _ "log" "net/http" _ "net/http" "github.com/BearCloud/fa20-project-dev/backend/profile/api" "github.com/gorilla/mux" ) func main() { //init db DB := api.InitDB() defer DB.Close() //ping the database to make sure it's up err := DB.Ping() if err != nil { panic(err.Error()) }...
fdac6ef39557ce8e252fe47223b6381f61096155
62973d292c8821904b8224f0c920c12042eaf558
KeisukeYamashita/biko
/cli/googleworkspace.go
Go
go
3,819
permissive
// Copyright 2019 The Biko 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...
ccdc560a4969671fffeee77c7682a52ce8e69f7c
0bef5c803173acbdcf662bb86e52a64675b0ec95
shibosen/htgolang-20210313
/homework/day04-20210410/GO4070-wangxian/user/usermanage/usermanage.go
Go
go
2,222
no_license
package usermanage import ( "fmt" "strconv" "user/utils" "strings" ) var UserInfo = []map[string]string{ {"id": "1", "name": "wx", "addr": "北京", "tel": "135467"}, {"id": "3", "name": "jack", "addr": "四川", "tel": "152467"}, {"id": "4", "name": "jim", "addr": "河北", "tel": "135167"}, } //生成用户ID func generateID()...
3d5322217dd62e48db20e50a03ce2bb5ada26a08
090668ef6421df5a26ea4bf829077ecd83ce0380
funxdata/wechat
/context/qy_access_token.go
Go
go
1,973
permissive
package context import ( "encoding/json" "fmt" "log" "sync" "time" "github.com/funxdata/wechat/util" ) const ( //qyAccessTokenURL 获取access_token的接口 qyAccessTokenURL = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=%s&corpsecret=%s" ) //ResQyAccessToken struct type ResQyAccessToken struct { util.Commo...
4bb7dc2dbfcf20b79a18926d19a787647fb8b40a
62d63e892287a4614d2d7e5d0efe154e448c952b
simplespy/bgls
/curves/bls12_381.go
Go
go
11,417
permissive
// Copyright (C) 2018 Authors // distributed under Apache 2.0 license package curves import ( "encoding" "hash" "math/big" "github.com/simplespy/bls12" "golang.org/x/crypto/blake2b" ) type bls12Curve struct { } type bls12Point1 struct { point *bls12.G1 } type bls12Point2 struct { point *bls12.G2 } type bl...
c3e82e2e49429665832f41ec539cd46f6a75ce50
2f1202cb008c13dedf549b07594590c3484e0b21
synsec/libstix2
/objects/tool/setters.go
Go
go
1,006
permissive
// Copyright 2015-2022 Bret Jordan, All rights reserved. // // Use of this source code is governed by an Apache 2.0 license that can be // found in the LICENSE file in the root of the source tree. package tool import "github.com/freetaxii/libstix2/objects" // ---------------------------------------------------------...
05edafe2211b56c88f8a866b48450baf98553f6c
f0ab1eb5d780cdb79ef5723035c8adc86d03b4c8
zhanbai/zhanbai.github.io
/code/go-cookbook/003/main.go
Go
go
925
no_license
package main import ( "fmt" "net/http" "strings" ) func replace(s string, new string, start int, length int) string { return strings.Replace(s, string([]rune(s)[start:start+length]), new, 1) } func handlerFunc(w http.ResponseWriter, r *http.Request) { id := 1 message := "希望用另外一个不同的字符串来替换一个子串。例如,打印一个信用卡号之前,想要对除...
ff53d444bdaa7a774cf1e594facbf9cbd7b6f69a
086fd45059b687db9d7d2ae25072ec9807eac4e6
yangyongzhi7/kruise
/test/e2e/framework/expect.go
Go
go
860
permissive
/* Copyright 2021 The Kruise Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
983c7a18b313c8e0dd3c0966f00d83a225f59a56
8ea210bb7f8205e4a55594abd06914ab3ec3ee85
remerge/aerospike-client-go
/scan_test.go
Go
go
5,714
permissive
// Copyright 2013-2019 Aerospike, 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 t...
ed203274f29ab4963cc95a111a292a6d16eab9f8
a915a0594dcddab8b6acbdcc8f1376b367000b4c
kopia/kopia
/repo/repo_benchmarks_test.go
Go
go
1,314
permissive
package repo_test import ( "crypto/rand" "testing" "github.com/stretchr/testify/require" "github.com/kopia/kopia/internal/repotesting" "github.com/kopia/kopia/repo/format" "github.com/kopia/kopia/repo/object" ) func BenchmarkWriterDedup1M(b *testing.B) { ctx, env := repotesting.NewEnvironment(b, format.Forma...
0cf40f6c3a092ee42f07109745110d47c08ac059
f601b6536778a00f4e769e164357d196fe15e996
mmerrill3/helm-apigroup-fixer
/pkg/kube/client_test.go
Go
go
17,352
permissive
/* Copyright The Helm 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, software di...
17aa75b6924fd22da7944cc4133f50fb4f8d7fad
939334d71b960022b76e4cb0875b50d2700dbc5b
dfallert-rcd/load-balancer-and-ingress-services-for-kubernetes
/vendor/github.com/vmware/alb-sdk/go/models/performance_limits.go
Go
go
570
permissive
// Copyright 2021 VMware, Inc. // SPDX-License-Identifier: Apache License 2.0 package models // This file is auto-generated. // PerformanceLimits performance limits // swagger:model PerformanceLimits type PerformanceLimits struct { // The maximum number of concurrent client conections allowed to the Virtual Service...
166b3842310bbc109b0200cecb1a5edb720c4b96
58bc4fd08c7b0ef654a3bc3f62a90720fff36bbd
ChrisALiles/biguint
/biguint.go
Go
go
5,655
permissive
package biguint // An exercise to help me to learn the basics of Go. // The arithmetic uses the algorithms I learned in primary school - long division etc. // I resisted the urge to call it "bigunit" with great difficulty. import ( "strconv" ) // biguints are implemnted as slices of ints. type biguint []int // Str...
bf010d87a47816846c57ce7f2829ddeb6d7e2f1f
96b15e7166589025b4a4bc9d2598a823bd968d31
lpcheng1208/gim
/internal/business/cache/auth.go
Go
go
1,689
permissive
package cache import ( "encoding/json" "gim/internal/business/model" "gim/pkg/db" "gim/pkg/gerrors" "gim/pkg/util" "strconv" "time" "github.com/go-redis/redis" ) const ( AuthKey = "auth:" AuthExpire = 2 * time.Hour ) type authCache struct{} var AuthCache = new(authCache) func (*authCache) Get(userId,...
47e4254c796fe9a77dcc56f21a33d74e5852c41a
a0a9960f9d3da06fe2ffb8789821ea88edb7ffe2
irobayna/multibar
/multibar.go
Go
go
6,118
no_license
package multibar import ( "fmt" "reflect" "regexp" "strconv" "strings" "sync" "time" "github.com/nsf/termbox-go" //"github.com/sethgrid/curse" ) type progressFunc func(progress int) type BarContainer struct { Bars []*ProgressBar screenLines int screenWidth int startingLine int totalNewlines int ...
4bf15b8f59bf921eb4b05e4894b3f2f0bf499f2c
02309054361b3e15d236d8f600a57cc54d821a8f
kubernetes/autoscaler
/cluster-autoscaler/cloudprovider/huaweicloud/huaweicloud-sdk-go-v3/services/ecs/v2/model/model_nova_security_group_common_rule.go
Go
go
1,207
permissive
package model import ( "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/huaweicloud/huaweicloud-sdk-go-v3/core/utils" "strings" ) type NovaSecurityGroupCommonRule struct { // 起始端口,范围1-65535,且不大于to_port。 ip_protocol设置为icmp时,from_port表示type,范围是0-255。 FromPort int32 `json:"from_port"` Group *NovaSecurityGroup...
620c1f8980bd6d0da773a952d2c62967f066a6e9
3bbd5505d81007ce775265be2273b8d81caccb27
lianliankeji/xiaolian
/区块链/三一堂/ehr.go
Go
go
2,125
no_license
/* Copyright IBM Corp. 2016 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...
c44fda5e7d41916776a9ad2a4e5b191485b88d65
6b3f0d02b75cb1e4d9e296bfd437c05f378a247d
drcwr/Dragonfly
/supernode/daemon/mgr/task/manager.go
Go
go
10,939
permissive
/* * Copyright The Dragonfly 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 agr...
5ca021048260a0930928641ec333485b78f18d8b
e34d4a0e08514cfd85cf58597f728c7cd2396fab
Meihb/go_practice
/src/main/InterfaceSortTst.go
Go
go
1,007
no_license
package main /* package sort type Interface interface { Len() int // 获取元素数量 Less(i, j int) bool // i,j是序列元素的指数。 Swap(i, j int) // 交换元素 } */ import ( "fmt" "sort" ) // 将[]string定义为MyStringList类型 type MyStringList []string // 实现sort.Interface接口的获取元素数量方法 func (m MyStringList) Len() int ...
24cf98055f8d7b2d670c5a2a595d1bd46bb9b5ba
fd94a960954cc7d7eb60e3d84246452da79a859e
kucinghitam13/alien
/internal/init.go
Go
go
1,224
no_license
package app import ( "github.com/julienschmidt/httprouter" "github.com/kucinghitam13/alien/internal/config" delivery "github.com/kucinghitam13/alien/internal/delivery/alien/http" repoBaakWeb "github.com/kucinghitam13/alien/internal/repository/baak/web" "github.com/kucinghitam13/alien/internal/usecase" usecaseAli...
41f77ca37156fe3143bb94d197eb72f1ff550f45
fa5720a6c72aef1f508f54ebaac96a4be40f76e9
cds2612/cli
/command/v3/v3_set_health_check_command.go
Go
go
3,700
permissive
package v3 import ( "net/http" "code.cloudfoundry.org/cli/actor/sharedaction" "code.cloudfoundry.org/cli/actor/v3action" "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" "code.cloudfoundry.org/cli/api/cloudcontroller/ccversion" "code.cloudfoundry.org/cli/command" "code.cloudfoundry.org/cli/command/flag"...
098078f17c5081c94b390d0140ce489e82bc3801
49c7fb6dd1359832365ae265d55e036c5c87383b
yanwumo/pinta-scheduler
/pkg/apis/pinta/v1/doc.go
Go
go
753
no_license
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
dc65d96276abca47ab2000b5b73e64d7f58f9827
362ebb989a4fecb773cddef9f1b811a8e113fb26
ultradns/external-dns
/provider/aws/aws_test.go
Go
go
82,800
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, ...
60758012ca7b6582a0476072959406a417b830e6
de7eb24286d2ee5fe999791ac9d053547d359990
csh995426531/liaotian
/middlewares/validate/translate/translator.go
Go
go
1,127
no_license
package translate import ( "errors" "fmt" "github.com/go-playground/locales/en" "github.com/go-playground/locales/zh" ut "github.com/go-playground/universal-translator" "github.com/go-playground/validator/v10" //zhtrans "github.com/go-playground/validator/v10/translations/zh" "liaotian/middlewares/logger/zap" ...
4d4fae0eda9ccc293084aace82d7b455f4a0fd7e
06d7792be303d621fdd966ea223d5a0486ccf585
nabla-containers/gorump
/1.7/go/src/cmd/link/internal/ld/symtab.go
Go
go
18,212
permissive
// Inferno utils/6l/span.c // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.c // // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) // Portions Copyright © 1997-1999 Vita Nuova Limited // Portions Copyright © 20...
ef98e972b954353ee4b35d41da9dc502fc10f144
19b76a033e36f85a5eb0ddff7be6a29528cbab0f
networkservicemesh/examples
/examples/bridge-domain/bridge/cmd/interface.go
Go
go
2,566
permissive
// Copyright 2019 VMware, Inc. // SPDX-License-Identifier: Apache-2.0 // // 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 re...
281be78bb665b7b4bc82cec5359968b916732c70
5a214a68f102be70458ba5df50fd956ac6179a49
marbles-softlayer/marbles-chaincode
/part2/part2_chaincode.go
Go
go
24,107
permissive
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this f...
558b8be9f9cda53ff9cfba49761029707690ae87
9003126df866dfe252be8064c6e7cded7bee9003
squat/telemeter
/pkg/transform/transform.go
Go
go
16,174
no_license
package transform import ( "fmt" "sort" "time" clientmodel "github.com/prometheus/client_model/go" ) type Interface interface { Transform(*clientmodel.MetricFamily) (ok bool, err error) } type none struct{} var None Interface = none{} func (_ none) Transform(family *clientmodel.MetricFamily) (bool, error) { ...
4c9ceec3d194d1070d3f1d66308a2a864b914123
978bd3511cde91da47c8d9a53805d22933aa63f1
kimmidi/goarista
/netns/nslistener_other.go
Go
go
661
permissive
// Copyright (c) 2019 Arista Networks, Inc. // Use of this source code is governed by the Apache License 2.0 // that can be found in the COPYING file. //go:build !linux // +build !linux package netns import ( "net" "github.com/aristanetworks/goarista/logger" ) var hasMount = func(_ string, _ logger.Logger) bool ...
e8ee111cd1587bce8b55d66912899355fc03d06c
418a8e168d81fead04ba7adbc6e435e985c515f7
bpkgoud/pulumi-azure-native
/sdk/go/azure/dataprotection/v20210601preview/getBackupVault.go
Go
go
1,120
permissive
package v20210601preview import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func LookupBackupVault(ctx *pulumi.Context, args *LookupBackupVaultArgs, opts ...pulumi.InvokeOption) (*LookupBackupVaultResult, error) { var rv LookupBackupVaultResult err := ctx.Invoke("azure-native:dataprotection/v20210601preview...
a2bda0d4b87e6c55756d3b3157d6095f815e68e3
aff163744c60e205be0067136b6d0491ca77ee02
h2pl/wade
/browser_tests/worklog/worklog.go
Go
go
1,266
permissive
package worklog import ( gourl "net/url" "strings" "time" //"github.com/gowade/wade" dummy "github.com/gowade/wade/browser_tests/worklog/dummypkg" ) type Project struct { ID int Title string } type Worklog struct { Projects []*Project `fstate` FilterText string `fstate` demoState *gourl.URL `fst...
d5384a5fae4d39d25b1597b4876db8df6dd386ac
a1e6198302dd647e40cb66f455b9d58276d6cabf
chjgps/GoCounter
/basis/log/log.go
Go
go
2,343
no_license
package log import ( "fmt" "log" "os" "runtime" ) const ( levelDebug = "[DEBUG]" levelInfo = "[INFO]" levelWarn = "[WARN]" levelError = "[ERROR]" levelFatal = "[FATAL]" levelExit = "[EXIT]" ) type new struct { name string } func New(name string) *new { return &new{name} } // ------------------ // De...
2a44a5601bd87fcdfb6932943b1eecc4cc73b69e
ad8e73b15830fcbbf70fd6ad3dcdf2290c10948e
wk-go/GolangTest
/module/termbox/gocui/test01.go
Go
go
724
no_license
package main import ( "fmt" "log" "github.com/jroimartin/gocui" ) func main() { g, err := gocui.NewGui(gocui.OutputNormal) if err != nil { log.Panicln(err) } defer g.Close() g.SetManagerFunc(layout) if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil { log.Panicln(err) } ...
a33559f3f1c0886ec4bedf02ce29afd3a6ccb983
fa4e87cb8a88ce714c53eb2e37485062615b0f1d
rpoluri/provider-aws
/pkg/clients/ec2/fake/subnet.go
Go
go
2,890
permissive
/* Copyright 2019 The Crossplane 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, ...
2b26ecd24c3428e290b6a2e6812346ca6536a30f
1b28a4d7f084fd6243d0af01365dc49c50bf4741
newinternetboy/golang-DataStructAndAlgorithm
/Stack/isValid.go
Go
go
1,012
no_license
/* * @Description: 给定一个只包括 '(',')','{','}','[',']' 的字符串 s ,判断字符串是否有效。 有效字符串需满足: 左括号必须用相同类型的右括号闭合。 左括号必须以正确的顺序闭合。 * @Author: Caoxiang * @Date: 2021-08-09 16:38:46 * @LastEditors: Caoxiang */ package main import "fmt" func main() { s := "({)()}" b := isValid(s) fmt.Println(b) } func isValid(s string) bool { ...
ac19e61d2dd0bfd263650a8ec8ad0d048277591c
19fe6357a7a873c1cde3231e20e3963fd3fd351f
nicolaferraro/crc
/pkg/crc/preflight/preflight_checks_darwin.go
Go
go
3,988
permissive
package preflight import ( "errors" "fmt" "golang.org/x/sys/unix" "io" "net/http" "os" "os/exec" "os/user" "path/filepath" "github.com/code-ready/crc/pkg/crc/logging" "github.com/code-ready/crc/pkg/crc/oc" crcos "github.com/code-ready/crc/pkg/os" ) const ( virtualBoxDownloadURL = "https://download.vir...
52d5170ebee56b6e517ecbac45cada7994e339ad
538f32f7c83f30a4b7ed72839c18ebb3eb7de3ea
mats9693/leetcode
/solutions/1-1000/501-600/531-540/535/main.go
Go
go
543
permissive
package mario import "strconv" const urlPrefix = "http://tinyurl.com/" type Codec struct { count int data map[string]string // short url - long url } func Constructor() Codec { return Codec{ data: make(map[string]string), } } // Encodes a URL to a shortened URL. func (c *Codec) encode(longUrl string) string...
377ec4387cc2c77241ca7ff3cc24b0ed1b761166
04b71418dbd4b8c240e5f841c724b5b6d2c644a1
klauspost/go-bigcommerce
/bigcommerce/products.go
Go
go
2,798
permissive
package bigcommerce import ( "fmt" "net/http" "github.com/dghubble/sling" "golang.org/x/net/context" ) // Products defines a list of the Product object. type Products []Product // Product describes the product resource type Product struct { ID int32 `json:"id"` Name string ...
e47181131afe47f7b096838099332ca78e935df9
4e7d852872899a2f2d0bfad78c5bb48f896d2ef0
wallywest/coffer
/internal/options/options.go
Go
go
2,005
no_license
package options import ( "net" "github.com/spf13/pflag" "gitlab.vailsys.com/vail-cloud-services/coffer/internal/registry" mongostorage "gitlab.vailsys.com/vail-cloud-services/coffer/internal/storage/driver/mongo" ) type CofferConfig struct { AppName string BindAddress net.IP AdvertiseAddress net...
43bc02e4c0ca79d58a291584d28810b05fcab3df
6b8353fdbbafd1c28b82364498a022de6f9867ce
iliaposmac/Gin-gonic-
/pkg/handler/list.go
Go
go
2,726
no_license
package handler import ( "net/http" "strconv" "github.com/gin-gonic/gin" "github.com/iliaposmac/todo-app" ) // @Summary Create Todo List // @Tags LIsts // @Description Create New TodoList // @ID create-todo-list // @Accept json // @Produce json // @Param input body todo.TodoList true "todo-list-info" // @Header ...
f4fdf67297cb6cc3a53aed10e3b29f2b887d3f1e
ad511c2a3b8adc8fd091cd530d43f2a5bbf48fda
skillitzimberg/go_playground
/web_development/servers/tcp_server_read_write/main.go
Go
go
792
no_license
package main import ( "bufio" "fmt" "log" "net" ) func main() { // Listen ln, err := net.Listen("tcp", ":8080") if err != nil { log.Fatal(err) } defer ln.Close() // Accept for { conn, err := ln.Accept() if err != nil { log.Fatal(err) } fmt.Println("Connection opened.") // Read & write go...
0b8a4bce0b0721367a428a53c8cb8b8bd59eced7
4c4bbc601832352be6e8b43dca7b911f587cf015
kingljl/kanzi-go
/entropy/RiceGolombCodec.go
Go
go
3,901
permissive
/* Copyright 2011-2017 Frederic Langlet 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 ...
416781923409bfa2f0fdabf12ccf7c77804af3f1
4105f95af95eeccd99f46309975f6ba2e7aebe21
linkedinyou/mgm
/core/persist/regionFunctions.go
Go
go
4,069
permissive
package persist import ( "fmt" "log" "github.com/m-o-s-e-s/mgm/mgm" "github.com/satori/go.uuid" ) func (m mgmDB) persistRegion(region mgm.Region) { con, err := m.db.GetConnection() if err != nil { errMsg := fmt.Sprintf("Error connecting to database: %v", err.Error()) log.Fatal(errMsg) } defer con.Close()...
7258c20695fdc5ee50d3e59ffc457d00e55b65d0
490f7572af2f2746e6c8f95d52caf2bdfa8be159
AK-Vitae/Go-Practice
/src/introduction/functions/methods.go
Go
go
509
no_license
package main import ( "fmt" ) func main() { g := greeter{ greeting: "Hello", name: "Go", } g.greet() // Method invocation g.greetPointer() fmt.Println("New name is called", g.name) } type greeter struct { greeting string name string } func (g greeter) greet() { // Copy of object is passed in "Ob...
4037b0fa2e4c4940dafff91167c262503e8fcfc3
2b5989f252aa71d535c775477abde54c7b3cd75c
CloudKid1273/kics
/pkg/parser/json/parser.go
Go
go
1,344
permissive
package json import ( "encoding/json" "github.com/Checkmarx/kics/pkg/model" ) // Parser defines a parser type type Parser struct { } // Resolve - replace or modifies in-memory content before parsing func (p *Parser) Resolve(fileContent []byte, filename string) (*[]byte, error) { return &fileContent, nil } // Pa...
c7999bb2da4e86d8094b27245dfa94dc2f7e895b
b4b138a6f01af0067497558ba6b569d0a41f548e
axchu/oserver
/oserver_test.go
Go
go
7,285
no_license
package oserver import ( "bytes" "fmt" "math/rand" "net/http" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // bash script to generate txns /* #!/bin/bash nloops=1 while [ $nloops -le 5 ] do echo "Sending a message at: $(($(gdate +%s%N)/1000000))" ...
9a84967a7b6065d0cbff4485fb7605f2e1a366cc
6439bad79868f78273dae6495154cffa38bc238a
mariabiubiubiu/gotest
/designPattern/facade/facade.go
Go
go
978
no_license
package facade import "fmt" //facade模块同时暴露了a和b 两个Module 的NewXXX和interface,其它代码如果需要使用细节功能时可以直接调用。 type aModuleImpl struct{} type bModuleImpl struct{} func (*aModuleImpl) TestA() string { return "A module running" } func (*bModuleImpl) TestB() string { return "B module running" } type BModuleAPI interface { Tes...
2d1784cb77f50b2affadb4ef9de2a16c7ffa3636
beb98201a79e5eca0c9b7e65de8f0f1fb4ea7b29
openebs/node-disk-manager
/cmd/ndm_daemonset/probe/seachestprobe.go
Go
go
8,240
permissive
/* Copyright 2018 OpenEBS 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, softwar...
eff1ddb9997dda54714b5d5b07a1d3f85f26af90
7f61e87a891d462bdef4f4b456f940f115d4ce90
renanferr/goprobuilds
/pkg/parser/game.go
Go
go
2,345
permissive
package parser import ( "encoding/json" "fmt" "github.com/anaskhan96/soup" goprobuilds "github.com/renanferr/goprobuilds/pkg" ) const ( TimeClass = "time" ChampClass = "champ" OpponentClass = "opponent" PlayerClass = "player gold" KDAClass = "kda" GoldClass = "_gold gold" ) func GameFrom...