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 |
|---|---|---|---|---|---|---|---|---|
0fd78e8c63cb6217c1f96a145b780353bb9063bf | b8a005adc07459fbb6a4813dc67b2b7380786192 | hvnsweeting/gone | /daemon/run.go | Go | go | 12,276 | permissive | package daemon
import (
"context"
"errors"
"fmt"
"github.com/One-com/gone/daemon/ctrl"
"github.com/One-com/gone/daemon/srv"
"github.com/One-com/gone/sd"
"os"
"sync"
"syscall"
"time"
)
// CleanupFunc is a function to call after a srv.Server is fully exited.
// A slice of CleanupFunc will be called after all ... |
5be7243c9237a21d7a6b88ad49853973d374000b | b7a7507487a20ecf417807b6699d47eaa2c6c88f | kafkasl/tir-library | /controllers/reviewsControllers.go | Go | go | 914 | permissive | package controllers
import (
"encoding/json"
"github.com/gorilla/mux"
"github.com/kafkasl/tir-library/models"
u "github.com/kafkasl/tir-library/utils"
"net/http"
)
func CreateReview(w http.ResponseWriter, r *http.Request) {
user := r.Context().Value("user").(uint) // Grab the id of the user that send the reque... |
b28a8643a6f2d8c868b5b9e52ddd1709ff3f8917 | aa4e9dddcbdb71905cafabf9f57d6c0e4772ab26 | ASMlover/study | /go/go-base/demo/demo00/main.go | Go | go | 1,563 | no_license | /*
* Copyright (c) 2013 ASMlover. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list ofconditions ... |
d7d8fc6a8e4018fc18c49f4f837017d09273d2d2 | 7a6576e56e3f449916b8f459f0076e33733a54fe | lkeix/gosl | /examples/gm_bspline02.go | Go | go | 1,091 | permissive | // Copyright 2016 The Gosl Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import (
"github.com/cpmech/gosl/gm"
"github.com/cpmech/gosl/plt"
)
func main() {
T1 := []float64{0, 0, 0, 1, 1, 1}
s1 :... |
7fa4423336215438520767e48bfca7c8efa25caf | f7f178dc728860dd38af5e2663d078b821e7b9fd | iij/legs-client | /daemon/model/routing_test.go | Go | go | 2,200 | permissive | package model
import "testing"
import "github.com/stretchr/testify/assert"
type params map[string]string
func TestComparePath(t *testing.T) {
tests := []struct {
input string
target string
wantOK bool
wantParams map[string]string
}{
{input: "", target: "hoge/path", wantOK: false, wantParams:... |
0291a8d170935591d3d2d4ce2f13d1385201d303 | de3d67c17cc21d4ae0f9d9a96a4a29811ed54169 | spohnan/origin | /pkg/cmd/server/kubernetes/master.go | Go | go | 6,665 | permissive | package kubernetes
import (
"fmt"
"io/ioutil"
"net"
"os"
"github.com/emicklei/go-restful"
"github.com/golang/glog"
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
"github.com/Google... |
54c591a713f5a96860d88738f1b3475a2217ad35 | 93010631f3c8db392240c6facb07bb18d5b800e9 | surajssd/fabric8-oso-proxy | /integration/try/condition.go | Go | go | 3,104 | permissive | package try
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
"strings"
"github.com/docker/libkv/store"
)
// ResponseCondition is a retry condition function.
// It receives a response, and returns an error
// if the response failed the condition.
type ResponseCondition func(*http.Response) error
// BodyContains ... |
a730f072d26d9245014b80cbf038e98dcd382dbb | cd4239d23032a748a317be7ca0e6c7373f151c31 | wojtek0806/f5-rest-client | /f5/ltm/monitor_smtp.go | Go | go | 2,179 | permissive | // Copyright e-Xpert Solutions SA. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ltm
import "github.com/e-XpertSolutions/f5-rest-client/f5"
type MonitorSMTPConfigList struct {
Items []MonitorSMTPConfig `json:"items"`
Kind ... |
e05cdff4189c76ed1b72c9502c831cc8bac29fb5 | 65697d8c6f00917891a1a2caff088afc49f79c4c | nikunjgit/crypto | /vendor/github.com/preichenberger/go-coinbase-exchange/message.go | Go | go | 938 | permissive | package coinbase
type Message struct {
Type string `json:"type"`
ProductId string `json:"product_id"`
TradeId int `json:"trade_id,number"`
OrderId string `json:"order_id"`
Sequence int64 `json:"sequence,number"`
MakerOrderId string `json:"maker_order_id"`
TakerOrderId s... |
6cf421596cee190850f31c0b710b9da363e156e5 | 4174dc7afebf343cb8cd5bc0b7889d520ba8fc33 | pavan1612/GoBasics | /Struct/struct.go | Go | go | 1,700 | no_license | package main
import (
"fmt"
"reflect"
)
// Creating a struct for Employee similar to creating a class
type Employee struct { // Capital letter for Employee meaning it can be exported
id int `required:"Yes"` // Can have Tags like this but it doesnt mean anything to the compiler other than text
name strin... |
078e3b98ca3d29c8ac4e076f8794e4e5d478cad3 | afeb5a5f4167fb24d421f01b7bd941338e2dcab2 | ppwfx/go-rdfgen | /gen/schema/SaleEvent.go | Go | go | 231 | no_license | package schema
type SaleEventTrait struct {
}
type SaleEvent struct {
MetaTrait
SaleEventTrait
EventTrait
ThingTrait
AdditionalTrait
}
func NewSaleEvent() (x SaleEvent) {
x.Type = "http://schema.org/SaleEvent"
return
}
|
30578710f1cebbffa55162c10cd1323a3fe78c06 | a23c99a201808ee609eeac7a70cbfd0d28ca3a4a | mohammadiliyash/ms-contact-manager | /app/routes/constants.go | Go | go | 447 | permissive | package routes
const routeNameHeartbeat = "heartbeat"
const routeNameSayError = "say-error"
const routeNameAddContact = "contact"
const routeNameAppHeartbeat = "app-heartbeat"
const routeNameAppSayError = "app-say-error"
const pathHeartbeat = "/"
const pathSayError = "/error"
const pathLookup = "/postal-codes/{code}... |
cc3f39513da39462ec8118e247d80ca50282d9a6 | d1022a26f626d576059a91259dc7ae1058218afc | zenreach/goa | /goagen/codegen/types.go | Go | go | 24,987 | permissive | package codegen
import (
"bytes"
"fmt"
"sort"
"strings"
"text/template"
"unicode"
"github.com/goadesign/goa/design"
"github.com/goadesign/goa/dslengine"
)
// TransformMapKey is the name of the metadata used to specify the key for mapping fields when
// generating the code that transforms one data structure i... |
e0a7025073c89b97dff0e6ab1221b26767f64ff6 | 3e65f982554dfee214e12bff8e1626ce87da458a | etsangsplk/quotaservice | /rpc.go | Go | go | 1,684 | permissive | // Licensed under the Apache License, Version 2.0
// Details: https://raw.githubusercontent.com/square/quotaservice/master/LICENSE
package quotaservice
import "time"
// QuotaService is the interface used by RPC subsystems when fielding remote requests for quotas.
type QuotaService interface {
// Allow will tell you... |
103d17ed25c3b87590cc96c7160721ed975eb40c | e0cab1f524cc06709b847453d70baffbd9dcdafa | google/gvisor | /test/benchmarks/tools/hey_test.go | Go | go | 2,495 | permissive | // Copyright 2020 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... |
08415c99ba21b89ff5be231e2e1cd399cf71f39c | 88eceadea547293f4e1a47d159c1bc3056f5e122 | drewlesueur/gopolyline2 | /polyline/polyline_test.go | Go | go | 1,081 | permissive | package polyline
import "testing"
func TestEncodeUint(t *testing.T) {
for _, c := range []struct {
u uint
want string
}{
{
u: 174,
want: "mD",
},
} {
if got := EncodeUint(c.u, nil); string(got) != c.want {
t.Errorf("EncodeUint(%v) = %v, want %v", c.u, string(got), c.want)
}
}
}
func Te... |
fa152a8b4c897304cd3df50f9fd41c4ab65263c8 | e2024551bc7f77ac0e4d91a41d0158350510184d | chasingSublimity/mecleod-go | /07_data-structures/04_Struct/03_user_defined_types/02/main.go | Go | go | 429 | no_license | package main
import "fmt"
type foo int
func main() {
var myAge foo
myAge = 44
fmt.Printf("%T %v \n", myAge, myAge)
var yourAge int
yourAge = 29
fmt.Printf("%T %v \n", yourAge, yourAge)
// this doesn't work
// fmt.Println(myAge + yourAge) // -> invalid operation: myAge + yourAge (mismatched types foo and in... |
7e84f97057f89d3012daacce13acab1663dd713d | 8569f799bcd9a4395f50cc51fdbcc07ecdb23f0e | chenyongze/go-api | /controllers/code.go | Go | go | 3,365 | no_license | /**********************************************
** @Des: This file ...
** @Author: yongze.chen
** @Date: 2017-09-09 12:53:05
** @Last Modified by: yongze.chen
** @Last Modified time: 2017-09-25 18:50:54
***********************************************/
package controllers
import (
"fmt"
"strings"
"time"
"githu... |
aea08f17ae08017ae543166eb0add27f55c7d59d | c229bf759c8d836b71cb16001c451dca3471147e | bear2b/kafka-helpers | /consumer.go | Go | go | 2,718 | no_license | package kafka
import (
"context"
"log"
"strings"
"github.com/Shopify/sarama"
)
// IncomingMessage represent a message
type IncomingMessage struct {
Topic string
Value string
}
// ConsumerHandlerFunc will be called to process a message
type ConsumerHandlerFunc func(context.Context, IncomingMessage)
// Consume... |
ed03733ece0773338a9e4535d60370a54bdc702d | e710926210a185cc9d219558096acae3a94988f2 | rollbar/docker | /utils/fs.go | Go | go | 1,809 | permissive | package utils
import (
"fmt"
"os"
"path/filepath"
"strings"
"syscall"
)
// TreeSize walks a directory tree and returns its total size in bytes.
func TreeSize(dir string) (size int64, err error) {
data := make(map[uint64]bool)
err = filepath.Walk(dir, func(d string, fileInfo os.FileInfo, e error) error {
// I... |
69c4facedfea8b7c84e79dc1f94d8e0b0c0fae9a | 804c26421fb043e0eba861912881da780b640d0d | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/eventgrid/v20200401preview/getPartnerTopicEventSubscription.go | Go | go | 3,551 | 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 v20200401preview
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func LookupPartnerTopicEventSubscription(ctx *pulumi.Context, args *LookupPartner... |
8b78d8434e05e0e6afd1f5d25926cd459952312a | 5b3e2d80ce9aeee7ad46a3421304b644fc273220 | iqbalnur32/seri-belajar-golang | /function/passing_value.go | Go | go | 569 | no_license | package main
import "fmt"
/*
Pass Value Refrence By Interface with pointer
*/
func main(){
var result Pedagang
ParamsPedagangInterface(&result)
fmt.Println(result)
}
type Pedagang struct {
ID string
Nama string
Jualan string
}
func ParamsPedagangInterface(result interface{}) {
// switch a := result.(type) {... |
d8aaea3c05d749a51ad7129b2d704ae42fa42b1f | aee5666964f955fa10f0eccbb3de79a7866f81d1 | Ronsor/jangle-server | /api_auth.go | Go | go | 1,766 | permissive | package main
import (
"log"
"time"
"jangled/util"
"github.com/fasthttp/router"
"github.com/globalsign/mgo/bson"
"github.com/valyala/fasthttp"
)
func InitRestAuth(r *router.Router) {
log.Println("Init /auth endpoints")
type APIReqPostRegister struct {
Username string `json:"username" validate:"min=2,max=3... |
c810070eb498d2c898c096da7fdde5243f145725 | 1cad4a92b0651ebc6ddbcc92245c2512c7ff366f | digibib/koha-rfidhub | /config.go | Go | go | 407 | no_license | package main
type config struct {
// Port which RFID-unit is listening on
// TODO rename
TCPPort string
// Listening Port of the HTTP and WebSocket server
HTTPPort string
// Adress (host:port) of SIP-server
SIPServer string
// Credentials for SIP user to use in rfid-hub
SIPUser string
SIPPass string
SIPD... |
729c673007a930d53a80774f3eb13eba39baf305 | bd16d065676b5b5da92f50f3559bde4ace8e081e | satriyoaji/todolist-app-api | /repository/atttachment_repository.go | Go | go | 540 | no_license | package repository
import (
"context"
"database/sql"
"satriyoaji/todolist-app-api/model/domain"
)
type AttachmentRepository interface {
Save(ctx context.Context, tx *sql.Tx, attachment domain.Attachment) domain.Attachment
Update(ctx context.Context, tx *sql.Tx, attachment domain.Attachment) domain.Attachment
De... |
4f94995457b9a2105016c9baec111771a4a05379 | 4dac2f0a92279cfd44483db214060eb1e8588d67 | go-openapi/loads | /doc_test.go | Go | go | 1,372 | permissive | package loads_test
import (
"encoding/json"
"fmt"
"io/ioutil"
"path/filepath"
"github.com/go-openapi/loads"
"github.com/go-openapi/swag"
)
func ExampleSpec() {
// Example with default loaders defined at the package level
path := "fixtures/yaml/swagger/spec.yml"
doc, err := loads.Spec(path)
if err != nil {... |
4a881f65569fef9b83754fea9aa2b489a6a04a2b | 0f0813bff0923e614429f2b1fe337250619970f5 | northwesternmutual/kanalictl | /controller/controller.go | Go | go | 4,560 | no_license | // Copyright (c) 2017 Northwestern Mutual.
//
// 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, p... |
9ec439a141759bd46862cbd8184cad57c1149308 | eb19d7dced2c161b4e579f26472fa3f476af60d3 | GoogleCloudPlatform/buildpacks | /cmd/java/functions_framework/main.go | Go | go | 13,594 | permissive | // Copyright 2021 Google LLC
//
// 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 ... |
fc72618f6f3b32ceb8187a218d3a8d4dc17d3c25 | 787a993dd69f070724c50823bb37f7212512d806 | maxvale/private-chat | /internal/server/handler/message.go | Go | go | 1,035 | permissive | package handler
import (
"fmt"
"google.golang.org/protobuf/proto"
"io/ioutil"
"log"
"net/http"
pb "private-chat/pkg/proto/messagepb"
)
type MessageHandler interface {
HandleMessage(w http.ResponseWriter, r *http.Request)
}
type messageHandlerImpl struct {
lastMessage string
}
func NewMessageHandler() *messa... |
2d3624b53ef17136341100d34921253b56ea621e | 4f68012d3a644bd07d1d912d65d01341e457ea52 | virajs/mongo-tools | /common/db/namespaces.go | Go | go | 4,664 | permissive | package db
import (
"fmt"
"github.com/mongodb/mongo-tools/common/bsonutil"
"github.com/mongodb/mongo-tools/common/log"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"strings"
)
// IsNoCmd reeturns true if err indicates a query command is not supported,
// otherwise, returns false.
func IsNoCmd(err error) bool {
e, ... |
a9d955aaa61f786d85bdc1e0af4817ca894cf648 | bd79ed47a48b1b37b591522c6364d9deb6c02497 | chy373/leetcode_golang | /bit_manipulation/n201_bitwise_AND_of_numbers_range.go | Go | go | 868 | no_license | package main
// 201. Bitwise AND of Numbers Range
// Difficulty: Medium Tags: Bit Manipulation
// Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.
// For example, given the range [5, 7], you should return 4.
// this problem is equals to find the le... |
e73e6bbd90b6ba5f730786fce9e225ee0872cd23 | 2944f45be627582dc51dfd94a42176df5e4aa5f8 | eust-w/kubernetes | /test/e2e/apps/job.go | Go | go | 40,736 | 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, ... |
b5691ea3c5cca6bd70d1388f93bd4063956985ba | 68cf059d64d16b02e447992b5ed1c65cf1bbb844 | xmn-services/buckets-network | /domain/transfers/buckets/files/file_test.go | Go | go | 2,183 | permissive | package files
import (
"fmt"
"testing"
"time"
lib_file "github.com/xmn-services/buckets-network/libs/file"
"github.com/xmn-services/buckets-network/libs/hash"
"github.com/xmn-services/buckets-network/libs/hashtree"
)
func TestFile_Success(t *testing.T) {
hashAdapter := hash.NewAdapter()
hsh, _ := hashAdapter... |
74f2332b52b904c98f1aed3e8b30d233d8574835 | a0c8156d64059710c3bad9814ab2441cbd47b828 | bio-routing/tflow2 | /database/database_test.go | Go | go | 10,833 | permissive | package database
import (
"fmt"
"net"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/bio-routing/tflow2/convert"
"github.com/bio-routing/tflow2/iana"
"github.com/bio-routing/tflow2/intfmapper"
"github.com/bio-routing/tflow2/netflow"
)
type intfMapper struct {
}
func (m *intfMapper) GetI... |
a78b4eec0f903ee21fdc7ad2e0b8a125010495a9 | 5e5f01950fee8f53faca176ada6365584d780ad2 | michaelandrepearce/kubemq-targets | /targets/gcp/firebase/messaging.go | Go | go | 1,432 | permissive | package firebase
import (
"context"
"encoding/json"
"fmt"
"strconv"
"firebase.google.com/go/v4/messaging"
"github.com/kubemq-io/kubemq-targets/types"
)
type messages struct {
single *messaging.Message
multicast *messaging.MulticastMessage
}
func (c *Client) sendMessage(ctx context.Context, req *types.Req... |
06984544063963930521f6707bf1e206f0c3c17c | 6fc4c7261ae92dc1aade2df92fc146876f2ffcf7 | LordOfTheJinx/gitea | /modules/context/context.go | Go | go | 24,058 | permissive | // Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package context
import (
"context"
"crypto/sha256"
"encoding/hex"
"fmt"
"html"
"html/template... |
9229bafcd9f53cdc5bd08c964a9d2cc58f1113c7 | 5d684e57233fdc50bfb12757aaa27bfd4303f4db | Rory-Z/kubeedge | /keadm/app/cmd/common/config.go | Go | go | 5,166 | permissive | /*
Copyright 2019 The Kubeedge 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, so... |
42c307405ea215141ff941d3e16349f5730dada8 | a23d065f0b721fcfed35cafbe4a9dfac5ef4d501 | Charsers/minio | /cmd/object-api-input-checks.go | Go | go | 5,442 | permissive | /*
* Minio Cloud Storage, (C) 2016 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
f5f4dfd4903b8b1baf6e0000d9572fb1413e56a0 | 1d8aef91da66e0321bc2ffac14e4277f6809e05d | guherbozdogan/kit | /circuitbreaker/gobreaker.go | Go | go | 708 | permissive | package circuitbreaker
import (
"context"
"github.com/sony/gobreaker"
"github.com/guherbozdogan/kit/endpoint"
)
// Gobreaker returns an endpoint.Middleware that implements the circuit
// breaker pattern using the sony/gobreaker package. Only errors returned by
// the wrapped endpoint count against the circuit br... |
4bbc57b2a95ec09901eca44eb9684a482fc31d8c | c92c0b681b738bd6d22525e8340a773ad0ac4fa7 | demonoid81/scriggo | /test/compare/testdata/github.com-golang-go/const3.go | Go | go | 756 | permissive | // skip : methods declarations not supported (see https://github.com/open2b/scriggo/issues/194)
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test typed integer constants.
package main
import ... |
5a3a4edbf39c1ca89b21121140f8f5315fd43176 | fae46e9538a6d7307e068a13fcfa8a050a426888 | nutsdo/next-common | /session/session.go | Go | go | 257 | no_license | package session
import (
"github.com/kataras/iris"
"github.com/kataras/iris/sessions"
)
var (
Sess = sessions.New(sessions.Config{Cookie:"nextsessionid"})
)
func SessionMiddleware(ctx iris.Context) {
session := Sess.Start(ctx)
session.Get("user")
} |
235b978b7469b680c5b4201dc0472f75f8d5f147 | b069d72ddd9bc1bfcbce2756a1429a3da9544494 | kentliuqiao/goo-rpc | /day4-http-debug/main/main.go | Go | go | 1,336 | no_license | package main
import (
"context"
"goorpc"
"log"
"net"
"net/http"
"sync"
"time"
)
type Foo int
type Args struct {
Num1, Num2 int
}
func (f *Foo) Sum(args Args, reply *int) error {
*reply = args.Num1 + args.Num2
return nil
}
func main() {
log.SetFlags(0)
addr := make(chan string)
go call(addr)
startSer... |
a2d51c81c1cf3b1605d2d5237b2d9982a5b0a60a | 04a2325bdea8fad82ff9ea266b744ac255f1b9bb | chippydip/go-sc2ai | /botutil/unit_context.go | Go | go | 7,466 | permissive | package botutil
import (
"log"
"github.com/chippydip/go-sc2ai/api"
"github.com/chippydip/go-sc2ai/client"
)
// Enemy()
// EnemyFlying()
// EnmyFlyingPassive()
// EnemyFlyingPassiveUnits()
// EnemyFlyingPassiveStructures() \
// EnemyFlyingAttackers() | EnemyFlyingStructures()
// ... |
206a02720cbfcc826e6432d617203c1fa7b57521 | 3dc2348e762492f859e6322c88059a269cdf01d3 | Bungysheep/contact-management | /pkg/service/v1/communicationmethod/communicationmethod.go | Go | go | 4,085 | permissive | package communicationmethod
import (
"context"
"database/sql"
"github.com/bungysheep/contact-management/pkg/common/constant/messagecode"
communicationmethodmodel "github.com/bungysheep/contact-management/pkg/models/v1/communicationmethod"
messagemodel "github.com/bungysheep/contact-management/pkg/models/v1/messa... |
e272303f45214913b60c0c9efa58df829a8d56dc | aef5752c42b736e713fc1eee9839d8a1eb92310d | sinmetal/bq2spanner | /main.go | Go | go | 1,732 | permissive | package main
import (
"context"
"fmt"
"io/ioutil"
"os"
"cloud.google.com/go/bigquery"
"cloud.google.com/go/spanner"
)
type Config struct {
FromBigQueryProjectID string
ToSpannerProjectID string
ToSpannerInstance string
ToSpannerTableName string
}
func main() {
var q string
q = ReadFile()
fmt.... |
3cb5d746800acc70b9bec060bc70015ed281d6ad | 62f559809d2ddf5dab192beae99242c7e58a9b72 | 321dao/goxos | /Godeps/_workspace/src/github.com/ajstarks/svgo/barchart/barchart.go | Go | go | 11,907 | permissive | // barchart - bar chart
package main
import (
"encoding/xml"
"flag"
"fmt"
"github.com/relab/goxos/Godeps/_workspace/src/github.com/ajstarks/svgo"
"io"
"math"
"os"
"strconv"
"strings"
)
var (
width, height, iscale, fontsize, barheight, gutter, cornerRadius, labelimit int
bgcolor, barcolor, title, inbar, val... |
aab655d9eb2fe66e04ef397d681463e89b2f10e8 | 0c95c672428421dad187ff05d0e3a4338ce6269a | DonelAdam/datadog-agent | /cmd/agent/app/stop.go | Go | go | 1,452 | 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-2020 Datadog, Inc.
// +build !windows
package app
import (
"bytes"
"fmt"
"github.com/Data... |
2576b2f8e0a0ef6e2ef5a638b3dce40627a9fe60 | a0e2d26c0e85b646d78edd7b76b7a8c2d4fd0ffe | avmi/singularity | /internal/pkg/build/assemblers/sif.go | Go | go | 6,839 | permissive | // Copyright (c) 2018-2021, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE.md file distributed with the sources of this project regarding your
// rights to use or distribute this software.
package assemblers
import (
"bytes"
"fmt"
"io/iouti... |
a6d60b29c23f5a731e16d6f4270ada92ac3985fa | 65358a325c0532816b7c2550feba385408b56fcd | mchechulnikov/gamma-rho-bot | /src/bot/sender.go | Go | go | 381 | permissive | package bot
import (
"fmt"
"gamma-rho-bot/telegram"
)
type sender struct {
telegramClient telegram.BotAPIClient
error chan error
}
func (s *sender) send(message chatMessage) {
err := s.telegramClient.SendMessageAsReply(message.chatId, message.text, message.replyToMessageId)
if err != nil {
s.error <... |
b110629b89938750aae4761fffa9e23d710e2c15 | fc476052d930aa6f670698d4295f73b2550bc20b | afiefafian/todo-api | /src/delivery/http/http_delivery.go | Go | go | 1,611 | no_license | package http
import (
"github.com/afiefafian/todo-api/src/delivery/http/middleware"
"github.com/afiefafian/todo-api/src/delivery/http/response"
pgsqlRepo "github.com/afiefafian/todo-api/src/repository/postgres"
redisRepo "github.com/afiefafian/todo-api/src/repository/redis"
"github.com/afiefafian/todo-api/src/ser... |
78c483f8662bda3a58c997e1d9700517f673dab7 | 22ee358d77fdc2c660e51dd054b2b42661ff6571 | ZodiacSyndicate/leet-code-solutions | /easy/119.杨辉三角-ii/119.杨辉三角-ii.go | Go | go | 856 | no_license | /*
* @lc app=leetcode.cn id=119 lang=golang
*
* [119] 杨辉三角 II
*
* https://leetcode-cn.com/problems/pascals-triangle-ii/description/
*
* algorithms
* Easy (53.57%)
* Total Accepted: 9.7K
* Total Submissions: 18K
* Testcase Example: '3'
*
* 给定一个非负索引 k,其中 k ≤ 33,返回杨辉三角的第 k 行。
*
*
*
* 在杨辉三角中,每个数是它左上方和右... |
2d66835903266e3a1e47a962d129af1532f5ab22 | 8bfe80738558cf0377307463589b43d675e31eb5 | tenforward/lxd | /lxc/monitor.go | Go | go | 4,239 | permissive | package main
import (
"encoding/json"
"fmt"
"github.com/spf13/cobra"
"gopkg.in/inconshreveable/log15.v2"
"gopkg.in/yaml.v2"
"github.com/lxc/lxd/client"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
cli "github.com/lxc/lxd/shared/cmd"
"github.com/lxc/lxd/shared/i18n"
"github.com/lxc/lxd/share... |
5ce1a032f3485b6e2f399fefa29bd3a725c12ead | 05fb830cf327e005bec838b4850f1b26a3b378e6 | 256dpi/gomqtt | /session/id_counter.go | Go | go | 864 | permissive | package session
import (
"sync"
"github.com/256dpi/gomqtt/packet"
)
// An IDCounter continuously counts packet ids.
type IDCounter struct {
next packet.ID
mutex sync.Mutex
}
// NewIDCounter returns a new counter.
func NewIDCounter() *IDCounter {
return NewIDCounterWithNext(1)
}
// NewIDCounterWithNext return... |
d499bf6a57c17ce9482230242b2eb79d172b9398 | e4749e155800dabbf0dbcb59b1e63e0b64487592 | Seeeyouu/red-tldr | /pkg/search.go | Go | go | 4,311 | permissive | package pkg
import (
"encoding/json"
"fmt"
"github.com/spf13/viper"
yaml "gopkg.in/yaml.v2"
"io/ioutil"
"log"
"os"
"red-tldr/utils"
"strings"
"github.com/gookit/color"
)
var (
SearchDbDir = ""
SearchDbName = ""
)
func init() {
viper.SetConfigName("config")
viper.SetConfigType("toml")
viper.AddConfigP... |
b99fd1f0ecc691d07676c2651ed0f91c835eeda6 | 76b3f57f94cc60c0451e1e58911e5a400254ef6a | skydavidshen/TransProxy | /manager/config/config_test.go | Go | go | 801 | no_license | package config
import (
"TransProxy/manager"
"TransProxy/manager/log"
"fmt"
"github.com/smartystreets/goconvey/convey"
"os"
"testing"
)
//application root dir
const rootDir = "/Users/davidshen/Documents/webroot/TransProxy"
func TestConfLoad(t *testing.T) {
fmt.Println("TestConfLoad")
//配置文件处理服务:支持热修改
manag... |
75451da4bca96e5793eeefe77dfe90afe2818546 | a45ed363c2480176c896b9c405bed443c07e1a49 | Jakegogo/go_test | /typeface/pkgreflect.go | Go | go | 9,637 | no_license | /*
Problem: Go reflection does not support enumerating types, variables and functions of packages.
pkgreflect generates a file named pkgreflect.go in every parsed package directory.
This file contains the following maps of exported names to reflection types/values:
var Types = map[string]reflect.Type{ ... }
var Fun... |
9fc7d7489538e8269715f77abb6ebf1ab10ab4f3 | e6afe5d9c92f92fccf0bd4fd118a2d95d396a328 | fsdaniel/harvester | /pkg/controller/master/template/template_controller_test.go | Go | go | 12,089 | permissive | package template
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apim... |
8a1f91a6a89df06a1e0bf0008d80362fe9a254e3 | bd4d588aaae13ecafd143d369655709023ff6d1e | vivimouret29/pulumi-azure-native | /sdk/go/azure/azuredata/sqlServer.go | Go | go | 4,198 | permissive |
package azuredata
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type SqlServer struct {
pulumi.CustomResourceState
Cores pulumi.IntPtrOutput `pulumi:"cores"`
Edition pulumi.StringPtrOutput `pulumi:"edition"`
Name pulumi.Str... |
861168a36d85df62b2127ac754550eb31a777e64 | 040402d0d1696c8d0554dfa49add3c2a4f8b66f9 | AlexxNica/aws-operator | /service/cloudconfigv1/cloud_config.go | Go | go | 3,030 | permissive | package cloudconfigv1
import (
"github.com/giantswarm/aws-operator/service/keyv1"
"github.com/giantswarm/awstpr"
"github.com/giantswarm/certificatetpr"
cloudconfig "github.com/giantswarm/k8scloudconfig"
"github.com/giantswarm/microerror"
"github.com/giantswarm/micrologger"
"github.com/giantswarm/randomkeytpr"
)... |
5edde2f32b28b38b8b758382722bf573ab6cc35a | 76fc88a9eae1bc401e16d77269618aa0bdd939a1 | Dev-HyunSang/Quick-Start-Golang | /chapter-01/07.go | Go | go | 252 | permissive | package main
import "fmt"
type person struct {
name string
age int
favFood []string
}
func main() {
favFood := []string{"Bulgogi", "ramen"}
hyunsang := person{"hyunsang", 18, favFood}
fmt.Println(hyunsang)
fmt.Println(hyunsang.name)
}
|
b0b7ba0f2c3f5a2b483401b7a1131a1417e40545 | 176aa80f29239a81df831fbd2a721dd6b7def860 | webrepl/ww | /pkg/lang/core/atoms_test.go | Go | go | 827 | permissive | package core_test
import (
ww "github.com/wetware/ww/pkg"
"github.com/wetware/ww/pkg/lang/core"
capnp "zombiezen.com/go/capnproto2"
)
func mustSymbol(s string) core.Symbol {
sym, err := core.NewSymbol(capnp.SingleSegment(nil), s)
if err != nil {
panic(err)
}
return sym
}
func mustKeyword(s string) core.Key... |
50d1853b5ddacd4f46c19fd4199196179ef7c572 | 49db40d618de12e6564b54b0a9c25194d1b6450f | jturolla/kubernetes | /pkg/apiserver/apiserver.go | Go | go | 19,937 | permissive | /*
Copyright 2014 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
c5e4acf773b5ce36f7f0ca1b690950700dab39ed | d10c615906905c49a55e43022fe4d38bb0b44955 | jimmyyan/go-cos | /_example/object/abortMultipartUpload.go | Go | go | 913 | permissive | package main
import (
"context"
"fmt"
"net/url"
"os"
"net/http"
"github.com/mozillazg/go-cos"
"github.com/mozillazg/go-cos/debug"
)
func main() {
u, _ := url.Parse("https://test-1253846586.cn-north.myqcloud.com")
b := &cos.BaseURL{BucketURL: u}
c := cos.NewClient(b, &http.Client{
Transport: &cos.Authori... |
77e2cc7b9452ab3842aeba982dd49deecc0c4956 | 9caa630ff87c489710b378f1c83c62870973b74f | michalgosek/fetcher | /internal/api/api_test.go | Go | go | 621 | permissive | package api_test
import (
"encoding/json"
"fetcher/internal/api"
"net/http"
"net/http/httptest"
"testing"
)
func TestAPI_Health_Unit(t *testing.T) {
rr := httptest.NewRecorder()
r := api.New()
req := httptest.NewRequest(http.MethodGet, api.HealthEndpoint, nil)
r.ServeHTTP(rr, req)
var res api.JSONResponse... |
bffbb0fdf082f956bb5dde14a8a7f033be53517e | 90b8f163adb54e4bb72ebe1351710b7b96a38bf2 | mzinin/s2e2.go | /pkg/s2e2/operators/operator_less_or_equal.go | Go | go | 1,049 | permissive | package operators
// OperatorLessOrEqual is operator <=
// Lexicographically compares two strings.
type OperatorLessOrEqual struct {
BaseOperator
}
// NewOperatorLessOrEqual creates an instance of OperatorLessOrEqual.
func NewOperatorLessOrEqual() *OperatorLessOrEqual {
result := &OperatorLessOrEqual{MakeBaseOperat... |
b4661e0c4318f82fc7f536cc399233f6fa7f4b70 | dd217011d643b6e6e845f76510e9ae2994a1d9ee | denji/coraza-waf | /transformations/escape_seq_decode.go | Go | go | 2,611 | permissive | // Copyright 2021 Juan Pablo Tosso
//
// 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 ... |
9312312da909375b90da154c7a622563ecdf436f | 4d45ec53b112c7aaa6d5962f021622dd5fa3edc5 | ByronLiang/develop_note | /go/code/basic/pattern/design/i_single.go | Go | go | 463 | no_license | package design
type ISingle interface {
GetTitle() string
}
// 私有类型
type singleImpl struct {
title string
}
// 接口变量实例化
var SingleImpl ISingle
func (s singleImpl) GetTitle() string {
return s.title
}
func NewSingleImpl(title string) ISingle {
once.Do(func() {
SingleImpl = &singleImpl{titl... |
5b804b94bd44d14e0f6614fd899025d0dba2407b | 2dc1ec108c66dcc4656a63a0a018c4cc165ca4a7 | Corporex/origin | /vendor/k8s.io/kubernetes/test/e2e/lifecycle/cluster_upgrade.go | Go | go | 21,396 | permissive | /*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
bb4f9417e4404f720fc7e7ba785c94fe0218ff30 | d82ba855aa0e147443c30b57d663fb3f3d442e64 | kubeflow/arena | /pkg/operators/tf-operator/apis/tensorflow/v1beta2/util.go | Go | go | 1,052 | permissive | // Copyright 2018 The Kubeflow 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... |
6759e546ddaf6757372a5c45262cae6c8e33173f | ea0cfcf0ad5bff908439d4068c8ed6d658eba426 | samcday/csgo-rank-sniffer | /main.go | Go | go | 6,906 | no_license | package main
import (
"bufio"
"encoding/binary"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"reflect"
"time"
steam "github.com/Philipp15b/go-steam"
"github.com/Philipp15b/go-steam/netutil"
"github.com/Philipp15b/go-steam/protocol/gamecoordinator"
"github.com/Philipp15b/go-steam/protocol/steamlang"
"gi... |
7c3d250027c0ee1bda86149b0998153d45ddcd38 | eef5710e625709cbbdbd439dc73b777ec7b981a9 | rohitpaulk/sourcegraph | /enterprise/internal/database/external_services.go | Go | go | 939 | permissive | package database
import (
"github.com/sourcegraph/sourcegraph/internal/authz/bitbucketserver"
"github.com/sourcegraph/sourcegraph/internal/authz/github"
"github.com/sourcegraph/sourcegraph/internal/authz/gitlab"
"github.com/sourcegraph/sourcegraph/internal/database"
"github.com/sourcegraph/sourcegraph/internal/da... |
489d6b04a7bea1987d1e898fb33c4f91625f25a5 | 40af79fb9998702e66c7c80517f1a2ca718d637c | github/codeql | /go/ql/test/query-tests/Security/CWE-022/ZipSlipGood.go | Go | go | 351 | permissive | package main
import (
"archive/zip"
"io/ioutil"
"path/filepath"
"strings"
)
func unzipGood(f string) {
r, _ := zip.OpenReader(f)
for _, f := range r.File {
p, _ := filepath.Abs(f.Name)
// GOOD: Check that path does not contain ".." before using it
if !strings.Contains(p, "..") {
ioutil.WriteFile(p, []b... |
322d161abb1721da76d67b7005992ed420e74b34 | 053d98119e62a068faffc22a2ff74f81240ea3cd | woshizilong/hackpad | /internal/js/fs/write.go | Go | go | 1,082 | permissive | // +build js
package fs
import (
"syscall/js"
"github.com/hack-pad/hackpad/internal/fs"
"github.com/hack-pad/hackpad/internal/process"
"github.com/hack-pad/hackpadfs/indexeddb/idbblob"
"github.com/pkg/errors"
)
func writeSync(args []js.Value) (interface{}, error) {
ret, err := write(args)
if len(ret) > 1 {
... |
2c36ab48e5c3551c80be8637f0af0545babd1cd0 | 2ea3768557a1b2f57cb8700fe93a2056a73a2531 | blukai/auth.svc | /pkg/handlers/handlers.go | Go | go | 1,992 | permissive | package handlers
import (
"encoding/json"
"fmt"
"net/http"
"strings"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"github.com/markbates/goth"
"github.com/markbates/goth/gothic"
)
func Root(c *gin.Context) {
name := c.Param("provider")
if name == "user" {
User(c)
return
}
Provider(c)
}... |
d7d9f63fa723cbea89042f0fa1fa4ff4b73cad50 | 2513e28d2b208e69abfe6b4841a6e7c26f78bf4d | mi4tin/go-chassis | /core/config/config.go | Go | go | 10,220 | permissive | package config
import (
"errors"
"fmt"
"io/ioutil"
"os"
"github.com/go-chassis/go-archaius"
"github.com/go-chassis/go-chassis/core/common"
"github.com/go-chassis/go-chassis/core/config/model"
"github.com/go-chassis/go-chassis/core/config/schema"
"github.com/go-chassis/go-chassis/pkg/runtime"
"github.com/go-... |
c1f68fec34d6b0f649c61b523b5f2a8d4fad0a31 | cea767d4ba9ba510b60d0b9407a3fbe995fb7a17 | LawnGnome/sourcegraph | /internal/codeintel/lsifserver/client/request.go | Go | go | 3,772 | permissive | package client
import (
"context"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
"github.com/pkg/errors"
"github.com/sourcegraph/sourcegraph/internal/linkheader"
)
type lsifRequest struct {
method string
path string
cursor *string
query queryValues
body io.ReadCloser
// (... |
d7edd2eb43b3248810a2e9a619769cb03e2eee0e | 90119b91e206e0bccae698778b75cde31045c54d | betamike/radix.v2 | /cluster/cluster_test.go | Go | go | 4,947 | permissive | package cluster
import (
"strings"
. "testing"
"github.com/stretchr/testify/assert"
"github.com/mediocregopher/radix.v2/pool"
"github.com/mediocregopher/radix.v2/redis"
)
// These tests assume there is a cluster running on ports 7000 and 7001, with
// the first half of the slots assigned to 7000 and the second... |
d667b5f91eb81f4bc7e5d7d9778413a254233be6 | b1d19c95b63a579c7795bda6d037c66eeb03be07 | gowins/go-micro | /client/selector/dns/dns.go | Go | go | 2,283 | permissive | // Package dns provides a dns SRV selector
package dns
import (
"net"
"strconv"
"github.com/micro/go-micro/client/selector"
"github.com/micro/go-micro/registry"
)
type dnsSelector struct {
options selector.Options
domain string
}
var (
DefaultDomain = "local"
)
func (d *dnsSelector) Init(opts ...selector.O... |
708f15697e13c46051ebef37ac1720b8fe6b18c9 | e296cd857235e69837b64bd57796ee31b01a6afa | 0x50Fc/golang | /features/inbox/inbox/Service.go | Go | go | 256 | permissive | package inbox
import (
"github.com/hailongz/golang/micro"
)
func init() {
micro.AddDefaultService(&Service{})
}
type Service struct {
}
func (S *Service) GetName() string {
return ""
}
func (S *Service) GetTitle() string {
return "默认服务"
}
|
0dfd9527b649a76bafdeab0893caca481b2ef5d6 | c8cdced71deac98ef77375d6ef589bd7d89fd636 | godcong/leetcode | /code/old/0402.removeKdigits_test.go | Go | go | 687 | permissive | package old
import "testing"
func Test_removeKdigits(t *testing.T) {
type args struct {
num string
k int
}
tests := []struct {
name string
args args
want string
}{
// TODO: Add test cases.
{
name: "",
args: args{
num: "1432219",
k: 3,
},
want: "1219",
},
{
name: "",
... |
2029e9dabd84003daa39824a4122fb6cb61b82b1 | 13532f746534ebb51ebef174448e9b250d465fe4 | agrawalsaurabhbcg/argo | /workflow/artifactrepositories/artifactrepositories.go | Go | go | 3,970 | permissive | package artifactrepositories
import (
"context"
"fmt"
log "github.com/sirupsen/logrus"
v1 "k8s.io/api/core/v1"
apierr "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/yaml"
"github.com/argoproj/argo/v3/config"
wfv1 "github.com/arg... |
696d55582e20e34495f3b0b274e281f6f84ee342 | 719ae865c654fb014941407560fe55bf1497fb90 | wenfang/golang1.5-src | /src/runtime/mbarrier.go | Go | go | 10,751 | no_license | // Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// 垃圾收集器: 写屏障
// Garbage collector: write barriers.
//
// 对并发垃圾收集器,Go编译器实现了对指针数值域的更新,通过调用write barrier. 当这些指针在堆对象时
// 本文件包含了write barrier的实现,markwb和不同的包装
// Fo... |
7774bae59b46e1112c91f066f968922a99af2ccd | 5bcaff82bfc04efed9639bf9d8d05e2cb91a5539 | morlay/goqcloud | /clients/ds/send_vcode.go | Go | go | 755 | permissive | package ds
import (
github_com_morlay_goqcloud "github.com/morlay/goqcloud"
)
// 发送验证码
// https://cloud.tencent.com/document/api/869/17787
type SendVcodeRequest struct {
// 帐号ID
AccountResId string `name:"AccountResId"`
// 合同ID
ContractResId string `name:"ContractResId"`
// 模块名
Module string `name:"Module"`
... |
2cc13d803e37756cb41f3ffef061b4a05df6dadf | 4f78d813819006e291760d878898323a843f9671 | cpuguy83/docker | /libnetwork/drivers/bridge/interface.go | Go | go | 2,743 | permissive | //go:build linux
package bridge
import (
"context"
"fmt"
"net"
"github.com/containerd/containerd/log"
"github.com/vishvananda/netlink"
)
const (
// DefaultBridgeName is the default name for the bridge interface managed
// by the driver when unspecified by the caller.
DefaultBridgeName = "docker0"
)
// Inte... |
b27b9b85447819ac82e1175c7ffb7e3958a9b2e6 | c8fa972558be726503c962b190a3c39dc372ec94 | data4hub/gojenkins | /executor.go | Go | go | 1,559 | permissive | // Copyright 2014 Vadim Kravcenko
//
// 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... |
e04caeeafaec8862eac44310be1bdb62a0564477 | d25cbbcf11334b86449a069e9acc9cb02809d9a0 | messagebird/pushprom | /udp_test.go | Go | go | 2,437 | permissive | package main
import (
"context"
"encoding/json"
"net"
"os"
"log"
"testing"
"time"
"github.com/messagebird/pushprom/delta"
"github.com/messagebird/pushprom/metrics"
"github.com/stretchr/testify/assert"
)
var conn *net.UDPConn
func TestMain(m *testing.M) {
*udpListenAddress = ":3007"
go listenUDP(contex... |
9f4a84367bcedc8625eda34008832e5673aa4daa | afb03fea9a5551cc6918c0bc2ca7b9b367beb5db | rohanKanojia/origin | /pkg/oc/lib/describe/describer_test.go | Go | go | 15,434 | permissive | package describe
import (
"bytes"
"fmt"
"reflect"
"regexp"
"strings"
"testing"
"text/tabwriter"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/api/legacyscheme"
kapi "k8s.io/kubernetes/pkg/apis/core"
kfake "k8s.io/kubernetes/pkg/cl... |
8b27f0e8ea17557f5001ba1493e3da006a01fc88 | df1d4001134e9f8a0ab79150ece720790d3117da | Achelics/zgrab | /ztools/http/proxy_test.go | Go | go | 1,319 | permissive | // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package http
import (
"os"
"testing"
)
// TODO(mattn):
// test ProxyAuth
var UseProxyTests = []struct {
host string
match bool
}{
// Never proxy localh... |
76e7ce59c56d5ef32e878a26d5ec5e96fe8e3e3d | a9b3de4d8b208586b9371915d54425e5845eef32 | jardelmv/GAE-Image-Server | /optimg.go | Go | go | 6,012 | permissive | /***************************************************************
*
* GAE Go automatic blob image optimizer
*
* Created by Tomi Hiltunen 2013.
* http://www.linkedin.com/in/tomihiltunen
*
* https://github.com/TomiHiltunen/GAE-Go-image-optimizer
*
* - Use this script however you wish.
* - Do not remove... |
6c35318b829796c993e0c1f6788ed0b49953362e | 57a5f23ce413fd8117a124ef1514096b8f540593 | yuhaoyuan/Http_server | /config/config.go | Go | go | 841 | no_license | package config
// BaseConf 参数
var BaseConf = BaseConfig{}
// BaseConfig config 结构体
type BaseConfig struct {
Addr string
AccessKEY string
SecretKEY string
Bucket string
CDNUrl string
LogName string
}
// BaseConfInit 初始化环境变量
func BaseConfInit() {
//BaseConf.Addr = os.Getenv("ADDR")
//BaseConf.AccessKEY... |
6d4c5e6b14585476b346811c443c403a28b00030 | c6cb25d7af74715441bbff334d46f100861f3f0a | nowiseeyou/golang | /gmodal/filelistingserver/bin/web.go | Go | go | 771 | no_license | package main
import (
"net/http"
"os"
"filelisting"
)
type appHandler func(writer http.ResponseWriter, request *http.Request) error
func errWrapper(handler appHandler) func(http.ResponseWriter, *http.Request) {
return func(writer http.ResponseWriter, request *http.Request) {
err := handler(writer, request)
... |
8842deebecc65e89207803e0bf3cdb9cdebbace6 | 0b37e1a73f13136602da80530a84c8f82564e68f | uia-worker/is105misc | /roadsandlibs.go | Go | go | 2,397 | permissive | package main
import "fmt"
// n cities, [1,n]
// m bidiractional roads connect cities
// A citizen has access to a library if:
// (a) their city contains a library
// (b) they can travel by road from their city to a city
// containing a library
// Cost of repairing any road is c[road] dollars
// Cost to build a lib... |
1e559888396e8f0bb880456d2ff4d778b20eebd3 | aa19c1530a02648260d15ea65985d0d6920809aa | leaanthony/idl2go | /webview2/ICoreWebView2SourceChangedEventArgs.go | Go | go | 217 | no_license | package webview2
type _ICoreWebView2SourceChangedEventArgsVtbl struct {
_IUnknownVtbl
GetIsNewDocument ComProc
}
type ICoreWebView2SourceChangedEventArgs struct {
vtbl *_ICoreWebView2SourceChangedEventArgsVtbl
}
|
e75826581d61b63fd9163580b55dfe20a360b92d | 1871f9741a6559fa8051a55b38a2388c4050fd49 | pratikfalke/eventnative | /schema/field_mapper_test.go | Go | go | 6,035 | permissive | package schema
import (
"github.com/jitsucom/eventnative/test"
"github.com/stretchr/testify/require"
"testing"
)
func TestOldStyleMap(t *testing.T) {
tests := []struct {
name string
mappings []string
inputObject map[string]interface{}
expectedObject map[string]interface{}
expectedErr ... |
72d9b544eddce1e4df2e734bf93d44a5ce11dbb7 | 2726893b63131f7ef74c03a26902612280dd2a94 | Fawkes-hub/BeeCmf_go | /api/ApiController/IndexController.go | Go | go | 206 | no_license | package ApiController
import "github.com/astaxie/beego/logs"
type IndexController struct {
ApiBaseController
}
// @router /api/ [get]
func (c *IndexController) Index() {
c.TplName = "api/index.html"
}
|
f5a2e29bca7acb27aa0c791553267a06c64d8fc8 | 9dc0d0af387f4d396aa4ac006057564a917fc4e7 | gigawattio/concurrency | /multi_go_test.go | Go | go | 858 | permissive | package concurrency_test
import (
"errors"
"testing"
"github.com/gigawattio/concurrency"
)
func TestMultiGoNilFuncBehavior(t *testing.T) {
if err := concurrency.MultiGo(); err != nil {
t.Error(err)
}
if err := concurrency.MultiGo(nil); err != nil {
t.Error(err)
}
if err := concurrency.MultiGo(nil, nil, n... |
ef64d124a0f0d5c99d1310278e45bcbb37262b54 | b4174c66f8fe91de68555a6daa5e6141695f698e | rchamorro/pulumi-azure-nextgen | /sdk/go/azure/network/v20201101/getPolicy.go | Go | go | 2,322 | 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 v20201101
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func LookupPolicy(ctx *pulumi.Context, args *LookupPolicyArgs, opts ...pulumi.InvokeOpti... |
658f2f1b4c5b5ff69f366682855c14eafea9258b | 900edc75aef8e096fa7579b5771e72ea869ecad6 | koqizhao/go-projects | /src/algorithms/graph/graph.go | Go | go | 9,118 | no_license | package graph
import "fmt"
import "extensions/strext"
type IGraph interface {
fmt.Stringer
AddVertex(vertex IVertex)
RemoveVertex(vertex IVertex)
HasVertex(vertex IVertex) bool
GetVertices() (vertices []IVertex)
GetVertexCount() (vertexCount int)
AddEdge(edge IEdge)
RemoveEdge(edge IEdge)
HasEdge(edge IEdge)... |
7e35dceb6989f1c66e8305abace2e2d64f03a79b | 08df1d25c83f2fc5161587561a3461d64990a79f | robertfluxus/faceit-task | /user/pkg/business/rabbitmq.go | Go | go | 817 | no_license | package business
import (
"errors"
amqp "github.com/streadway/amqp"
)
type RabbitMQ struct {
conn *amqp.Connection
ch *amqp.Channel
q amqp.Queue
}
func NewRabbitMQ(conn *amqp.Connection) (*RabbitMQ, error) {
ch, err := conn.Channel()
if err != nil {
return nil, err
}
return &RabbitMQ{
conn: conn,
... |
d1ff3b8add65dfecae26b02d1e83d56fa895b9fb | 0b456ffc491091fa8c9be27fafa558165ca26c65 | cloudfoundry/bosh-google-cpi-release | /src/bosh-google-cpi/action/reboot_vm.go | Go | go | 582 | permissive | package action
import (
bosherr "github.com/cloudfoundry/bosh-utils/errors"
"bosh-google-cpi/api"
"bosh-google-cpi/google/instance_service"
)
type RebootVM struct {
vmService instance.Service
}
func NewRebootVM(
vmService instance.Service,
) RebootVM {
return RebootVM{
vmService: vmService,
}
}
func (rv R... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.