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 |
|---|---|---|---|---|---|---|---|---|
482d99d549dc75f0825f77cac0b27f4cc51786c5 | 9c45c3acb98342a013640b17963c2c4dce42d8a4 | couchbase/service-broker | /pkg/provisioners/delete.go | Go | go | 1,119 | permissive | // Copyright 2020-2021 Couchbase, 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 agr... |
9c80e92f9fea6368c142303b3572b7addbac3a88 | 2a8d88d781cc15a83536c1c5ea5e40d45ec957b4 | GEO-Protocol/Observer | /core/chain/pool/handler.go | Go | go | 11,522 | no_license | package pool
import (
"encoding"
"geo-observers-blockchain/core/common/errors"
"geo-observers-blockchain/core/common/types/hash"
"geo-observers-blockchain/core/common/types/transactions"
"geo-observers-blockchain/core/network/communicator/observers/requests"
"geo-observers-blockchain/core/network/communicator/ob... |
80a1713a2efe7e8e558aa09bc677b0e8759ad798 | 8be16e2ef1f4638afe74fdc4afb01cdf8b5d8716 | ktr0731/protoreflect | /dynamic/dynamic_message.go | Go | go | 87,648 | permissive | package dynamic
import (
"bytes"
"compress/gzip"
"errors"
"fmt"
"reflect"
"sort"
"strings"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/protoc-gen-go/descriptor"
"github.com/jhump/protoreflect/desc"
)
// UnknownTagNumberError is an error that is returned when an operation refers
// to an... |
5d5a9c512a251d81b9bf6eba33269968f5c7c78c | cf959b9ebfac78e402dc8522d390bd92d351e76a | gadost/Cosmos-IE | /cmd/version.go | Go | go | 1,368 | permissive | /*
Copyright © 2020 NAME HERE <EMAIL ADDRESS>
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... |
34e6544027fcbf3f3ccf27d70b8da868b0e9d4ee | d8b5777dd4ab1b87a2ddea3987592d95a4241a17 | panjf2000/istio | /pilot/pkg/networking/core/v1alpha3/route/route.go | Go | go | 42,242 | 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... |
9aff186e10edf4e61b0b74b1305ea041a3b66eb6 | 15ae4145aabcc2c148c21802c394eb4e0ce16e90 | pascaldmier/esi | /models/get_characters_character_id_mail_lists_internal_server_error_body.go | Go | go | 1,521 | no_license | package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// GetCharactersCharacterIDMailListsInternalServerErrorB... |
a6270e235858f2ca06b4181c43b109f7506e5fbe | b7139ae9d7ecaa6b064720acc65c304656722e6e | cjmxp/vermeer | /internal/geom/instance/instance.go | Go | go | 4,358 | permissive | // Copyright 2016 The Vermeer Light Tools 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 instance
import (
"errors"
"github.com/jamiec7919/vermeer/core"
m "github.com/jamiec7919/vermeer/math"
"github.com/jamiec7919/verm... |
2e9024c3a9d69bb6dbbfcb6bda2efa9f5ec5bdb4 | d94f52b865d192632355ad04814f2b36fca146b0 | anazhcreat/kops | /upup/pkg/fi/dryrun_target.go | Go | go | 10,551 | permissive | /*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
963d00f6b5218cf2f6aae7a9d55df80ce42feb6a | 895cda7a425f3f95cb719e052e7f6db2deb470b0 | laubersder/dm | /dm/master/server_test.go | Go | go | 37,323 | permissive | // Copyright 2019 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
210a0a93eabf0837c67cb54e48512384a527ef9e | ee193d96870100fb6b167a93cd2def050679d451 | snyderf/nsxt-bulk-group-add | /nsxt/model/model_virtual_machine_tag_update.go | Go | go | 426 | permissive | /*
* NSX-T Manager API
*
* VMware NSX-T Manager REST API
*
* API version: 2.5.0.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package model
type VirtualMachineTagUpdate struct {
// External id of the virtual machine to which tags are to be applied
ExternalId stri... |
37e608852cd60d8efc476c8252ed1090131303c0 | a1d3891e28307caae60447a81af44313a75c6e5b | mf-00/authboss | /lock/lock.go | Go | go | 3,665 | permissive | // Package lock implements user locking after N bad sign-in attempts.
package lock
import (
"errors"
"time"
"github.com/mf-00/authboss/authboss"
)
// Storage key constants
const (
StoreAttemptNumber = "attempt_number"
StoreAttemptTime = "attempt_time"
StoreLocked = "locked"
)
var (
errUserMissing = ... |
6e0ca60aad99348ceacb6031ba83def5c1d0dd4b | 3ea881841065aa131bb71cbd0ac7ef7cad8f0edf | wupaopao/agency | /cidl/admin.cidl.go | Go | go | 34,188 | no_license | package cidl
type AckAdminOrganizationList struct {
Count uint32 `db:"Count"`
List []*Organization `db:"List"`
}
func NewAckAdminOrganizationList() *AckAdminOrganizationList {
return &AckAdminOrganizationList{
List: make([]*Organization, 0),
}
}
type MetaApiAdminOrganizationList struct {
}
var META_... |
1cae80df55ab96ed3460b55d177fc1c448c09c8d | e1a23408807cd5b4c01793611120f119babab316 | yimoucao/go-coreutils | /cmd/tty/main.go | Go | go | 279 | no_license | package main
import (
"fmt"
"os"
)
// const (
// TTY_STDIN_NOTTY = 1 + iota
// TTY_FAILURE
// TTY_WRITE_ERROR
// )
const fd0 = "/proc/self/fd/0"
func main() {
dest, err := os.Readlink(fd0)
if err != nil {
fmt.Println("error", err)
} else {
fmt.Println(dest)
}
}
|
b4ed017167b0ab961154bc8b5fad2595960c4b66 | 6c845ace717425a9f2dfc81ef6d4af6b7358779d | FirmaChain/cosmos-sdk | /x/slashing/simulation/decoder.go | Go | go | 1,588 | permissive | package simulation
import (
"bytes"
"fmt"
gogotypes "github.com/gogo/protobuf/types"
"github.com/cosmos/cosmos-sdk/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/types/kv"
"github.com/cosmos/cosmos-sdk/x/slashing/types"
)
// NewDecodeStore returns a decoder funct... |
446784c7e73c8dde52416365aa46a0dd5eae1a13 | 209c92ef361a344640f546a1d401b3f2170af339 | HttS3at/obfuse | /cmd/obfuse/main.go | Go | go | 1,697 | permissive | // shamefully taken from
// https://github.com/GH0st3rs/obfus/blob/master/obfus.go
package main
import (
"flag"
"fmt"
"math/rand"
"time"
"os"
"unsafe"
)
var (
s = flag.String("s", "", "String to obfuscate.")
v = flag.String("v", "str", "Variable name.")
r = flag.Bool("r", false, "Print summar... |
e307d5bdb7d36b012fe052cb9e6f3397f06b9677 | cebf52a1bc2f02ba99b1e0b55f0cc8dd8624da6f | Amend-Health/loop-development-kit | /ldk/go/source.go | Go | go | 936 | permissive | package ldk
// Source is information about the origin of the data.
type Source struct {
// Author is the creator of the entity.
Author string `json:"author" yaml:"author"`
// ID is a unique identifier for this entity that is consistent across all versions
// and modifications of this entity.
ID string `json:"id"... |
dbb82f4482063c994fbc40210ca47a6ddf10ca56 | 75bd78c2ab5c6b7cc80d5e5e3c28e88ec80db14c | sjanota/budget | /backend/pkg/models/conv.go | Go | go | 1,643 | no_license | package models
import "go.mongodb.org/mongo-driver/bson/primitive"
func (i MoneyAmountInput) ToModel() *MoneyAmount {
return &MoneyAmount{
Integer: i.Integer,
Decimal: i.Decimal,
}
}
func (i ExpenseEntryInput) ToModel() *ExpenseEntry {
return &ExpenseEntry{
Title: i.Title,
CategoryID: i.CategoryID,
... |
10e8bdf8d83c073533748a1cf6de390585b3b6be | de1178c39c6cd087353024d4a45c846d39cb3142 | xiaojunli/gorad | /osrad.go | Go | go | 1,038 | no_license | package gorad
import (
"github.com/xiaojunli/gorad/config"
"strings"
)
var app *App
var groupHandleMap map[string] *GroupHandle
var ctlMap map[string] interface{}
func init() {
app = &App{}
groupHandleMap = make(map[string] *GroupHandle)
ctlMap = make(map[string] interface{})
}
/**
* 注册Router
*/
func RegR... |
88fefc1429d3a13eab4cc091deb6d65b06974373 | 9103281cb7221688156fd44cc4024a59983b628e | jdcloud-api/jdcloud-sdk-go | /services/live/models/DomainTemplateConfig.go | Go | go | 1,087 | permissive | // Copyright 2018 JDCLOUD.COM
//
// 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 ... |
47ee2ea9d2de320386c895a4b465f4762718c495 | 408aafc7fff137dd2a6e66cc7d63e7b9c6b8c619 | bharatnc/konsumerator | /controllers/controller.go | Go | go | 1,000 | permissive | package controllers
import (
konsumeratorv1alpha1 "github.com/lwolf/konsumerator/api/v1alpha1"
ctrl "sigs.k8s.io/controller-runtime"
)
const (
InstanceStatusRunning string = "RUNNING"
InstanceStatusSaturated string = "SATURATED"
InstanceStatusPendingScaleUp string = "PENDING_SCALE_UP"
Instance... |
0e8635a44c4e08176842f0bc796928f7d49407a5 | f1b1ca70cd750b4354f289a0347846d8cb754298 | turcane/piggybank | /piggybank.go | Go | go | 17,700 | permissive | package main
import (
"ELRA/tools"
"crypto/tls"
"database/sql"
"encoding/json"
"fmt"
"log"
"math/big"
"net/http"
"net/smtp"
"os"
"strconv"
"strings"
"time"
krakenapi "github.com/beldur/kraken-go-api-client"
"github.com/gorilla/mux"
_ "github.com/mattn/go-sqlite3"
)
var config configuration
type bala... |
05fb206ec62bb50a70bff13fd3ead79193fe0957 | 6881eddee94b83eefb7086c4d7539cad97316074 | foeberg/D7024E | /d7024e/bucket.go | Go | go | 2,092 | no_license | package main
import (
"container/list"
"fmt"
)
// bucket definition
// contains a List
type bucket struct {
list *list.List
}
// newBucket returns a new instance of a bucket
func newBucket() *bucket {
bucket := &bucket{}
bucket.list = list.New()
return bucket
}
// AddContact adds the Contact to the front of t... |
b07561960cf03a18f57ab10fbfb307e7b29f1072 | 87e9bb532db6f1d78f990b4b3f4605c9dbeb9e6e | htee/htee | /integration_test.go | Go | go | 6,989 | no_license | // +build integration
package main
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"strconv"
"strings"
"testing"
"time"
"github.com/benburkert/httplus"
"github.com/htee/htee"
"github.com/htee/hteed/config"
"github.com/htee/hteed/server"
"github.com/htee/hteed/stre... |
447102f9334430bf629f5c679699438e5fbba79a | c622b64237748602c0861fdc9994709db0516d5c | mvmaasakkers/go-baseapp | /baseapp/middleware.go | Go | go | 3,189 | permissive | // Copyright 2018 Palantir Technologies, 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 ... |
b4652768ed964867cb2adc9f4959111519b5cc1e | 0fc16a327ea44a5ae8cfb9ec56480e453b15aea8 | n-guitar/gpl | /ch04/ex05/stringUtil_test.go | Go | go | 1,328 | no_license | // Copyright © 2016 Yoshiki Shibata
package main
import "testing"
func TestNil(t *testing.T) {
if eliminateAdjacentDuplicates(nil) != nil {
t.Errorf("Passing nil returns %v, want nil",
eliminateAdjacentDuplicates(nil))
}
}
func TestEliminateAdjacentDuplicates(t *testing.T) {
data := []struct {
s []... |
789871cafaea702bb3f5cabf58d9fc757539eebe | 064fa1d0678729c0aca473201811c242f1f1058b | kscbxxLiuXP/CarNetBack | /service/task.go | Go | go | 1,023 | no_license | package service
import (
"CarNetBack/model"
"github.com/gin-gonic/gin"
)
type taskService struct {
}
// TaskService create TaskService instance
var TaskService = taskService{}
func (us taskService) First(ctx *gin.Context, task *model.Task) error {
return db.First(&task).Error
}
func (us taskService) GetOne(ctx ... |
d264fbe2a8629eb901e75383bb7887ce8d1282d6 | e6e482038e549e153b99982b2c4db54d32d29c95 | amitchavan90/genesis2 | /server/resolver_carton.go | Go | go | 12,863 | no_license | package genesis
import (
"context"
"fmt"
"genesis/db"
"genesis/graphql"
"genesis/helpers"
"time"
"github.com/ninja-software/terror"
"github.com/volatiletech/null"
"github.com/gofrs/uuid"
)
////////////////
// Resolver //
////////////////
// Carton resolver
func (r *Resolver) Carton() graphql.CartonReso... |
4fd2a2be6fd34ad72700b5cde1c55fbfe6b4e2f2 | c985355dfc0c310b84570251f8c26943145648b5 | danielgongying/go_learning | /go_pkg_learning/archive.go | Go | go | 2,752 | no_license | package main
import (
"archive/tar"
"archive/zip"
"fmt"
"io"
"os"
)
func createTar() {
fw, err := os.Create("/Users/daniel/Desktop/demo.tar")
handleError(err)
fmt.Println(fw.Name())
defer fw.Close()
tw := tar.NewWriter(fw)
defer tw.Close()
fr, err := os.Open("/Users/daniel/Desktop/demo.txt")
handleError(... |
1e29e0ed4a4478517ed9f73b17475a2bcde01be7 | 95805545e655cc7b50dea418c308cb625a919a68 | aghiffari20/Microservice | /server1.go | Go | go | 3,548 | no_license | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"strconv"
"strings"
"github.com/gorilla/mux"
)
type AutoGenerated struct {
Rajaongkir Rajaongkir `json:"rajaongkir"`
}
type Query struct {
Origin string `json:"origin"`
Destination string `json:"destination"`
... |
4b304b931ec3ef5fb2afea7ac0fb003c4c39562f | 4678aef6f7e1d8549fb746a8c3bd0ef2850a71fc | ncomont/linotte-backend | /services/protection/models/red_list_entry.go | Go | go | 1,247 | no_license | package models
import "github.com/jinzhu/gorm"
// RedListEntry is the data model used to represents a red list entry in the database
type RedListEntry struct {
ID uint `gorm:"primary_key"`
RedList *RedList
RedListCriteria *RedListCriteria
// Database references
RedListID uint `gorm:"index"`
Re... |
b58ba7bee2250c8f7f43fd806e0d402e29b513a2 | 097dbf3bfaa12527efbcd9af3137279f00dde951 | CodexpathCommunity/EbookStore | /internal/auth/middleware/auth.go | Go | go | 1,359 | no_license | package middleware
import (
"github.com/c0llinn/ebook-store/internal/auth/model"
"github.com/gin-gonic/gin"
"net/http"
"regexp"
)
type JWTWrapper interface {
ExtractUserFromToken(token string) (model.User, error)
}
type AuthenticationMiddleware struct {
jwt JWTWrapper
}
func NewAuthenticationMiddleware(jwt JW... |
b3908890d91831e94eb9aa09546b94d708dcaa79 | 69c23196fa2764b2cc0e265ed174c1867e857ea0 | may215/gollum | /format/envelope_test.go | Go | go | 1,869 | permissive | // Copyright 2015-2017 trivago GmbH
//
// 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 ... |
a881a8b1c288d1c347f19a5b454c57b99ec3f78c | 8df265a5c5feadf3b6961e29761311db582170e4 | darthlynx/alGo | /timus/1119_metro/main.go | Go | go | 2,096 | no_license | package main
import (
"bufio"
"fmt"
"log"
"math"
"os"
"strconv"
"strings"
)
// https://acm.timus.ru/problem.aspx?space=1&num=1119
func main() {
inputlines := getInputLines()
limits := stringToIntArray(inputlines[0], " ")
n := limits[0] + 1 // increace as we start from 1,1 point
m := limits[1] + 1 // increa... |
3e59c25ea0e2285e36cdf7f96d3d328724c2f45d | 3546902559bd12900ba2f56d36304934f853af9b | zhudamao-lu/gop2p | /protocol_api_test.go | Go | go | 814 | no_license | package gop2p
import (
"testing"
"net/rpc/jsonrpc"
"fmt"
"log"
)
func cmdHandle(methodName string, args interface{}, reply interface{}) error {
client, err := jsonrpc.Dial("tcp", ":1025")
if err != nil {
return err
}
defer client.Close()
err = client.Call("RPCCommandServer." + methodName, ... |
5e1ac6b56abdac67a3f531065c6bd111eacbf390 | 791150e468d2cfa5de577e794884cfe963f9e1bc | sgtest/monorepo-test-3 | /kubernetes-14/pkg/kubelet/dockertools/container_gc_test.go | Go | go | 11,922 | permissive | /*
Copyright 2014 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, ... |
e52281a811ad76b038ab600af82ed85b6b5e0ed3 | 5be95e7bf0d24ef78aff6b3af2f646926c0ade3b | gophemt/locales | /sr_Cyrl_RS/sr_Cyrl_RS_test.go | Go | go | 19,866 | permissive | package sr_Cyrl_RS
import (
"testing"
"time"
"package/locales"
"package/locales/currency"
)
func TestLocale(t *testing.T) {
trans := New()
expected := "sr_Cyrl_RS"
if trans.Locale() != expected {
t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale())
}
}
func TestPluralsRange(t... |
2ee7956be8cde91d320557f273afe54261ee7189 | 0d35c03c5ab5b54e1718816cebe8d01939cf77b2 | GrupoEstudoMega/exemplos-Go | /oracle-insert-limpo.go | Go | go | 631 | no_license | package main
import (
"database/sql"
"fmt"
_ "github.com/mattn/go-oci8"
/*"sync"
"time"*/)
func main() {
db, err := sql.Open("oci8", "system/mega@127.0.0.1:1521/mega")
if err != nil {
fmt.Println(err)
}
fmt.Println("antes do delete")
//db.Exec("delete from test")
fmt.Println("depois do delete")
_, er... |
ac2a5455bfd60018a64e9da8098b6ca7aab8aa12 | 316f2c8f8e87d907bd07a51d6b4970903fbf1e19 | socialsky-io/openapi-generator-go | /pkg/generators/models/testdata/cases/typed_arrays/generated/model_foo.go | Go | go | 618 | permissive | // This file is auto-generated, DO NOT EDIT.
//
// Source:
// Title: Test
// Version: 0.1.0
package generatortest
import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
// Foo is an object.
type Foo struct {
// Bar:
Bar []string `json:"bar,omitempty"`
}
// Validate implements basic validation for t... |
c8c01a0aff6e591b28ad325f892b2b2315be7bcc | b0dc22d77ce927469051e94bca893b86d5bbbce3 | apache/servicecomb-service-center | /pkg/event/subscriber_group_test.go | Go | go | 1,846 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
66f8936352b66648d290bf0d0f9b00f95e9b9c10 | 3bbe36c39e699f63cb4dbda4c998a1474a2a3a2e | rafaelsierra/mc | /cmd/admin-group-disable.go | Go | go | 1,073 | permissive | /*
* MinIO Client (C) 2019 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 law or agr... |
6d81c3829821ef119640de14e2d3b0abb14c2790 | 6f759cc5fe81be1f2b189604107f0830c675cd0e | kihamo/shadow | /components/messengers/internal/config.go | Go | go | 2,698 | no_license | package internal
import (
"github.com/kihamo/shadow/components/config"
"github.com/kihamo/shadow/components/messengers"
"github.com/kihamo/shadow/components/messengers/platforms/telegram"
)
// TODO: listen debug mode
func (c *Component) ConfigVariables() []config.Variable {
return []config.Variable{
config.New... |
9c3b71a5ba214564056947383c555333a9f5ce1a | f5f359d29d3c07e08272f99ca61109128942dc1f | szatmary/go-filecoin | /actor/builtin/storagemarket/storagemarket.go | Go | go | 7,700 | permissive | package storagemarket
import (
"context"
"fmt"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-hamt-ipld"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/libp2p/go-libp2p-peer"
"github.com/filecoin-project/go-filecoin/abi"
"github.com/filecoin-project/go-filecoin/actor"
"github.com/filecoin-project/go-filecoin... |
15089f32d07923d5319eb2e5fcdbea996b2701f0 | bc77d1e888e527a4598273c7598b057c4803ab9d | chrisgoffinet/notionapi | /client.go | Go | go | 13,556 | permissive | package notionapi
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"sort"
"strings"
"time"
)
const (
notionHost = "https://www.notion.so"
// modern Chrome
userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3483.0 Safari/537.36"
acceptLang = "... |
d404a673c21227372958eb0087ece68284cb1134 | 8faf5d9dfd3ad8c7593ddb8d7a9bd2287774cda6 | developers23/cyclone | /vendor/github.com/caicloud/cargo-admin/pkg/api/admin/handlers/tag.go | Go | go | 868 | permissive | package handlers
import (
"context"
"github.com/caicloud/cargo-admin/pkg/api/admin/form"
"github.com/caicloud/cargo-admin/pkg/api/admin/types"
"github.com/caicloud/cargo-admin/pkg/resource"
)
func ListTags(ctx context.Context, tid string, registry string, pname string, repoName string, q string, p *form.Paginati... |
abe67eb50a1b852e8ff8c37be8f0d67474e655c8 | 0bec0d902dddcf8583a0d45e9a1d16a45dece176 | liamchampton/http-package-example | /main.go | Go | go | 681 | permissive | package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
resp, err := http.Get("http://google.com")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
// Version 1
// // 'make' takes a type of a slice and number of elements we want it to be initialised with
// byteSlice := make([]byte, 99999) // "gi... |
d50ce128440d36be401ddbec4433bf18d8de8395 | 09312d8eaad05bca28f943a441318e015ec2ef3d | XDSTY/leetcode | /src/leetcode/Lt1TwoSum.go | Go | go | 974 | no_license | package leetcode
import "fmt"
/**
* 两数之和
给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。
你可以假设每种输入只会对应一个答案。但是,数组中同一个元素不能使用两遍。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/two-sum
思路:如果v1+v2 == target,v1在map中,则map[v1 = (target-v2)] != null.
所以遍历nums,当前val在map中不存在,则map[target-val]=i,val在m... |
f6a46abe3ce19375a37e29e84eb6e7ab8757dd7a | 62e659b4236433c7222ca7210f6637a94b96b2fe | maria-robobug/jwt-go-api | /src/router/router.go | Go | go | 501 | no_license | package router
import (
"github.com/labstack/echo"
"github.com/maria-robobug/jwt-go-api/src/api"
"github.com/maria-robobug/jwt-go-api/src/api/middlewares"
)
func New() *echo.Echo {
e := echo.New()
// create groups
securityGroup := e.Group("/security")
// set all middlewares
middlewares.SetMainMiddlewares(e)... |
5d028d7c426fe57e45e859ef625d67ff827ec250 | 6dad320c9be57e30f372bbbd8662b469ac4ad291 | lyndon160/airship | /auctioneer/bid.go | Go | go | 2,363 | permissive | package auctioneer
import (
"encoding/json"
"log"
"net/http"
"time"
"github.com/rs/xid"
"github.com/zenazn/goji/web"
"gopkg.in/mgo.v2/bson"
)
type Bid struct {
ID string `json:"id"`
AuctionID string `json:"auction_id"`
ItemID string `json:"item_id"`
UserID string `json:"us... |
6a8ac285ff4192308e62d9221d66f2d1f9c33a1b | bfcbb66973a615443a222ce35120dca15411272b | LightMingMing/bombardier | /bombardier.go | Go | go | 10,708 | permissive | package main
import (
"fmt"
"io"
"io/ioutil"
"net/url"
"os"
"strings"
"sync"
"sync/atomic"
"text/template"
"time"
"github.com/codesenberg/bombardier/internal"
fhist "github.com/codesenberg/concurrent/float64/histogram"
uhist "github.com/codesenberg/concurrent/uint64/histogram"
uuid "github.com/satori/g... |
278177d77140ea23cb8270beff00b974361c3c8e | bbd45f895e3aa62d7efb4f139c3d4cc790357885 | wfscot/go-strava-v3 | /client/model_cadence_stream.go | Go | go | 1,349 | no_license | /*
* Strava API v3
*
* The [Swagger Playground](https://developers.strava.com/playground) is the easiest way to familiarize yourself with the Strava API by submitting HTTP requests and observing the responses before you write any client code. It will show what a response will look like with different endpoints depen... |
8ee693eb1f9a0b589d8d206c5a83488240f7eec5 | 60e2af3a2651a85c9ac8778977d755316ed10108 | agneum/ferret | /pkg/runtime/expressions/clauses/limit.go | Go | go | 1,077 | permissive | package clauses
import (
"context"
"github.com/MontFerret/ferret/pkg/runtime/collections"
"github.com/MontFerret/ferret/pkg/runtime/core"
)
type LimitClause struct {
src core.SourceMap
dataSource collections.Iterable
count int
offset int
}
func NewLimitClause(
src core.SourceMap,
dataSource ... |
4eb493502ceb11ea0dd68cc32ddb9d2bcd0942d7 | dfda5ea03b930982ef0ed8ce3b70b15d21690ae2 | gillesfabio/genji | /internal/expr/operator.go | Go | go | 2,521 | permissive | package expr
import (
"github.com/genjidb/genji/document"
"github.com/genjidb/genji/internal/sql/scanner"
"github.com/genjidb/genji/internal/stringutil"
)
type simpleOperator struct {
a, b Expr
Tok scanner.Token
}
func (op simpleOperator) Precedence() int {
return op.Tok.Precedence()
}
func (op simpleOperato... |
43b0f462ae089fbd4a71badf48c9dc624c4e1866 | 2febc33002d2dfceda74a55b15c4c8d37372a5a2 | jcsongor/escher | /testing/cases/test_config.go | Go | go | 1,652 | permissive | package cases
import (
"encoding/json"
"io/ioutil"
"testing"
"time"
"github.com/EscherAuth/escher/config"
"github.com/EscherAuth/escher/keydb"
"github.com/EscherAuth/escher/request"
)
type TestConfig struct {
ID string
HeadersToSign []string `json:"headersToSign"`
Tit... |
c460c6652712a1da82e12330819e3b9b2f20cd34 | 555f4d262bd4d0180e027613dc7de130fc00a722 | garybake/quizmaster | /report/src/report.go | Go | go | 313 | permissive | package main
import (
"net/http"
"log"
"io/ioutil"
"os"
)
func main() {
MakeRequest()
}
func MakeRequest() {
url := os.Args[1]
resp, err := http.Get(url)
if err != nil {
log.Fatalln(err)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
}
log.Println(string(body))
} |
ecbc2bd428f0169262182b29c95c15bfc0084893 | 975c4acb1f9b42382af2acae680889091954b387 | zhuhyc/chubaofs | /util/exporter/timepoint.go | Go | go | 1,830 | permissive | // Copyright 2018 The Chubao 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... |
ff8fed79e7628f212e6319ab7e27e02edefa562d | 659768a45a5ee7448b88be859c24e89a7fb2ab27 | MisinformedDNA/pulumi-azure-native | /sdk/go/azure/dbformysql/getConfiguration.go | Go | go | 1,882 | 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 dbformysql
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Represents a Configuration.
// API Version: 2017-12-01.
func LookupConfiguration(ctx... |
2ab3747ac2f02e754c63acb8484c975ffaaa1814 | 5eec3ec7bcab10c0391ab3a6391aac919d42b0fa | wavesplatform/gowaves | /pkg/p2p/peer/extension/extension.go | Go | go | 2,534 | permissive | package extension
import (
"go.uber.org/zap"
"github.com/wavesplatform/gowaves/pkg/crypto"
"github.com/wavesplatform/gowaves/pkg/logging"
"github.com/wavesplatform/gowaves/pkg/p2p/peer"
"github.com/wavesplatform/gowaves/pkg/proto"
)
var peerVersionWithProtobuf = proto.NewVersion(1, 2, 0)
type PeerExtension int... |
eeefd9931089ba18c5ac8e24240555ead4db3a40 | 4a63a7347ddae3513d4e5e0a7990948741311c01 | daniel-henderson-ty/udw | /udwDebug/print_test.go | Go | go | 412 | permissive | package udwDebug_test
import (
"github.com/tachyon-protocol/udw/udwDebug"
"github.com/tachyon-protocol/udw/udwTest"
"testing"
)
func TestSprintln(ot *testing.T) {
udwTest.Equal(udwDebug.Sprintln([]byte{0, 1}), "[udwDebug.Println] []byte{0x0, 0x1}\n")
udwTest.Equal(udwDebug.Sprintln([]byte{}), "[udwDebug.Println]... |
2c4586e8a22e795214fbce7df331df682aa2165e | 99ef0d5016e68b573ac4df19bf8b4b1aa5afbdb8 | bluesaka/go-chat | /protocol/command.go | Go | go | 423 | no_license | package protocol
import "github.com/pkg/errors"
var (
UnknownCommand = errors.New("Unknown command")
)
// SendCommand is used for sending new message from client
type SendCommand struct {
Message string
}
// NameCommand is used for setting client display name
type NameCommand struct {
Name string
}
// MessageCo... |
9df94ae04765820ffc6008737e93a335cbc628e8 | bca3ef17481b10250a2a212b667b7718d4f5c3a6 | vibhordubey333/DishTV | /subscriptioncompute/subcompute_service.go | Go | go | 2,111 | no_license | package subscriptioncompute
import (
balanceinfo "DishTV/recharge"
"errors"
)
const (
SILVER int = 50
GOLD int = 100
DISCOUNT float64 = 0.1 // 10% is 0.1 .
)
var rechargeObject *balanceinfo.RechargeTokens
type Subscription interface {
ComputeAmount(int) int
Discount(int, int) int
}
//Accepts p... |
874d4c53742163d3035ca44626dc772ccb5c92a9 | d707aa3c934968f8e78cad4f7ac9cec4814cc926 | cloudflare/go | /test/fixedbugs/bug309.go | Go | go | 392 | permissive | // compile
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// issue 1016
package bug309
func foo(t interface{}, c chan int) {
switch v := t.(type) {
case int:
select {
case <-c:
// bug was: intern... |
37b80023747fff92bf8b84db0c562732312b52ee | ddd9bff7d31eabf845d51cfe145a1ea71538b009 | gobuffalo/genny | /gogen/rewrite_import_test.go | Go | go | 549 | permissive | package gogen
import (
"strings"
"testing"
"github.com/gobuffalo/genny/v2"
"github.com/stretchr/testify/require"
)
func Test_RewriteImports(t *testing.T) {
r := require.New(t)
f := genny.NewFile("main.go", strings.NewReader(cItmpl))
f, err := RewriteImports(f, map[string]string{
"1/2": "2/1",
"3/4": "4/... |
22dcb0fa6db1235317cdcb348c7978f65f58b19e | fa8c4fe3875a6144427d1bc89b7fadd45acc90c4 | dreamans/syncd | /router/project/space.go | Go | go | 3,711 | permissive | // Copyright 2019 syncd Author. All Rights Reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package project
import (
"github.com/gin-gonic/gin"
"github.com/dreamans/syncd/render"
"github.com/dreamans/syncd/module/project"
"github.com/dre... |
69248c04b74c5f2aa517de5a4f6ff2dfe86fe79f | 0fce5c48625b7b7f7a424bb83f58a1e5808b738b | shagtv/go-api | /controllers/userController/userController.go | Go | go | 300 | no_license | package userController
import (
"net/http"
)
func Login(res http.ResponseWriter, req *http.Request) {
}
func Logout(res http.ResponseWriter, req *http.Request) {
}
func Register(res http.ResponseWriter, req *http.Request) {
}
func Unregister(res http.ResponseWriter, req *http.Request) {
}
|
70ef5bd0b48df10aada7a2f2e7b13ed486f47dc8 | b4854bbe3d2e663808ed2f1747f7bd284faa6548 | selfup/gdsm | /cmd/slam/main.go | Go | go | 495 | permissive | package main
import (
"fmt"
"log"
"net"
"os"
"sync"
)
func main() {
pingMaxFiles()
}
func pingMaxFiles() {
var wg sync.WaitGroup
arg := os.Args[1]
requests := 1024
wg.Add(requests)
for i := 0; i < requests; i++ {
go func() {
call(arg)
wg.Done()
}()
}
wg.Wait()
}
func call(netAddr string) ... |
11fcc53e35248be481c6bb8ae3557411caadc502 | ae9443d885116763faef129f50a6fe78b66a4e4c | rhuss/kn-plugin-admin | /pkg/command/utils/utils.go | Go | go | 1,338 | permissive | // Copyright 2020 The Knative 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... |
95745a022aa0503d08c93b91bb639fa03ce7722b | 74b5529c21ea0ba8f85e1d08a27502f5e80899ef | robmurtha/spike | /math/shape/circle_test.go | Go | go | 586 | permissive | package shape
import (
"testing"
)
func TestCircle(t *testing.T) {
// Circle c1 = new Circle(0, 0, 1);
// Circle c2 = new Circle(0, 0, 1);
// Circle c3 = new Circle(2, 0, 1);
// Circle c4 = new Circle(0, 0, 2);
// assertTrue(c1.overlaps(c1));
// assertTrue(c1.overlaps(c2));
// assertFalse(c1.ov... |
1d47e3917614aa9f987e0326ad39f338b97951c8 | 34e232bf60819a6576ee870c113aa20d63689ea1 | yfz34/remote | /service/rpcx/room.go | Go | go | 1,250 | no_license | package rpcx
import (
"context"
"fmt"
"remoteback/models"
"remoteback/redis"
)
type Arith int
type Args struct {
A int
B int
}
type Reply struct {
C int
}
type CreateRoomRequest struct {
RoomID string
PlayerInfo models.PlayerInfo
}
type PlayerState struct {
Mute bool
Speed float32
Volume float32... |
4f643292b72647bfdcf876705f21876db738e9b9 | 0f305e525803829d03b16a7570e972cf8345ad5f | mangchiandjjoe/istio | /mixer/pkg/config/storetest/storetest.go | Go | go | 2,357 | permissive | // Copyright 2018 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 i... |
f35568ec555da12e979d4993ceebf530638f26e5 | a1ca96ab04b68791d13701feed330b5823839284 | hiscaler/mysql2es | /inoutput/row.go | Go | go | 8,808 | no_license | package inoutput
import (
"bytes"
"context"
"database/sql"
"encoding/json"
"fmt"
"github.com/go-ozzo/ozzo-dbx"
_ "github.com/go-sql-driver/mysql"
"github.com/hiscaler/mysql2es/config"
"github.com/hiscaler/mysql2es/m2elog"
"github.com/olivere/elastic/v7"
"log"
"math/rand"
"strconv"
"strings"
"sync"
"tim... |
f654f61246354a4d18ca18a03d7818300ff2dc3a | a45a285aabdfe5da6dd208fef374357620499d88 | gouglhupf/kanister | /pkg/app/mongodb.go | Go | go | 7,916 | permissive | // Copyright 2019 The Kanister 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 ag... |
774978e4cf9f6c66c3dc05091828026e38b4cca7 | 548f96d97982b0cefd1b0f070cddcc173df4c8b0 | ppools/typogenerator | /strategy/homoglyph_test.go | Go | go | 304 | permissive | package strategy_test
import (
"testing"
"../strategy"
)
func TestHomoglyph(t *testing.T) {
out, err := strategy.Homoglyph.Generate("zemithar")
if err != nil {
t.Fail()
t.Fatal("Error should not occurs !", err)
}
if len(out) == 0 {
t.FailNow()
}
if len(out) != 87 {
t.FailNow()
}
}
|
9c566181bd536f235acb00dcebcec4fa299e843a | 49aac700de02305e982c9dc81a88f22462b7df48 | wp-jackliu/opentaobao | /model/foodscan/AlibabaFootscanMiniReportListData.go | Go | go | 398 | permissive | package foodscan
// AlibabaFootscanMiniReportListData 结构体
type AlibabaFootscanMiniReportListData struct {
// 列表数据
List []FeetModelMobileReportVo `json:"list,omitempty" xml:"list>feet_model_mobile_report_vo,omitempty"`
// 页码
PageNum int64 `json:"page_num,omitempty" xml:"page_num,omitempty"`
// 页长
PageSize int64 `... |
96a474f307ab5f96f8ddf26fe11f422a34949791 | 5e4ec4fe35f46a1edf75e9948581e8f6d94d8832 | ferranbt/heura | /heura/ast/ast_test.go | Go | go | 705 | permissive | package ast
import (
"testing"
"github.com/umbracle/heura/heura/token"
)
func TestString(t *testing.T) {
program := &Program{
Statements: []Statement{
&LetStatement{
Token: token.Token{
Type: token.LET,
Literal: "let",
},
Name: []*Identifier{
&Identifier{
Token: token.Toke... |
3cff8a4a0c6aeb4ad3858f1509f581d6e9d78ce7 | 9afd73a30ad9eeaf4f5d89b12868da6d680542f2 | genius52/leetcode | /src/golang/array/2007. Find Original Array From Doubled Array.go | Go | go | 901 | no_license | package array
import "sort"
func FindOriginalArray(changed []int) []int {
var l int = len(changed)
if (l | 1) == l{
return []int{}
}
var record map[int]int = make(map[int]int)
var keys []int
for i := 0;i < l;i++{
record[changed[i]]++
}
for k,_ := range record{
keys = append(keys,k)
}
sort.Ints(keys)
... |
5f1dd846022145e4172ab81eea81badb5237f246 | f531af4894d12594579f52f951d14dd11599b8ac | rpaul80/hydra | /jwk/handler_test.go | Go | go | 1,589 | permissive | package jwk_test
import (
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
"github.com/julienschmidt/httprouter"
"github.com/ory/fosite"
"github.com/ory/herodot"
"github.com/ory/hydra/compose"
. "github.com/ory/hydra/jwk"
"github.com/ory/ladon"
"github.com/square/go-jose"
"github.com/stretchr/test... |
f2ca37259b2935a9b31bdb79892a65b025546e14 | 710de8b536958793e77878cb8170982724eb986f | hueypark/pebble | /error_test.go | Go | go | 4,926 | permissive | // Copyright 2019 The LevelDB-Go and Pebble 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 pebble
import (
"fmt"
"io"
"os"
"sync/atomic"
"testing"
"github.com/petermattis/pebble/vfs"
)
type panicLogger struct{}
fun... |
5b16bcbab658825d4ae4d802a31d0cdd4b5dc31a | ef6aff9cbe215104ff707ca9508567743787e130 | juanpablo-santos/gitea | /models/issue_comment_list.go | Go | go | 11,579 | permissive | // Copyright 2018 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 models
import (
"code.gitea.io/gitea/models/db"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
)
// C... |
212b3f7712e52c32e7a1f239d17d98f6ee473cb9 | 82003332c6267a161cc7d0949ccf34e69f063e3e | thommay/coreos-cloudinit | /system/systemd.go | Go | go | 4,995 | permissive | /*
Copyright 2014 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 wr... |
12d79c3afb984e4d5fe288a7cc8d356a34a67d03 | cdb7bdab945e9eaf27a1b5e62c803bd6abcfab8c | Kirchen99/grafana | /pkg/build/cmd/uploadpackages_test.go | Go | go | 2,251 | permissive | package main
import (
"errors"
"fmt"
"testing"
"github.com/grafana/grafana/pkg/build/config"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_getVersionFolder(t *testing.T) {
type args struct {
cfg uploadConfig
event string
versionFolder string
}
... |
66b32b7fd8e86cf8ab0e6353ea2b8a00aa7a5112 | f2237ab11201944c21208e4a3e701ac3add3069d | MasonSUn-6270/Go_Tour | /2_switch/s.go | Go | go | 215 | no_license | package main
import "fmt"
func print(x int) {
fmt.Println(x)
}
func stair(x int) {
switch {
case x<10 :
print(x+10)
case x<100:
print(x*x)
default:
print(99999999)
}
}
func main() {
stair(40)
} |
2d1f8e97618484c232137295d9e0f90e20b506c3 | 1c38cc5641e19cd59173aa1c4a48981b4c1ec218 | polaris-sharing/gotols | /suct/suct.go | Go | go | 288 | no_license | package suct
import (
"reflect"
)
// GetStructByName get struct value by fieldName
func GetStructByName(su interface{}, structName string) interface{} {
if reflect.TypeOf(su).Kind() != reflect.Struct {
return nil
}
return reflect.ValueOf(su).FieldByName(structName).Interface()
}
|
339bcb38fe9a4be61ba481603d0f110adaddb51d | 280f9650eef3050381b161f17a0b7d4205eb3d1c | reetuparna/xmpp | /internal/integration/prosody/config.go | Go | go | 2,610 | permissive | // Copyright 2020 The Mellium Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.
package prosody
import (
"fmt"
"path/filepath"
"strings"
"text/template"
)
// Config contains options that can be written to a Prosody config file.
type Config ... |
55a57cf89a00a6d365037ee3e4721fd357d6e91d | 486c94030bb10deb4d41aa3c178538f8dbf879f3 | huan-Mongo/mongo-tools | /mongorestore/mongorestore_test.go | Go | go | 61,912 | permissive | // Copyright (C) MongoDB, Inc. 2014-present.
//
// 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
package mongorestore
import (
"bufio"
"bytes"
... |
05e32a1c93b2f50864cd0d98035051316a34a98f | c5c757d8eec1ccdaaa0450fe842fde5d6ba42b14 | kubernetes-sigs/nfs-ganesha-server-and-external-provisioner | /pkg/volume/provision_test.go | Go | go | 28,359 | 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, ... |
709cbc0bd29789faf212d0755e069886c70e4ce3 | cec524d8ee21eeca7478a771aa8d9ffeb9614d9b | mmikitka/bazel-buildbarn | /pkg/blobstore/byte_stream_server.go | Go | go | 5,365 | permissive | package blobstore
import (
"context"
"io"
"strconv"
"strings"
"github.com/EdSchouten/bazel-buildbarn/pkg/util"
remoteexecution "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
"google.golang.org/genproto/googleapis/bytestream"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"... |
580dc39fb359964e0323d74a5f4f14e47019db1e | b779f3463178e5934f32fbc8f5b3ed9028d6b220 | gophemt/locales | /vai_Vaii/vai_Vaii_test.go | Go | go | 19,862 | permissive | package vai_Vaii
import (
"testing"
"time"
"package/locales"
"package/locales/currency"
)
func TestLocale(t *testing.T) {
trans := New()
expected := "vai_Vaii"
if trans.Locale() != expected {
t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale())
}
}
func TestPluralsRange(t *te... |
d1ba24a63182ffa18bfe555e562794a333a1eabf | 6d0a4279d0d2edb133361b074661178328c989c6 | dongnanpro/GO-MATRIX | /core/genesis_test.go | Go | go | 5,131 | permissive | // Copyright (c) 2018 The MATRIX Authors
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php
package core
import (
"math/big"
"reflect"
"testing"
"github.com/davecgh/go-spew/spew"
"github.com/matrix/go-matrix/common"
"github.... |
b31b9333e030ddf08d7c069521088d807e523161 | d796699595734b3bab382f8ef0198e83f1a06502 | gabaghul/Golang-repo | /Concorrencia/Select/main.go | Go | go | 449 | no_license | package main
import (
"fmt"
"time"
)
func main() {
canal1, canal2 := make(chan string), make(chan string)
go func() {
for {
time.Sleep(time.Millisecond * 500)
canal1 <- "Canal 1"
}
}()
go func() {
for {
time.Sleep(time.Second * 2)
canal2 <- "Canal 2"
}
}()
for {
select {
case mensa... |
63efe7c9193a35adde1724edb0b2638ca68309e0 | e90d41ee91c59063d6842020d5ce5f0b8bdeeb59 | GSWlee/leetcode | /80.go | Go | go | 561 | no_license | func removeDuplicates(nums []int) int {
length:=len(nums)
if length==0{
return 0
}
temp,i:=0,0
num,now:=0,nums[0]
for;i<length;{
if now==nums[i]{
num++
}else{
num=1
now=nums[i]
}
switch num{
case 1:
... |
27dd8a19e4e3d0c17cb234d02b7c3de89fd14c04 | 6a1f8e017a4d5497787db66df0ee7c04ac81b4d8 | hiei17/jvmgo-book | /v1/code/go/src/jvmgo/ch10/instructions/comparisons/if_acmp.go | Go | go | 596 | permissive | package comparisons
import "jvmgo/ch10/instructions/base"
import "jvmgo/ch10/rtda"
// Branch if reference comparison succeeds
type IF_ACMPEQ struct{ base.BranchInstruction }
func (self *IF_ACMPEQ) Execute(frame *rtda.Frame) {
if _acmp(frame) {
base.Branch(frame, self.Offset)
}
}
type IF_ACMPNE struct{ base.Bran... |
4dc55da64dd5afde10b3e6277382c6a1bc2ae3dc | a38c3ffc0c1c07e2b7bea62b704d5b9c1acd6346 | laashub-soa/maesh | /integration/kubernetes_test.go | Go | go | 810 | permissive | package integration
import (
"github.com/go-check/check"
checker "github.com/vdemeester/shakers"
)
// KubernetesSuite
type KubernetesSuite struct{ BaseSuite }
func (s *KubernetesSuite) SetUpSuite(c *check.C) {
requiredImages := []string{
"containous/maesh:latest",
"containous/whoami:v1.0.1",
"coredns/coredn... |
c6503ad524a67ac48e62eb1a1f8bff2e9245fe49 | 0fc8cd424e3be2531280e63dac5a5a1103ccedf9 | SlarkCao/AboutOne | /api4/file_test.go | Go | go | 38,376 | no_license | // Copyright (c) 2019-present AboutOne, Inc. All Rights Reserved.
package api4
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"net/textproto"
"net/url"
"os"
"path/filepath"
"strings"
"testing"
"time"
"za-white-screen/app"
"za-white-screen/model"
"za-white-screen/utils/fileutils"... |
a15e5b60ee92713fdeea5428bdcdc6a8cb226c03 | 86d714c8ae605ec2e161531ff6abc15a91fe2240 | chikin14niwa/gomniauth | /shortcuts_test.go | Go | go | 1,325 | permissive | package gomniauth
import (
"github.com/chikin14niwa/gomniauth/common"
"github.com/chikin14niwa/gomniauth/test"
"github.com/chikin14niwa/testify/assert"
"github.com/chikin14niwa/testify/mock"
"testing"
)
func TestNewState(t *testing.T) {
s := NewState("one", 1, "two", 2)
if assert.NotNil(t, s) {
assert.Equal... |
95dc023a31d23a0e5a2d14948241168a9673e5f3 | 3b17aa783faf99f3eb408ea4c95d8e1e6f799467 | ghj0504520/ngap | /ngapType/PDUSessionResourceReleasedItemPSFail.go | Go | go | 403 | permissive | package ngapType
import "github.com/free5gc/aper"
// Need to import "github.com/free5gc/aper" if it uses "aper"
type PDUSessionResourceReleasedItemPSFail struct {
PDUSessionID PDUSessionID
PathSwitchRequestUnsuccessfulTransfer aper.OctetString
IEExtensions *Protoc... |
9bd73045c98b6e81daad8bedd4eacf80f96d2d41 | 09bf4c386611bbd4b31ce2ffa2cda37d605bb309 | oif/cnc-source-modifier | /main.go | Go | go | 1,439 | permissive | package main
import (
"bufio"
"flag"
"fmt"
"os"
"time"
)
func main() {
var (
sourceFilePath string
printHelp bool
)
flag.StringVar(&sourceFilePath, "source", "",
"The CNC source file path, e.g /Users/john/a.cnc")
flag.BoolVar(&printHelp, "help", false, "Print help info")
flag.Parse()
if printHe... |
27078e81b07db35c74cac50b545e0af768769a4f | 231335e4b2d8a93d165765665d3470fac1ccd6af | AdrianCuellar-1995/Act_07_Cliente-Servidor | /cliente.go | Go | go | 940 | no_license | package main
import (
"encoding/gob"
"fmt"
"net"
"time"
)
type Proceso struct {
ID int
Timer int
ChanCont chan int
ChanID chan int
}
func cliente() {
var p Proceso
c, err := net.Dial("tcp", ":9999")
if err != nil {
fmt.Println("err1")
fmt.Println(err)
return
}
... |
06610b14a8286eb9331adcddd25935f45a656194 | c58dbf954e90c5908464ac205c547b69cac614de | yuansudong/design-patterns | /bridge/formation.go | Go | go | 274 | no_license | package bridge
type IFormation interface {
GetFormation() string
}
type CTreeFormation struct {
}
func (ctf *CTreeFormation) GetFormation() string {
return "树"
}
type CFlowerFormation struct {
}
func (cff *CFlowerFormation) GetFormation() string {
return "花"
}
|
fdfe92557b9cf8e3e13f501a325dc05593221f8c | 0863a801dfffb1a636106f3472ad42ef55e8fe6a | scottcagno/gng | /cmd/example/main.go | Go | go | 762 | permissive | package main
import "github.com/veandco/go-sdl2/sdl"
func main() {
if err := sdl.Init(sdl.INIT_EVERYTHING); err != nil {
panic(err)
}
defer sdl.Quit()
window, err := sdl.CreateWindow(
"test",
sdl.WINDOWPOS_UNDEFINED,
sdl.WINDOWPOS_UNDEFINED,
800,
600,
sdl.WINDOW_SHOWN,
)
if err != nil {
panic(e... |
301585b8697db3bb11ccbbe91ab0967a9e2987d8 | 57cd85f966d14e7b2cf34f8cb09771bae14d76a2 | 0x5010/go-leetcode | /0057_insert_interval/insert_interval.go | Go | go | 553 | no_license | package leetcode0057
/**
* Definition for an interval.
* type Interval struct {
* Start int
* End int
* }
*/
func insert(intervals []Interval, newInterval Interval) []Interval {
s, e := newInterval.Start, newInterval.End
l, r := []Interval{}, []Interval{}
for _, i := range intervals {
if i.End < s ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.