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 |
|---|---|---|---|---|---|---|---|---|
b5cdf63593819016364b57cc352f1440a1cb9860 | 7d08f28cb5556dd718bb30568ec3b4676eb25d85 | kuokuanyo/admin | /plugins/admin/models/role.go | Go | go | 3,139 | permissive | package models
import (
"database/sql"
"strconv"
"time"
"github.com/GoAdminGroup/go-admin/modules/db"
"github.com/GoAdminGroup/go-admin/modules/db/dialect"
)
// RoleModel is role model structure.
type RoleModel struct {
//plugins/admin/models/base.go中
Base
Id int64
Name string
Slug string... |
27211721c2201dd5a668cebabf9194052ca6b939 | f9a1af6cb4b7fb5fae9a1003f97443fdc3c2adee | owncloud/ocis | /vendor/github.com/google/go-tika/tika/doc.go | Go | go | 2,238 | permissive | /*
Copyright 2017 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 w... |
2f634316177a44e146f68d8d6dbffb10a1b5b64f | 8a090b0b8648c419a9fa372088001417b6971233 | go-akka/akka | /root_actor_path.go | Go | go | 1,828 | no_license | package akka
import (
"strconv"
"strings"
)
var (
_ ActorPath = (*RootActorPath)(nil)
)
type RootActorPath struct {
name string
address Address
}
func NewRootActorPath(address Address, name string) ActorPath {
if len(name) == 0 {
name = "/"
}
return &RootActorPath{
name: name,
address: address... |
49d016dfa5b27bfede6fd0a5f6359685c4605f7d | 71189dbc808079024ebac2cccb4f746a174b5dea | benjaminhuo/m3db-operator | /pkg/controller/controller.go | Go | go | 24,131 | permissive | // Copyright (c) 2018 Uber Technologies, Inc.
//
// 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, modify, merge... |
0255e726620678f92eb208e9fba44e7de4d97cd8 | f629790d2d2982232e2801d9ecddc694fde00196 | yakushou730/microservices-with-go | /handlers/handlers_test.go | Go | go | 964 | no_license | package handlers
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestHandlers(t *testing.T) {
handler := http.HandlerFunc(MyHandler)
req := httptest.NewRequest("GET", "/example", nil)
recorder := httptest.NewRecorder()
handler.ServeHTTP(recorder, req)
// your can get the full response
resp := rec... |
415ad55520324cf2706a67cc6f4976ea1071b826 | d9cf546eef55a3f84dc61df8ec8b43dbd9c0b208 | WizardMerlin/gopher | /cases/file_tcp/client.go | Go | go | 1,386 | no_license | package main
import (
"io"
"net"
"fmt"
"os"
)
func main() {
//获取命令行参数 (包含要发送的文件名)
list := os.Args
if len(list) != 2 {
fmt.Println("usage : ./client filePath")
return
}
filePath := list[1] //发送给 server
info, err := os.Stat(filePath) //获取文件属性
if err != nil {
fmt.Println("err = ", err)
return
}
/... |
b14045c164faee505242d9a09833d01b504eaf14 | c9d50db4d60bd3f3ba32484c6d4bd1f6db37e31a | juangarcia4ks/virtengine | /x/audit/types/event.go | Go | go | 3,630 | permissive | package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/virtengine/virtengine/sdkutil"
)
const (
evActionTrustedAuditorCreated = "audit-trusted-auditor-created"
evActionTrustedAuditorDeleted = "audit-trusted-auditor-deleted"
evOwnerKey = "owner"
evAuditorKey ... |
b059e207b4aa1834dfa87baf353321c3c98b8634 | 19ae0728c76cbc9be4cc3894a6733fcb628afb9f | informatiCup/informatiCup2020 | /src/game/pathogens_generated.go | Go | go | 1,097 | no_license | // GENERATED CODE. DO NOT EDIT!
package game
func defaultPathogens() []*pathogen {
return []*pathogen{
newPathogen("Admiral Trips", 0.9, 0.9, 0.75, 2),
newPathogen("Azmodeus", 0.5, 0.5, 0.5, 5),
newPathogen("Bonulus eruptus", 0.0, 0.0, 0.0, 10),
newPathogen("Coccus innocuus", 0.6, 0.001, 0.02, 6),
newPatho... |
85782d8ce992551e2e7cdff293b4ce923753177e | 80be0436bab22d0101ffa33c62289625423ea020 | ionous/sashimi | /runtime/internal/queuedActions.go | Go | go | 3,986 | permissive | package internal
import (
"fmt"
E "github.com/ionous/sashimi/event"
G "github.com/ionous/sashimi/game"
"github.com/ionous/sashimi/util/ident"
)
// QueuedAction implements Future for named actions.
// ex. g.The("player").Go("jump")
type QueuedAction struct {
data *RuntimeAction
next *ChainedCallback
}
// Queued... |
1c6116e39338a8612e85b95cfdc6d9bfdba97844 | 47e43e962c8e137e5a2f81f6621b2996db8d0f2d | makupi/backend-homework | /storage/sqliteStorage.go | Go | go | 9,589 | no_license | package storage
import (
"database/sql"
"fmt"
"github.com/dgrijalva/jwt-go"
"github.com/makupi/backend-homework/models"
_ "github.com/mattn/go-sqlite3" // driver for sqlite3
"log"
)
// SqliteStorage object to access database
type SqliteStorage struct {
DB *sql.DB
}
// NewSqliteStorage Creates a local db.sqlit... |
4dd41c217ff44a2ff7f9de09889561c0da3724fb | 4de13b9e5d8214e735a65645d220621e030bf09c | zhanggbj/bosh-cli | /vendor/github.com/cloudfoundry/bosh-utils/system/os_file_system_unix.go | Go | go | 1,470 | permissive | //+build !windows
package system
import (
"fmt"
"os"
"strconv"
"strings"
bosherr "github.com/cloudfoundry/bosh-utils/errors"
)
func (fs *osFileSystem) homeDir(username string) (string, error) {
homeDir, err := fs.runCommand(fmt.Sprintf("echo ~%s", username))
if err != nil {
return "", bosherr.WrapErrorf(er... |
07e76b2d9853f2324a7acf26d7b9e7cd2605b5f4 | a0bae568bf6f48d6ac310d20ca5cff67e17c314a | benji93/udemyWebDev | /017_understanding-net-http-package/03_Request/01_ParseForm_Form/main.go | Go | go | 425 | no_license | package main
import (
"html/template"
"log"
"net/http"
)
type hotdog int
var tpl *template.Template
func init() {
tpl = template.Must(template.ParseFiles("index.gohtml"))
}
func (m hotdog) ServeHTTP(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
log.Fatalln(err)
}
tpl.Exe... |
2ada85892a11070ab72820069193747b026a1312 | 65eb4aa4ca0059ec40acbbb55bba3c82142e9647 | go-zookeeper/jute | /testdata/fixtures/zookeeper/txn/txnheader.go | Go | go | 1,895 | permissive | // Autogenerated jute compiler
// @generated from 'testdata/zookeeper.jute'
package txn // github.com/go-zookeeper/zk/internal/txn
import (
"fmt"
"github.com/go-zookeeper/jute/lib/go/jute"
)
type TxnHeader struct {
ClientId int64 // clientId
Cxid int32 // cxid
Zxid int64 // zxid
Time int64 // time... |
0615ab405504e085e0574616c8ef16c7f63dec3d | b57d5fae247544c54deb64214fc01f3768420c47 | kubernetes-sigs/cluster-api | /internal/controllers/topology/cluster/blueprint.go | Go | go | 5,989 | permissive | /*
Copyright 2021 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, ... |
17029db85cef78a522d82bb46f95e3c8b2f44b87 | cd491bc3377bee3fef05930d6a58c1bfac07db19 | lolonet-max/go-lolo | /trie/encoding_test.go | Go | go | 4,209 | no_license | // Copyright 2014 The go-lolo Authors
// This file is part of the go-lolo library.
//
// The go-lolo 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 ... |
b9942d7fab722082981ea78ef84617022cbe05fd | d4ef432dc4d3cd8ce2c02e3b7202939b0ca82ff3 | mapix/hound | /index/grep.go | Go | go | 4,689 | permissive | package index
import (
"bytes"
"compress/gzip"
"io"
"os"
"github.com/mapix/hound/codesearch/regexp"
)
var nl = []byte{'\n'}
type grepper struct {
buf []byte
}
func countLines(b []byte) int {
n := 0
for {
i := bytes.IndexByte(b, '\n')
if i < 0 {
break
}
n++
b = b[i+1:]
}
return n
}
func (g *... |
750727b45f8fe0b03b0750bc73144741ce7cbdeb | 5ed9a07669494030b8a9abfce6e8bcb89f97021f | lvisei/grdm | /internal/app/app.go | Go | go | 3,508 | permissive | package app
import (
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
"strconv"
"sync"
)
type Download struct {
Url string
FileName string
filePath string
TargetDirPath string
TotalSections int
}
// Start the download
func (d Download) Do() error {
d.filePath = fmt.... |
1a645b43219a38df2c09fdef4a6bde0f46fd4411 | d753e86c07a9af0f0859fd307b48f1cf7cbfe39d | achimid/traefik-test | /middlewares/replace_path_regex.go | Go | go | 1,185 | permissive | package middlewares
import (
"context"
"net/http"
"regexp"
"strings"
"github.com/containous/traefik/log"
)
// ReplacePathRegex is a middleware used to replace the path of a URL request with a regular expression
type ReplacePathRegex struct {
Handler http.Handler
Regexp *regexp.Regexp
Replacement str... |
f7809f01c4975db0918582014dbc6fea8cfe3462 | 96ba45c5cdbcfc5c2c9261ac97c3c409078fd9d5 | hadyanadam/go-rest-gin-getstarted | /server.go | Go | go | 1,231 | no_license | package main
import (
"io"
"net/http"
"os"
"github.com/gin-gonic/gin"
"github.com/hadyanadam/golang-tutorial-gin/controller"
"github.com/hadyanadam/golang-tutorial-gin/middlewares"
"github.com/hadyanadam/golang-tutorial-gin/service"
)
var(
videoService service.VideoService = service.New()
videoController c... |
e6cbc67c22980908aacc2684d991ebc6748dd3f7 | 54199bd9cc639a4a1c0b0c9278b50a51bcdfdbda | identw/redis-operator | /vendor/github.com/spotahome/kooper/operator/controller/leaderelection/leaderelection.go | Go | go | 4,624 | permissive | package leaderelection
import (
"context"
"fmt"
"os"
"time"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/tools/leaderelection"
"k8s.io/client-go/tools/leaderelection/resourcelock"
"k8s.io/client-go/tools/rec... |
89f9169a6212d26c6822e8983650ff25db900bef | 6999b051504e53b69ab234f7034afa5eeb50f958 | MinDekwad/WebreportBackend | /handler/amlo/handler.go | Go | go | 1,630 | no_license | package amlo
import (
"crypto/tls"
"go-api-report2/config"
"go-api-report2/log"
"go-api-report2/services/amlo"
syslog "log"
"github.com/go-resty/resty/v2"
"github.com/joho/godotenv"
)
var (
clientid, scope, redirecturi, oauth2uri string
)
type Handler struct {
amloService amlo.AmloServi... |
3f669f29a6aa00b4203eae5a9f83083b94e40125 | f97f9edf2da363a1e7e07df167691c5c03f62f19 | marcelfonteles/GoLangLearning | /src/irisProject05/main.go | Go | go | 476 | no_license | package main
import (
"github.com/kataras/iris"
_ "github.com/go-xorm/xorm"
_ "github.com/kataras/iris/hero"
)
func main() {
app := iris.New()
// Register views
app.RegisterView(iris.HTML("/home/marcelvieira/Documentos/GoLangLearning/src/irisProject05/app/views", ".html"))
//rootHandler := hero.Handler(root)
... |
26113b868d29f22a589bdfc31539a5fd8bc36a95 | 847f9f98eb8b4d1fa3474508aa4a379bd1d709a0 | qiankunshe/xcgui | /examples/shapePicture/shapePicture.go | Go | go | 496 | no_license | package main
import (
xcgui "github.com/codyguo/xcgui/xc"
)
func main() {
hWindow := xcgui.XWndCreate(0, 0, 400, 400, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
xcgui.CloseBtn(hWindow)
hPicture := xcgui.XShapePicCreate(20, 50, 100, 100, xcgui.HXCGUI(hWindow))
xcgui.XShapePicSetImage(hPicture, xcgui.XImageLoad... |
3b2f5d6a2f3250f1aecfef24349c96a57c0bba1c | 72cb0074ee2e43f761c6cec2799d34a14a092c04 | recluse-games/deviant-instance-shard | /pkg/engine/rules/processor_test.go | Go | go | 1,638 | no_license | package rules
import (
"testing"
"github.com/recluse-games/deviant-instance-shard/pkg/engine/enginetest"
deviant "github.com/recluse-games/deviant-protobuf/genproto/go/instance_shard"
"go.uber.org/zap/zaptest"
)
func TestProcess(t *testing.T) {
logger := zaptest.NewLogger(t)
logger.Sync()
entityWithEnoughCar... |
0eab7d7c275738acfd72d2aac6cbc5827160c368 | acaccabfbb8a6d52f7690c6d7eee0a0ed56ae531 | xinfei0902/fabric1.4.6--Chinese-Notes | /peer/common/broadcastclient.go | Go | go | 1,824 | permissive | /*
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... |
7367c6886b9a644eaf070c1d71069e1a9fa643e4 | 0ca36517878e213700bcbd3d483bcdc57c89c830 | mosn/istio | /security/pkg/nodeagent/test/cert_rotation/rotation_test.go | Go | go | 4,049 | permissive | // Copyright Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... |
3e6b97f8ecc598cea3eb4ab3a9f46c1f46634ca7 | f08589044d0e1b88334dc8911def551548f632da | mraksoll4/neutrino | /pushtx/error.go | Go | go | 4,635 | permissive | package pushtx
import (
"fmt"
"strings"
"github.com/mraksoll4/btcd/wire"
)
// BroadcastErrorCode uniquely identifies the broadcast error.
type BroadcastErrorCode uint8
const (
// Unknown is the code used when a transaction has been rejected by some
// unknown reason by a peer.
Unknown BroadcastErrorCode = iot... |
a0cc14a43ac4133eac8cf69fffe743b43df8b9a1 | 5889db615da7cfe2857bf85d3a9cbd9fae3d5013 | ioito/onecloud | /vendor/yunion.io/x/cloudmux/pkg/multicloud/qcloud/kafka.go | Go | go | 5,968 | 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... |
b6c542148165579f2a5edab50e4a4762f77bfe10 | 821881e6c4c0c7b66618a9eaed3812253cee717e | seanhoughton/slackbot-queue-terraform | /app/cmd/slack-relay/main.go | Go | go | 1,173 | no_license | package main
import (
"context"
"flag"
"net/http"
"os"
"time"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/seanhoughton/slackbot-queue-terraform/app/pkg/relay"
log "github.com/sirupsen/logrus"
)
var addr = flag.String("addr", ":8080", "http service address")... |
25df107565bf043c04192a0932bb998c619524b9 | 4350290fef66624090b19b18cadcf672fb762470 | puppetlabs/relay | /pkg/dev/manifests/asset.go | Go | go | 1,068 | permissive | package manifests
import (
"io"
"io/ioutil"
"path/filepath"
)
func Asset(name string) (io.ReadCloser, error) {
return assets.Open(name)
}
func AssetString(name string) (string, error) {
asset, err := Asset(name)
if err != nil {
return "", err
}
defer asset.Close()
b, err := ioutil.ReadAll(asset)
if err ... |
deef973e6b7e0c4828c61311ec29175d040a8da0 | ca0c359f335a906721e4d667d09eedffabfef7f9 | kangqing2008/tools | /test/main.go | Go | go | 348 | permissive | package main
import "fmt"
type Data struct{
Id int64
Name string
Age int8
}
func main() {
var object interface{}
var data1,data2 *Data
data1 = &Data{Id:1,Name:"kangqing",Age:34}
//data2 = Data{Id:2,Name:"mengminghui",Age:33}
object = data1
data2 = object.(Data)
fmt.Println(data1,data2)
data2.Age = 121
... |
437a8d898230803dc4e3423231de80dee3d4fcfa | 70e96257174e0c46ceedc4724ce4543e6185b2d9 | mvalles36/saas | /internal/mid/saas-swagger/example/main.go | Go | go | 4,817 | permissive | package main
import (
"context"
"geeks-accelerator/oss/saas-starter-kit/internal/platform/web/webcontext"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"geeks-accelerator/oss/saas-starter-kit/internal/mid"
saasSwagger "geeks-accelerator/oss/saas-starter-kit/internal/mid/saas-swagger"
_ "geeks-accelera... |
1c70976049de5b6c0dd1ead84bd38afcbf65ad01 | b34dbcc6a7e812b74c98b9ff73c3abde7f48f72f | codepope/flyctl | /cmd/presenters/apps.go | Go | go | 789 | permissive | package presenters
import (
"github.com/superfly/flyctl/api"
)
type Apps struct {
App *api.App
Apps []api.App
}
func (p *Apps) APIStruct() interface{} {
return p.Apps
}
func (p *Apps) FieldNames() []string {
return []string{"Name", "Owner", "Status", "Latest Deploy"}
}
func (p *Apps) Records() []map[string]s... |
8436e608cdafda63d30f947ea2a4cbd8e68448ab | 5883f1cc9f6f76ca2ce799d2ec2540aa349c74d4 | zqhong/TopList | /App/Server.go | Go | go | 1,529 | permissive | package main
import (
"fmt"
"log"
"net/http"
"os"
"os/signal"
"regexp"
"syscall"
"../Common"
"../Config"
)
func GetTypeInfo(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
log.Fatal("系统错误" + err.Error())
}
id := r.Form.Get("id")
re := regexp.MustCompile("[0-9]+")
id = ... |
d0e4cd617eeeaad3a3c054519d04d89585b26835 | 72cd7da535b333981f81454bc511bfc91b93f7bf | nicholaskh/dbproxy | /parser/tidb-types/etc.go | Go | go | 5,196 | permissive | // Copyright 2014 The ql Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSES/QL-LICENSE file.
// Copyright 2015 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in complia... |
0e23c64a686513dc9386afb30339caac535a8305 | ebcb78360e85cd078e8c674777610a2bf688bbeb | aprilsky/myRouter | /src/mux/route.go | Go | go | 14,566 | no_license | // Copyright 2012 The Gorilla 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 mux
import (
"errors"
"fmt"
"net/http"
"net/url"
"strings"
)
// Route stores information to match a request and build URLs.
type Route struc... |
f59eb6b65d2135ae0b5a4bcffb167e50df8a651b | d067184ccbf8de9bed7e8057e5bc8148465808cf | ziwon/on-the-go | /go-by-example/random-numbers.go | Go | go | 949 | no_license | package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
// 0 <= n < 100
fmt.Print(rand.Intn(100), ",")
fmt.Print(rand.Intn(100))
fmt.Println()
// 0.0 <= f < 1.0
fmt.Print(rand.Float64())
// 5.0 <= < 10.0
fmt.Print((rand.Float64()*5)+5, ",")
fmt.Print((rand.Float64() * 5) + 5)
fmt.Println()
// ... |
8c757634e21ab67b9e120a9dbf03b855f3c52c18 | 504e4c74581228a86c03c00e7e5d7964d48afb5c | beatlabs/patron | /vendor/github.com/elastic/go-elasticsearch/v8/typedapi/types/repositoriesrecord.go | Go | go | 1,472 | permissive | // Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
8535bd8f82ca85d89a55f240b317ff7494874822 | b3d4969f1c44fa1c87f3f798b9828c790df7a119 | robertkrimen/otto | /tools/gen-jscore/helpers.go | Go | go | 892 | permissive | package main
import (
"fmt"
"unicode"
)
// ucfirst converts the first rune of val to uppercase an returns the result.
func ucfirst(val string) string {
r := []rune(val)
r[0] = unicode.ToUpper(r[0])
return string(r)
}
// dict is a template helper returns a map created from alternating values.
// Values must be ... |
247952f0b339d67cf633741c372c18299e62f8aa | 1559586c96723d52d9a5c40c5d5e5b41f72d8e75 | Matthimatiker/learning-golang | /key-value-store/web_client.go | Go | go | 1,229 | no_license | package key_value_store
import (
"strings"
"bytes"
"io/ioutil"
"net/http"
)
type webClient struct {
url string
}
// Creates a new web client that interacts with the store server at the given URL.
//
// The web client itself is a SimpleKeyValueStore.
// Multiple clients can share a key value server without influ... |
855f2b249321440498974f5ac1dd1e36cc0ea892 | 5f6896debc9f31ac0328f48a6ddca00d9357afac | radanalyticsio/oshinko-cli | /vendor/github.com/openshift/origin/cmd/cluster-capacity/go/src/github.com/kubernetes-incubator/cluster-capacity/vendor/k8s.io/kubernetes/pkg/apis/batch/v2alpha1/zz_generated.conversion.go | Go | go | 10,639 | permissive | // +build !ignore_autogenerated
/*
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 applica... |
f78649a01f463fd0e300dd4e0183bc8ace7a01e7 | 473fbda871f876fca303f3c2c1145a32c6552382 | jerry-tom/bk-bcs | /bmsf-configuration/cmd/bscp-businessserver/actions/appinstance/reachable.go | Go | go | 4,256 | permissive | /*
Tencent is pleased to support the open source community by making Blueking Container Service available.
Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of... |
f72acd860133496dc4852cd3b1a263b29cf169d6 | 5f7dc4515cf3f78341da572ade86a2eaf471162a | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/streamanalytics/latest/streamingJob.go | Go | go | 25,093 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package latest
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// A streaming job object, containing all information ... |
2c13bf13a37e3c768c5cc03eee65b4900ebafebc | a8e43832f00dd70bdd4506267d830c184b07205a | KevinGrandon/yarpc-go | /yarpcconfig/chooser.go | Go | go | 10,423 | permissive | // Copyright (c) 2017 Uber Technologies, Inc.
//
// 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, modify, merge... |
1f2cd1365f4631255f2ae793b78d149dea4c030e | d738bd06900a003e1ba4833e054ba6046e97ca01 | byteball/odex-backend | /daos/token_test.go | Go | go | 1,144 | permissive | package daos
import (
"io/ioutil"
"testing"
"github.com/byteball/odex-backend/types"
"github.com/byteball/odex-backend/utils/testutils"
)
func init() {
server := testutils.NewDBTestServer()
temp, _ := ioutil.TempDir("", "test")
server.SetPath(temp)
session := server.Session()
db = &Database{Session: sessio... |
bd9ae85c0287f11a0b2a792d34e57b9762f72475 | ff58e99898d0620c341100d2c8af0d66e764df3d | tasneem-hyder/benthos | /lib/processor/metadata.go | Go | go | 5,691 | permissive | package processor
import (
"fmt"
"strings"
"time"
"github.com/Jeffail/benthos/v3/internal/bloblang"
"github.com/Jeffail/benthos/v3/internal/bloblang/field"
"github.com/Jeffail/benthos/v3/internal/docs"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/ben... |
24abd8366eb064b6ba4aeea471dcc9a46859d94b | 4a7bfe149a383a682daaec2acb42778a3acf7f79 | wugalde19/pratik | /mc1/cmd/api/main.go | Go | go | 609 | no_license | package main
import (
"flag"
"fmt"
"github.com/joho/godotenv"
"github.com/wugalde19/pratik/mc1/config"
"github.com/wugalde19/pratik/mc1/pkg/api"
)
var (
environment string
)
func main() {
flag.StringVar(&environment, "env", "", "Set the environment (testing, development, production)")
flag.Parse()
envV... |
72ddb2fb370603d96c16a6988bad936d93b0fc1f | 8387e530d5b1cc63134f5b67d0df410800cc4d61 | wangjiyou/ubolatu | /userinfo/logging.go | Go | go | 2,625 | no_license | package userinfo
import (
"time"
"ubolatu/pub"
"github.com/go-kit/kit/log"
)
type UloggingMiddleware struct {
Logger log.Logger
Next StringService
}
func (mw UloggingMiddleware) FindFans(s pub.FriendShipRequest) (output string, err error) {
defer func(begin time.Time) {
_ = mw.Logger.Log(
"method", "F... |
9ca28d058b1dd45f839195670ff0e95458399168 | 882e2c9c7e354f8c261fb2c9b60d930f94fa20af | APX103/harvester | /pkg/api/vm/formatter.go | Go | go | 4,760 | permissive | package vm
import (
"github.com/rancher/apiserver/pkg/types"
"github.com/rancher/wrangler/pkg/data/convert"
kv1 "kubevirt.io/client-go/api/v1"
"github.com/harvester/harvester/pkg/controller/master/migration"
ctlkubevirtv1 "github.com/harvester/harvester/pkg/generated/controllers/kubevirt.io/v1"
"github.com/harv... |
4a02f3f21a0ba31264d4c9aa9c5e9240e9b00741 | d2dc66bed575866d456dac0a743e0b54f3ef02ef | RudimentLLC/go-shopify | /metafields.go | Go | go | 329 | no_license | package shopify
type CreateMetafieldResponse struct {
Metafield *Metafield `json:"metafield"`
}
type Metafield struct {
ID int `json:"id,omitempty"`
Namespace string `json:"namespace"`
Key string `json:"key"`
Value interface{} `json:"value"`
ValueType string `json:"value_... |
6084ff457133e33fe2262a5bf77e88a16a72749a | 2dfdfead3e7f68606bd30552ef50dd6c3fae526f | maxcalandrelli/gocc | /internal/parser/lr1/items/testdata_test.go | Go | go | 1,338 | permissive | //Copyright 2013 Vastech SA (PTY) LTD
//
// 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... |
609d9641fef70d3e30bd3d15fbc320891e885e95 | 3347dc73f9881de496fd44dfff7936e8ea651515 | tektoncd/experimental | /notifiers/github-app/pkg/controller/template_test.go | Go | go | 1,402 | permissive | // Copyright 2020 The Tekton 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 agree... |
ee34c82a033ed2b3a3bf859c6ffae46d1ac3739d | 5e5b5ee28bc6eb88cf47015886b6f4de13dfd94d | shanghaikid/milvus | /internal/proxy/proxy.go | Go | go | 15,933 | permissive | // Licensed to the LF AI & Data foundation 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 th... |
84cba11ac28748083ec7743db874d63892b881f7 | aaff989b66ac8913a0cc3cb9710964527d2ba041 | glowkeeper/mccs-alpha | /internal/app/repositories/mongo/admin_tag_mongo.go | Go | go | 5,052 | permissive | package mongo
import (
"context"
"strings"
"time"
"github.com/ic3network/mccs-alpha/internal/app/types"
"github.com/ic3network/mccs-alpha/internal/pkg/e"
"github.com/ic3network/mccs-alpha/internal/pkg/pagination"
"github.com/spf13/viper"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/pr... |
154f0ecb02fec7cf267def7944c4a4b350e00d04 | 18b8d42e84bd80cc9d46c81405dfd9e33209b029 | MillQK/gowasm_raytracer | /raytracer/hittable/materials/metal.go | Go | go | 764 | no_license | package materials
import (
"github.com/MillQK/gowasm_raytracer/raytracer/entities"
)
type Metal struct {
Albedo entities.Vec3
Fuzz float64
}
func MakeMetal(albedo entities.Vec3, fuzz float64) Metal {
return *NewMetal(albedo, fuzz)
}
func NewMetal(albedo entities.Vec3, fuzz float64) *Metal {
if fuzz > 1.0 {
... |
e937540885e06ed5560b02a1f9168f83023aefb6 | 07d003248a42a674a4171d733abf0df8dfbb3aae | JulZimmermann/nexus | /router/auth/anonymous.go | Go | go | 825 | permissive | package auth
import "github.com/gammazero/nexus/wamp"
// anonAuth implements Authenticator interface.
type anonymousAuth struct{}
// Static instance of anonAuth. Used to enable anonymous anutentication.
var AnonymousAuth Authenticator = &anonymousAuth{}
func (a *anonymousAuth) AuthMethod() string { return "anonymo... |
e93d5690c2817056010d1d70d22f2cbeb29a1229 | 0fc818244cfcbc28f60c8f900739d02bf15f752e | wg001/starter-kit | /gateway/plugin/auth/auth.go | Go | go | 4,912 | no_license | package auth
import (
"crypto/rsa"
"github.com/micro/go-micro/util/log"
"net/http"
"strings"
"github.com/casbin/casbin/v2"
"github.com/casbin/casbin/v2/persist"
"github.com/dgrijalva/jwt-go"
"github.com/dgrijalva/jwt-go/request"
"github.com/dgrijalva/jwt-go/test"
"github.com/micro/cli"
"github.com/micro/g... |
7f7170261d762e67768e639b2f8e4b13f32aa305 | 032190636a3535de18e354814f822362aa2df868 | kshithijiyer/gvisor | /runsc/sandbox/sandbox.go | Go | go | 31,286 | permissive | // Copyright 2018 The gVisor 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 agree... |
4f40df7c83b03c3bcd209daf34c61bb752a90304 | 7553ec66d78328c3ea7b55e44d37a6d73a13b895 | tokillabeast/golang-todo | /backend/database/todo.go | Go | go | 2,164 | no_license | package database
import (
"log"
"time"
r "gopkg.in/gorethink/gorethink.v3"
e "github.com/tokillamockingbird/golang-todo/backend/errors"
"github.com/tokillamockingbird/golang-todo/backend/models"
)
const TodoTable = "todos" // FIXME: is it a best way to store table name?
func GetTodos() models.Todos {
todos :... |
c73b0dcfd7d7549dd3590d3ec924eb9d37a8478b | 8e2b4f584bbefd8abb50c235575dbb606ff7934a | hkl-iii/interfaces | /main.go | Go | go | 1,440 | no_license | package main
import "fmt"
type bot interface {
// define a set of methods/functions (behavior)
getGreeting() string
}
// design algorithm
// Generics Code
// Dependency Injection
// frontend
// web apps
// HTML, CSS, Bootstrap
// Angular, Vue.js, React.js(Redux) -> Components
// programming language -> JavaScrip... |
8a5fa8bd3a638c2396add1db614e17f8a5b9e5dc | 9f6aadbdf309da7f81b64ca8f2b48477bd842131 | hwholiday/learning_tools | /go-kit/v2/v2_transport/ZapLogErrorHandler.go | Go | go | 450 | permissive | package v2_transport
import (
"context"
"fmt"
"github.com/hwholiday/learning_tools/go-kit/v2/v2_service"
"go.uber.org/zap"
)
type LogErrorHandler struct {
logger *zap.Logger
}
func NewZapLogErrorHandler(logger *zap.Logger) *LogErrorHandler {
return &LogErrorHandler{
logger: logger,
}
}
func (h *LogErrorHan... |
3f398cee8a2598ed0af5ee4b41f0819e103e8562 | 4e9f00b89cfc1014cc2f2758e0de3c71ac51a03d | peter-mcconnell/blockchain-serverclient-demo | /server/main.go | Go | go | 1,109 | no_license | package main
import (
"log"
"net"
"github.com/pemcconnell/blockchain/proto"
"github.com/pemcconnell/blockchain/server/blockchain"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
func main() {
listener, err := net.Listen("tcp", ":8080")
if err != nil {
log.Fatalf("Unable to listen on 8080: %v", err)
... |
915ecf7146fc14d44fefd233f47f9c7ce55d2f5e | 1a020ef32929ce44601f1c7bc7d6fa5753d3b231 | Ma3k4H3d/GithubHack | /x-patrol/util/githubsearch/github.go | Go | go | 2,975 | no_license | /*
Copyright (c) 2018 sec.xiaomi.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, modify, merge, publish, distribute,... |
248f883345c723ad88c14ca1c7c4f4116d8138e9 | d4caaf69014299c4e4f7579ccebcb3a9b7b6d0d7 | OctopusLian/go-basic-advanced-course | /basic/day10/07读取内容.go | Go | go | 1,180 | no_license | package main
import (
"os"
"fmt"
"io"
"bufio"
)
func main0701() {
//只读方式打开文件
//fp, err := os.Open("D:/a.txt")
fp, err := os.Open("D:/dict.txt")
if err != nil {
fmt.Println("打开文件失败", err)
return
}
defer fp.Close()
buf := make([]byte, 10)
//块读取
//n, _ := fp.Read(buf)
//
//fmt.Print(string(buf[:n]))
... |
d2eb5252535154c1401586a8ec28b530f29e7982 | b65223f6651341cbc1361233b9311c1e3f83f58a | alex-berger/gatekeeper | /pkg/audit/manager.go | Go | go | 28,051 | permissive | package audit
import (
"context"
"encoding/json"
"flag"
"fmt"
"strconv"
"strings"
"time"
"github.com/go-logr/logr"
opa "github.com/open-policy-agent/frameworks/constraint/pkg/client"
constraintTypes "github.com/open-policy-agent/frameworks/constraint/pkg/types"
"github.com/open-policy-agent/gatekeeper/pkg/... |
ca0a6458dbf35eaefe37f54f8763670b9474029d | c982654d1fc1e032173b809fc829c9c85908498d | shortthirdman/code-eval-challenges | /moderate/sum4.go | Go | go | 708 | permissive | package main
import (
"bufio"
"fmt"
"log"
"os"
"sort"
"strings"
)
func numzero(t []int, c, z int) int {
switch {
case c == 0:
if z == 0 {
return 1
}
return 0
case len(t) < c || z+c*t[0] > 0 || z+c*t[len(t)-1] < 0:
return 0
default:
return numzero(t[1:len(t)], c-1, z+t[0]) + numzero(t[1:len(t)],... |
77d7d28f1be344ad47f225de24dc0a2b36cfdb18 | a3d8c36bdbd9c1e749ebead77a3708e10e441d11 | saromanov/redisvars | /redisdict_test.go | Go | go | 1,274 | permissive | package redisvars
import (
"testing"
)
func TestBasicGetting(t *testing.T) {
rv := New("localhost:6379")
dict := rv.NewDict()
key := "A"
value := "B"
dict.Delete(key)
dict.Set(key, value)
dict.Commit()
result := dict.Get(key)
if result != value {
t.Errorf("%s not match %s", result, value)
}
}
func TestG... |
1856a99c2e236ecea7ea95b591176a8f83aac852 | 6b25969be7a81e7767bc9b4e3487e3327b4d9424 | chenstar2020/stardb | /cmd/cmd_set.go | Go | go | 3,276 | no_license | package cmd
import (
"github.com/tidwall/redcon"
"stardb"
"strconv"
)
func sAdd(db *stardb.StarDB, args []string) (res interface{}, err error) {
if len(args) <= 1{
err = newWrongNumOfArgsError("sadd")
return
}
var members [][]byte
for _, m := range args[1:]{
members = append(members, []byte(m))
}
var ... |
38c7ea667f74a66458630cdc92d30708af45bd08 | f73acc0a0fe290559bcdba6611fc7713cd57b584 | LeoVerto/mumbledj | /interfaces/track.go | Go | go | 555 | permissive | /*
* MumbleDJ
* By Matthieu Grieger
* interfaces/track.go
* Copyright (c) 2016 Matthieu Grieger (MIT License)
*/
package interfaces
import "time"
// Track is an interface of methods that must be implemented by tracks.
type Track interface {
GetID() string
GetURL() string
GetTitle() string
GetAuthor() string... |
390a350f6d10aa44dd7b4f3e2a9e7a5e48b3fad2 | 4bbdd357eae2cf0baaabdb2e2d59ba50dd26d096 | fpapoila/torrent-web-seeder | /server/services/stat.go | Go | go | 7,007 | permissive | package services
import (
"context"
"fmt"
"net"
"os"
"os/signal"
"sync"
"syscall"
"time"
"github.com/pkg/errors"
"github.com/urfave/cli"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/reflection"
"google.golang.org/grpc/status"
"github.com/anacrolix/torrent"
log "gi... |
a2f95f3925a7ef2dfe7777bed950736473daf929 | 7bf7daf265d6b02fac743314647ed8e9859f5a01 | rutan/yarujan | /lib/routes/index.go | Go | go | 675 | no_license | package routes
import (
"encoding/json"
"github.com/rutan/yarujan/lib/uploader"
"github.com/zenazn/goji/web"
"net/http"
"os"
)
type ImageIndex struct {
Images []Image `json:"images"`
}
func Index(c web.C, w http.ResponseWriter, r *http.Request) {
client := uploader.New()
list, err := client.GetURLList(os.Get... |
d9511034d867da43fb094c6ef72cbd846e50a269 | 39c945cfcb97cfe3805ebc142c405a21f3031fa0 | confluentinc/azure-sdk-for-go | /profiles/preview/preview/machinelearning/mgmt/commitmentplans/models.go | Go | go | 6,855 | permissive | // +build go1.9
// Copyright 2019 Microsoft Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appl... |
e47ed8b84d1f21af3145a6b5ca6533dae089823d | 50e47714103ee2dd3877d31cbc5934d2ffadd650 | feulf/lnd | /fundingmanager.go | Go | go | 94,208 | permissive | package main
import (
"bytes"
"encoding/binary"
"fmt"
"net"
"sync"
"sync/atomic"
"time"
"google.golang.org/grpc"
"golang.org/x/crypto/salsa20"
"github.com/boltdb/bolt"
"github.com/davecgh/go-spew/spew"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetw... |
3174d2a7b6041ec8c2e7a666a3627979b5e873ff | 9f43a0e09a38936ed0673c32426afa21ab3e6305 | kamalmarhubi/rkt | /rkt/config/config_test.go | Go | go | 8,165 | permissive | // Copyright 2015 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
b402df071bf465935e5a19ca61054a9715bb7a13 | 90bd7360b0fbc6ab2d067e7503412f24d372c8c7 | MFrank2016/kcl | /commands/admin/topic/topic.go | Go | go | 9,990 | no_license | // Package topic contains topic related utilities and subcommands.
package topic
import (
"context"
"encoding/hex"
"errors"
"fmt"
"os"
"strconv"
"strings"
"github.com/spf13/cobra"
"github.com/twmb/franz-go/pkg/kerr"
"github.com/twmb/franz-go/pkg/kmsg"
"github.com/twmb/kcl/client"
"github.com/twmb/kcl/co... |
cddadde34d0cf654a67e8cf809f706e3741f8fb4 | 171b627fd8fdcde678ed9d3a8efb2b9fd50709fc | d5ve/git-notes | /git_test.go | Go | go | 10,410 | permissive | package main
import (
"fmt"
"git-notes/internal/test_helpers"
"log"
"os"
"testing"
"github.com/stretchr/testify/assert"
)
var Branch string = fmt.Sprintf("branch-%d", os.Getpid())
func assertState(t *testing.T, path string, expectedState State) {
gogit := GitCmd{}
state, err := gogit.GetState(path)
assert.... |
ec5bc53a6830ee44cbde69f6b23f1c91d84345cd | 07fe7a34b319c4630c6686d58b28f7b88e97ad6c | AlexanderYAPPO/telegram | /configs_test.go | Go | go | 10,967 | permissive | // telegram_test package tests only public interface
package telegram_test
import (
"encoding/json"
"net/url"
"reflect"
"testing"
"github.com/bot-api/telegram"
"gopkg.in/stretchr/testify.v1/assert"
)
func TestMeCfg(t *testing.T) {
name := "getMe"
c := telegram.MeCfg{}
assert.Equal(t, name, c.Name(), "method... |
7509017d24c066dbc003ebc87398b0e569dbd7e4 | fb68ab6f9985db9c3f4e03381fe30e00fa0df73c | vin-vadim/email | /model.go | Go | go | 310 | no_license | package email
// MailConfig contain all configs for service
type MailConfig struct {
URL string `json:"url,omitempty"`
Port string `json:"port,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
}
|
b63d9e81769a1ed6b39d39928ed70cd32f162021 | e69def67c314fab4ccf22a54be2d3cc552538ff4 | de-don/exercism-go | /bank-account/bank_account.go | Go | go | 631 | no_license | package account
import "sync"
type Bank struct {
balance int
open bool
sync.Mutex
}
func Open(sum int) *Bank {
if sum < 0 {
return nil
}
bank := Bank{balance: sum, open: true}
return &bank
}
func (b *Bank) Balance() (int, bool) {
if b.open {
return b.balance, true
}
return 0, false
}
func (b *Ban... |
58ce4a3e6a7e9f567d2d0a352d6a5b28973d9c52 | fd377eb35d800debb3e24f9d51442ad5b1d3fb92 | jokerYellow/the-go-programming-language-note | /ch8/8.8/du/du_test.go | Go | go | 272 | no_license | package du
import (
"testing"
)
var dir = "/Users/pipasese/Documents/code"
func TestDu(t *testing.T) {
du([]string{dir})
}
func TestDuProgress(t *testing.T) {
duShowProgress([]string{dir})
}
func TestDuFaster(t *testing.T) {
duShowProgressFaster([]string{dir})
}
|
65fca00ddfb70e92d16fe132b677b6170e5265ed | b560f2804b98c9bd3bce10dba6b9ee94ddff17ce | pucminas-luigidomenico/lpa | /trabalhos/uva_108_maximum_number/main.go | Go | go | 828 | no_license | package main
import (
"fmt"
)
type IntMatrix [][]int64
type IntArray []int64
func Max(x, y int64) int64 {
sub := x - y
signal := sub >> 31
max := x - (sub & signal)
return max
}
func (a IntArray) MaxSum() int64 {
currSum := a[0]
maxSum := a[0]
for i := 1; i < len(a); i++ {
currSum += a[i]
currSum = Max... |
3fc216507247a76190940e4bf5daf9ded1453ef9 | 8c1415f59d0cfd1056e058fb83ca2f469e248bd9 | yanzhen74/gofront | /src/model/non_real_file_state.go | Go | go | 839 | no_license | package model
import (
"github.com/yanzhen74/gofront/src/gofrontdb"
)
type Non_Real_File_state struct {
Identify int64 `xorm:"pk autoincr notnull"` //自增id
MsgTag string `xorm:"notnull"`
MsgType string `xorm:"notnull"`
MissionID string `xorm:"notnull"`
Subtype string `xorm:"notnull"... |
a74f4cb71ad3b51b4defb9867b60d8205fca4ad2 | e82e79de899eba729ce692e63addfd23cad6977a | myfantasy/myfdbstorage | /storage_I_test.go | Go | go | 1,461 | no_license | package myfdbstorage
import (
"io/ioutil"
"os"
"testing"
)
func TestStorageLoadI(t *testing.T) {
s, err := StorageLoad([]byte("{}"))
if err != nil {
t.Fatalf("StorageLoad Fail")
}
err = s.AddTableI("tst", IStorageSimpleName, make(map[string]interface{}))
if err != nil {
t.Fatalf("AddTableI Fail")
}
... |
812aeb34305a05684295861f1dc1bf4ba47e49c1 | 7829aea364b9e417badcb12d8f03625feee17915 | marcuswestin/go-x-do | /do-async.go | Go | go | 2,212 | permissive | package do
import (
"encoding/json"
"errors"
"fmt"
"log"
"runtime/debug"
"strings"
)
// Async executes a function asyncronously, and returns a channel
// which will contain the functions return error value. If the
// function panics, Async recovers the panic and sends an error
// containing the panic error mess... |
06a49a7fd8582b3cc7c32106ea63dc4e63c05ce6 | 844d1b236e813ea0e596efdbc417dae5bd800808 | sysread/skewer | /skewer.go | Go | go | 5,643 | permissive | // Package skewer - a mergable priority queue
//
// Skew heaps implement a priority queue (min heap) using a binary heap which
// is continually rebalanced with each Put and Take operation. Skew heaps have
// an ammortized performance slighter better than O(log n).
//
// The key feature of a skew heap is that it may b... |
f16d3ff3ee033146879c709a446b23c66d1e9d78 | fd76037b3056da320bdc464c94053410e47d4b11 | knightjdr/prohits-viz-analysis | /pkg/tools/analyze/scv/scv.go | Go | go | 890 | permissive | // Package scv creates circular heat maps for conditions
package scv
import (
"github.com/knightjdr/prohits-viz-analysis/pkg/types"
)
// Generate is the entry point for correlation analysis.
func Generate(analysis *types.Analysis) {
createFolders(analysis.Settings)
idMaps := mapIDs(analysis)
data := make(map[st... |
e60ae0c01fb3e0ca30f03dae7813db0c86e083d5 | 2e0a59ea0aa81208657f9667b143690ba68cbdf2 | mackenza/micro | /cmd/micro/messenger.go | Go | go | 9,460 | permissive | package main
import (
"bufio"
"bytes"
"fmt"
"os"
"strconv"
"github.com/zyedidia/clipboard"
"github.com/zyedidia/tcell"
)
// TermMessage sends a message to the user in the terminal. This usually occurs before
// micro has been fully initialized -- ie if there is an error in the syntax highlighting
// regular e... |
4fbc49c1f1ac0ba897bfe29f9cb544d62351fff2 | 6452da824effbd47e69841c4fcad2ab4bd90b501 | gotrix/cli | /components/components.go | Go | go | 3,322 | permissive | package components
import (
"crypto/rand"
"encoding/hex"
"fmt"
"os"
"path/filepath"
"strings"
)
// Info struct.
type Info struct {
Name string
Dir string
GoPath string
TemplatePath string
AsyncJsPaths []string
DeferJsPaths []string
JsPaths []string
AsyncCssPaths []stri... |
75996ffa715a94ec5e130100f1fc4b94fd3658e5 | d5b7e783b86e963a68c457654d6e9dfe74606335 | UnquietCode/terraform-provider-cloudformation | /provider/cfn/services/route53/property_hosted_zone_hosted_zone_tag.go | Go | go | 1,018 | no_license | // This file is generated, and any modifications will be lost when the
// file is next recreated.
//
// Generated on 26-12-2019, using version 0.0 of the cfn terraform provider,
// and version 10.1.0 of the CloudFormation resource specification.
//
// For more information, visit:
// http://docs.aws.amazon.com/AWSClou... |
7cc8ba294b2bb0a95e8936e2b371eedc9c24907e | 965345bf7fdcc76b2da63ec9a56f13eaf97d92aa | wangzhilin90/cht_go | /src/cht/models/gettenderredbag/gettenderredbag_test.go | Go | go | 849 | no_license | package gettenderredbag
import (
_ "cht/initial"
"testing"
)
func NewTenderRedbagRequest(user_id int32, tenderid int32, redid int32, tendermoney string, timelimit int32) *TenderRedbagRequest {
return &TenderRedbagRequest{
UserId: user_id,
TenderId: tenderid,
RedId: redid,
TenderMoney: tenderm... |
6e163b030fe8b5d3657188f83c2d7e1712953e0d | d8afa1d6f6c05dbe469673e4683babccecb5acc6 | nankeen/protecc | /main.go | Go | go | 990 | permissive | package main
import (
"flag"
"github.com/nankeen/protecc/proxies"
"log"
"net/http"
)
var proxyTargetHost = flag.String("target", "localhost", "Where the requests should be proxied to.")
var proxyListen = flag.String("listen", "localhost:1337", "Where the proxy server listens on")
func whitelistMethods(next http.... |
c1597f0ba0209ecdf9561dba98957d6b10c3abaf | f5f1549b8b663dfd3edda73ca51e9b5234d38bb2 | icodus/go-mysqldumper | /dumper.go | Go | go | 6,438 | no_license | package mysqldumper
import (
"database/sql"
"fmt"
"strings"
"github.com/sirupsen/logrus"
)
type Dumper struct {
db *sql.DB
config *Config
logger *logrus.Logger
}
func New(config *Config, db *sql.DB, logger *logrus.Logger) *Dumper {
if logger == nil {
logger = logrus.StandardLogger()
}
return &Dumper... |
4d77be3fc0a93452b898fa9527076d47cb2160cc | 8dddfaab426fdc7197126ad0c920426a63c5d045 | jeukku/go-ssb-room | /internal/maybemod/multicloser/multicloser.go | Go | go | 799 | permissive | // SPDX-FileCopyrightText: 2021 The NGI Pointer Secure-Scuttlebutt Team of 2020/2021
//
// SPDX-License-Identifier: MIT
package multicloser
import (
"fmt"
"io"
"sync"
"github.com/ssb-ngi-pointer/go-ssb-room/v2/internal/maybemod/multierror"
)
type Closer struct {
cs []io.Closer
l sync.Mutex
}
func (mc *Close... |
1f09c1bfa1cc3fa2e257834f9a85048f8f3033e1 | 09eae069847f41af626e3af582abc3a46b0baba0 | wanxingroup/fanli-goods | /pkg/restful/common/validator/validator.go | Go | go | 2,917 | no_license | package validator
import (
"fmt"
validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/sirupsen/logrus"
"reflect"
)
const ValidateParamError = "validate_param_error"
type Validatable interface {
Validate() error
}
type ValidateError struct {
Field string
Code string
Message string
}
func (es ... |
0e68572ea549f84aa129cf2e4012ce3798fb8ee2 | 25d5b6e2746575e8e52d3da4bb98f1094630851d | dzins/bedrock | /test/bedrock_Azure_single_cosmos_mongo_test.go | Go | go | 8,427 | permissive | package test
import (
"fmt"
"github.com/gruntwork-io/terratest/modules/k8s"
"github.com/gruntwork-io/terratest/modules/random"
"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/otiai10/copy"
"log"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
)
func TestIT_Bedrock_Azure_Single_KV_Cos... |
29dea82b7676126a4d639629ad51a80fe240d38a | 2d3b7dc6acd079429dd27e399c308e255503923d | 193792768lyw/study-2021 | /example/hpg-slice/slice_test.go | Go | go | 2,300 | no_license | package main
import (
"fmt"
"math/rand"
"os"
"runtime"
"testing"
"time"
)
func printLenCap(nums []int) {
fmt.Printf("len: %d, cap: %d %v\n", len(nums), cap(nums), nums)
}
func TestSliceLenAndCap(t *testing.T) {
nums := []int{1}
printLenCap(nums) // len: 1, cap: 1 [1]
nums = append(nums, 2)
printLenCap(nums... |
fa32ad85ff8f73ef389830f61e5963be70d41466 | a6649a092bb5df85ee106efebfb508645644bd4e | hi-im-aren/pipeline | /internal/istio/grafana.go | Go | go | 4,373 | permissive | // Copyright © 2019 Banzai Cloud
//
// 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 ... |
78dbfaceee37100c22f249eb1f2cf311ef4d7980 | 02ad0e106a5495ed345fb65cd8d181ba2edb641d | steppefox/remark | /app/migrator/migrator_test.go | Go | go | 3,230 | permissive | package migrator
import (
"io/ioutil"
"os"
"testing"
"github.com/coreos/bbolt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/umputun/remark/app/store/service"
"github.com/umputun/remark/app/store/engine"
)
func TestMigrator_ImportDisqus(t *testing.T) {
defer func() ... |
4637debb9e64b8c2ffce3dcec587a2c1aa0941f4 | 00499235db92181d451290550be9552a2aff19ca | wyaow/gtoken | /gtoken/gtoken_test.go | Go | go | 5,820 | permissive | package gtoken_test
import (
"github.com/goflyfox/gtoken/gtoken"
"github.com/gogf/gf/frame/g"
"testing"
)
func TestAuthPathGlobal(t *testing.T) {
t.Log("Global auth path test ")
// 启动gtoken
gfToken := >oken.GfToken{
//Timeout: 10 * 1000,
AuthPaths: g.SliceStr{"/user", "/system"}, ... |
8254236bf401f78cd938e3a0748aabed31318783 | 3e1ffd38a76e5088a557e9dd3da1cbeac53c7e6a | prasmussen/glot-code-runner | /language/groovy/groovy.go | Go | go | 250 | permissive | package groovy
import (
"github.com/prasmussen/glot-code-runner/cmd"
"path/filepath"
)
func Run(files []string, stdin string) (string, string, error) {
workDir := filepath.Dir(files[0])
return cmd.RunStdin(workDir, stdin, "groovy", files[0])
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.