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 |
|---|---|---|---|---|---|---|---|---|
a0808bb1b9fb1954a3b0775828c7c9528206a07b | 9c48b2bde360586464888c5cde27dc8d8625b0dd | marlinprotocol/modifiedtendermint | /config/config.go | Go | go | 38,936 | permissive | package config
import (
"encoding/hex"
"errors"
"fmt"
"net/http"
"os"
"path/filepath"
"time"
)
const (
// FuzzModeDrop is a mode in which we randomly drop reads/writes, connections or sleep
FuzzModeDrop = iota
// FuzzModeDelay is a mode in which we randomly sleep
FuzzModeDelay
// LogFormatPlain is a form... |
885a5a77bd00ad270ad2ac49349aad85955eade8 | 7543782e168a6803e352303895ee549ab1014f8c | jonatns/opentelemetry-collector-contrib | /extension/httpforwarder/factory_test.go | Go | go | 3,092 | permissive | // Copyright The OpenTelemetry 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 agre... |
385691b12f62bbd588bbec6d1d340db7d9f0b2f8 | 6f7767d66ce7ddffc67164d1d3d86dc51067d3f3 | song-zhang/seaweedfs | /weed/s3api/s3api_server.go | Go | go | 7,766 | permissive | package s3api
import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb"
"net/http"
"strings"
"time"
"github.com/chrislusf/seaweedfs/weed/filer"
. "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants"
"github.com/chrislusf/seaweedfs/weed/s3api/s3err"
"github.com/gorilla/mux"
"google.golang.org/grpc"
)
type... |
0eee97e09319b897ca65850d8f3210bab8654569 | b0d92612c119a240aa5ad293e1aaa609c2231a88 | trungtvq/auto | /main.go | Go | go | 1,434 | no_license | package main
import (
"fmt"
"sync"
"time"
"github.com/trungtvq/auto/cmd"
"github.com/trungtvq/auto/cmd2"
"github.com/trungtvq/auto/mouse"
)
func main() {
fmt.Println("start")
var wg sync.WaitGroup
wg.Add(2)
go func() {
defer wg.Done()
cmd.InitBoss()
}()
go func() {
defer wg.Done()
cmd2.InitBoss(... |
caf0455ca5307a21289c7ddaedb3dc502e412425 | dee36218a8779e6e0c40a50b0cb1f485f1d99b23 | atercattus/golangconf19_examples | /handmade/events/i_am_ready.go | Go | go | 470 | no_license | package events
import (
"encoding/json"
"github.com/atercattus/golangconf19_examples/handmade/net"
)
type (
EventIAmReady struct {
EventBase
PlayerId net.Id
RaceId net.Id
}
)
func (event *EventIAmReady) getCommand() net.Command {
return net.CommandIAmReady
}
func (event *EventIAmReady) Marshal() []by... |
c42f2b8abd886975778bc14c3cf43e1f90a344c6 | dba0317e22474bb95354080d5483798758d5b644 | farukterzioglu/goBlockchain | /test/newTx_lowLevel_test.go | Go | go | 2,106 | no_license | package test
import (
"encoding/hex"
"github.com/farukterzioglu/goBlockchain"
"testing"
)
func TestNewTransaction(t *testing.T){
nodeId := "3000"
wallets, _ := goBlockchain.NewWallets(nodeId)
fromAddress := wallets.CreateWallet()
wallets.SaveToFile(nodeId)
wallet := wallets.GetWallet(fromAddress)
pubKeyHash ... |
d8aa7fa8e8a07a3b98820e83076eba384d288657 | 674dbf6061482511face23959fed9612640a2a6d | mcsaucy/rook | /tests/framework/installer/cockroachdb_installer.go | Go | go | 5,704 | permissive | /*
Copyright 2018 The Rook 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 agreed to ... |
8bb351f2279dcc38f29f75acf5a27fe5d879219a | 2eb4eef25ff7eeee126107ec13647333ec84a7ee | zhangnianyi/webblog | /api/v1/article.go | Go | go | 2,010 | no_license | package v1
import (
"ginblog/modles"
"ginblog/utils/errormessage"
"github.com/gin-gonic/gin"
"net/http"
"strconv"
)
func AddArtucle(c *gin.Context){
data :=new(modles.Artucle)
_ =c.ShouldBindJSON(data)
code =modles.CreateArtucle(data)
c.JSON(http.StatusOK,gin.H{
"status":code,
"data":data,
"message":e... |
862f7e3bfa733d61da441c5e359fcba85dc2ebe9 | 2d8c661d426df14f05478cd01a063e2f86b79593 | kolah/runner | /internal/pkg/simplerpc/server.go | Go | go | 1,707 | no_license | package simplerpc
import (
"bufio"
"fmt"
"net"
"strings"
)
type ServerHandlerFunc = func(c net.Conn, args []string)
type Server struct {
handlers map[string]ServerHandlerFunc
port int
socket net.Listener
}
func NewServer(port int) *Server {
return &Server{
handlers: make(map[string]ServerHandlerFunc... |
f5e904942475213988cb07b76b5402de38e72308 | ff7dc70155da4027e86acd3e489281fc32047fbe | Max4aters/webhook2telegram | /middleware/method_check.go | Go | go | 380 | permissive | package middleware
import (
"net/http"
)
func WithMethodCheck() func(h http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost && r.Method != http.MethodGet {
w.WriteHeader(http.StatusMetho... |
f44b9f5893cd913cb9307b73a1ff432ec0fee900 | 0730eb5e9315620e40c42753419dd3fcec653d52 | ashin-l/go-demo | /cmd/net/main.go | Go | go | 267 | no_license | package main
import (
"fmt"
"net"
"time"
)
func main() {
timeout := time.Duration(3 * time.Second)
_, err := net.DialTimeout("tcp", "192.168.61.11:554", timeout)
if err != nil {
fmt.Println("dial error:", err)
return
}
fmt.Println("tcp server is ok")
}
|
48d1f5571f95f60021526d6ffb6d8422ca903de9 | c3dc07fa8a905d879bf1239b58a7cc39c23d4a27 | orzzzli/goutils | /mysql/mysql.go | Go | go | 615 | no_license | package mysql
import (
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"time"
"fmt"
)
var GlobalMysqlPool *sqlx.DB
func NewMysqlPool(user string, pass string, host string, port string, database string,maxOpen int, maxIdle int, maxLife int) error {
driverStr := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?chars... |
1de07448951e0d9fefa0de14309c60bafe6f2900 | 46a51e5180649f5b9d2a4db6c2b1c5dee0f1ef3c | jaebradley/leetgode | /pathsumthree/main.go | Go | go | 2,026 | no_license | package pathsumthree
/*
https://leetcode.com/problems/path-sum-iii/
You are given a binary tree in which each node contains an integer value.
Find the number of paths that sum to a given value.
The path does not need to start or end at the root or a leaf, but it must go downwards (traveling only from parent nodes t... |
d32b58a5a00c3b0ec296e6910afffd58b0818500 | effec23fb82453e43489a8aa33a6a82a4aa9fffb | Kubenew/starboard | /pkg/plugin/aqua/scanner/api/scanner.go | Go | go | 3,572 | permissive | package api
import (
"strings"
"time"
"github.com/aquasecurity/starboard/pkg/apis/aquasecurity/v1alpha1"
"github.com/aquasecurity/starboard/pkg/plugin/aqua/client"
"github.com/google/go-containerregistry/pkg/name"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
adHocScansRegistry = "Ad Hoc Scans"
)
t... |
078161e9ecf08aff803855e7700a8a405e81da55 | 0f3a354b0552c2c6ac77f58292b01ead5bd0fd18 | d1ngd0/gofpdf | /buff.go | Go | go | 683 | permissive | package gofpdf
//Buff for pdf content
type Buff struct {
position int
datas []byte
}
//Write : write []byte to buffer
func (b *Buff) Write(p []byte) (int, error) {
for len(b.datas) < b.position+len(p) {
b.datas = append(b.datas, 0)
}
i := 0
max := len(p)
for i < max {
b.datas[i+b.position] = p[i]
i++
... |
68b208b81ecc2635a963dfd02ac70040281d7af8 | d2cd7815a7ec63b3477c6cd2c2b5a7de1cf381c3 | function61/gokit | /app/dynversion/version.go | Go | go | 1,454 | permissive | // Dynamically embed a build version at compile time, so you can statically access it at runtime.
package dynversion
import (
"errors"
"fmt"
"runtime/debug"
"strings"
"time"
)
// current user-friendly revision identifier for the currently running software
var Version = "dev"
func IsDevVersion() bool {
return s... |
83df00fdb41dffcbe6ed732ddea7794ba4b1e2bc | 158d5c4358f91255116c25d9387c923ee96feb80 | andybrucenet/compliance-masonry | /export.go | Go | go | 2,567 | permissive | package main
import (
"github.com/codegangsta/cli"
"github.com/opencontrol/compliance-masonry/commands/export"
"github.com/opencontrol/compliance-masonry/tools/constants"
)
const (
exportCommandName = "export"
exportCommandUsage = "Export to consolidated output (JSON/YAML)"
)
var (
exportCommandAliases = []st... |
4f80a69130d8261bb99aed0c966f5e7c41b31460 | 08e3c22ec27ad75626ebd00fdb43b7cfca152bd3 | diogopaza/Go_Golang | /livro_go/src/slice.go | Go | go | 1,442 | no_license | package main
import(
"fmt"
)
func main(){
/*
fib :=[]int{1,1,2,3,5,8,13}
fmt.Println(fib)
fmt.Println(fib[:3])
fmt.Println(fib[2:])
fmt.Println(fib[:])
original := []int{1,2,3,4,5}
fmt.Println("Original: ", original)
novo := original[1:3]
fmt.Println("Novo: ", novo)
original[2] = 13
fmt.Println("Or... |
a649f2143233834d0d250d9bebc5f02fa76a92be | 3a552c252a79c16885ecd3f50faaad23fcfd0bf6 | lxi1500/golang-message-purger | /main.go | Go | go | 2,940 | no_license | package main
import (
"fmt"
"github.com/bwmarrin/discordgo"
"os/signal"
"syscall"
"os"
"strings"
"github.com/fatih/color"
"github.com/lxi1500/gotitle"
"strconv"
)
func banner() {
fmt.Print("\033[H\033[2J")
color.Red(`
██████╗ ██╗ ██╗██████╗ ██████╗ ███████╗██████╗
██╔══██╗██║ ██║██╔══██╗█... |
18e596cc627ab6727414def7757e9f8230d53691 | f5e160ba5c0656f3cd974c9d43b0e418d5445ae8 | kubernetes/kubernetes | /vendor/github.com/vishvananda/netlink/gtp_linux.go | Go | go | 6,819 | permissive | package netlink
import (
"fmt"
"net"
"strings"
"syscall"
"github.com/vishvananda/netlink/nl"
"golang.org/x/sys/unix"
)
type PDP struct {
Version uint32
TID uint64
PeerAddress net.IP
MSAddress net.IP
Flow uint16
NetNSFD uint32
ITEI uint32
OTEI uint32
}
func (pdp *... |
bfd926f5dea3b658934e0bf5ac22b4cce9174dc3 | 2dd3f07ace571ac9e6234909953b3b1d9041e3d3 | n0ndual/ubuntu-kubernetes-mesos | /cmd/integration/integration.go | Go | go | 33,485 | 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... |
bac1ca2b137ea0315a345be70318c178efc1a217 | e83e6dfd88e830867f48df34f555891f63fb115d | kovetskiy/godiff | /changeset_writer_tpl.go | Go | go | 1,360 | no_license | package godiff
const commentsTplText = `
{{range $i, $_ := .}}
{{"\n\n"}}
{{if gt .Id 0}}
[{{.Id}}@{{.Version}}] | {{.Author.DisplayName}} | {{.UpdatedDate}}
{{"\n\n"}}
{{end}}
{{.Text | trimWhitespace}}
{{"\n\n---"}}
{{writeComments .Comments | indent}}
{{end}}`
const changesetTplText = `
{{range $i, ... |
b537df92fa51af3ee41bc91b17147fef04842f02 | 356ed72070bdc11456df0802c5190a92b9710b58 | cbordier/openbanking-quickstart | /apps/financroo-tpp/consent_commons.go | Go | go | 1,304 | permissive | package main
import (
"fmt"
"net/http"
"net/url"
"github.com/gin-gonic/gin"
acpclient "github.com/cloudentity/acp-client-go"
)
func (s *Server) CreateConsentResponse(c *gin.Context, bankID BankID, consentID string, user User, client acpclient.Client) {
var (
loginURL string
err er... |
1ff248e19f0171b0e79039358e9df58fd79f2a0e | 5e3ec75e886f9e62936d498cb888be6df32ab1ff | contrerasjorge/lenslocked.com | /models/oauth.go | Go | go | 1,852 | no_license | package models
import (
"github.com/jinzhu/gorm"
"golang.org/x/oauth2"
)
type OAuth struct {
gorm.Model
UserID uint `gorm:"not null;unique_index:user_id_service"`
Service string `gorm:"not null;unique_index:user_id_service"`
oauth2.Token
}
func NewOAuthService(db *gorm.DB) OAuthService {
return &oauthValid... |
ff2078ca73b23162b4834c11e427685ed36fca19 | 3c26a85d1ce9fdff63a8551dc7df20b700beba37 | stanleyyong/go | /exp/txnbuild/bump_sequence.go | Go | go | 734 | permissive | package txnbuild
import (
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
)
// BumpSequence represents the Stellar bump sequence operation. See
// https://www.stellar.org/developers/guides/concepts/list-of-operations.html
type BumpSequence struct {
BumpTo int64
xdrOp xdr.BumpSequenceOp
}
// B... |
50c0e39ab6ae0b3a4de9419fbf3e1811a68768a5 | 7041e48a2ae2bb14d8ad0f2275da9b3e1f9ce7dd | Mo-Sheikh/Golang | /fetch/fetchall.go | Go | go | 788 | no_license | package main
import (
"fmt"
"time"
"io/ioutil"
"io"
"os"
"net/http"
)
func main(){
start := time.Now()
ch := make(chan string)
for _, url := range os.Args[1:]{
go fetch(url, ch)
}
for range os.Args[1:]{
fmt.Println(<-ch)
}
fmt.Printf("%.2fs elapased \n", time.Since(start).Seconds())
}
func fetch(url s... |
413daed7e5243e9ac21a88120b74428719dd87ff | fb01b49d56beee336d1dc4664e67132b5c6521c5 | pradeepnnv/heyemoji | /event/emoji.go | Go | go | 4,945 | permissive | package event
import (
"fmt"
"regexp"
"strings"
"time"
"github.com/mmcdole/heyemoji/database"
"github.com/slack-go/slack"
)
var userRegex = regexp.MustCompile("<@[A-Z0-9]{2,}>")
func NewEmojiHandler(emoji map[string]int, dailyCap int, db database.Driver) EmojiHandler {
return EmojiHandler{emoji: emoji, dail... |
7edff60f12f8f48388d34629d061bc9077c02ff9 | 0b71ba1618375bf8d0198bd768fc4fceded4eca4 | viccuad/psp-sysctl-policy | /validate_test.go | Go | go | 3,352 | permissive | package main
import (
"encoding/json"
"testing"
"github.com/deckarep/golang-set"
kubewarden_testing "github.com/kubewarden/policy-sdk-go/testing"
)
func TestApproval(t *testing.T) {
for _, tcase := range []struct {
name string
testData string
settings Settings
}{
{
name: "empty settings allo... |
6873b1778d0706c409499fb75be3f6de17752c32 | bd40e3df25bbc6788bc02202173fc548c267ee04 | redhatxl/service-monitor | /apache-monitor/g/var.go | Go | go | 1,520 | permissive | package g
import (
"log"
"time"
"sync"
"github.com/open-falcon/common/model"
"math/rand"
)
var (
TransferClientsLock *sync.RWMutex = new(sync.RWMutex)
TransferClients map[string]*SingleConnRpcClient = map[string]*SingleConnRpcClient{}
)
func initTransferClient(addr string) {
TransferClientsLock.Lock()
... |
67736bfcab6e47334dab2961fe491858a4d6df85 | 57f818c38855c02b03b2c76ab3ccbb490f729135 | exu/bddgo | /stats_test.go | Go | go | 1,081 | no_license | package bddgo_test
import (
. "github.com/exu/bddgo"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
// Your task is to process a sequence of integer numbers
// to determine the following statistics:
// o) minimum value
// o) maximum value
// o) number of elements in the sequence
// o) average value
// F... |
d50bacb2b7438be4421ca2ce32b85d54ebf77162 | 1de831ff3ef5615cde95a634e5ed9b5a4d47a99a | JemmyH/tommyqueue | /tasks.go | Go | go | 594 | permissive | package tommyqueue
// Task represents a unit of work to be performed.
type Task struct {
// Type indicates the type of task to be performed.
Type string
// Payload holds data needed to perform the task.
Payload Payload
}
// NewTask returns a new Task given a type name and payload data.
//
// The payload values m... |
ca421d558bdf709833f4d277bed519bc8339c51a | 77a618c17f4aaa671f42b7ec221df83b669eeb42 | mirusky/Backend-Test | /cmd/main.go | Go | go | 2,078 | no_license | package main
import (
"encoding/json"
"fmt"
"strconv"
"strings"
)
func main() {
str := `{
"one":
{
"two": 3,
"four": [ 5,6,7]
},
"eight":
{
"nine":
{
"ten":11
}
}
}`
v := make(map[string]interface{})
json.Unmarshal([]byte(str), &v)
c := Flatten(v)
a, _ := json.Marshal(c)
fm... |
1094b9c0571d35ee867e43e5899c8a5caa492ade | 0ef254ebf0aeb22a9826f6661c4868a2bbf1bc24 | hegemone/kore-poc | /koredata-goa/vendor/github.com/goadesign/goa/design/security.go | Go | go | 4,271 | permissive | package design
import (
"fmt"
"net/url"
"github.com/goadesign/goa/dslengine"
)
// SecuritySchemeKind is a type of security scheme, according to the
// swagger specs.
type SecuritySchemeKind int
const (
// OAuth2SecurityKind means "oauth2" security type.
OAuth2SecurityKind SecuritySchemeKind = iota + 1
// Basi... |
fac232dd0667e354cf8cef13035da23aa204243f | 871b325276a2178f4e4e966ac03530c547b917af | control-center/serviced | /vendor/gopkg.in/check.v1/check_test.go | Go | go | 5,168 | permissive | // This file contains just a few generic helpers which are used by the
// other test files.
package check_test
import (
"flag"
"fmt"
"os"
"regexp"
"runtime"
"testing"
"time"
"gopkg.in/check.v1"
)
// We count the number of suites run at least to get a vague hint that the
// test suite is behaving as it shoul... |
f9cab9bbd9f7b4928cdaf2c62c94aa990a21056e | 608a68d0792f622d0db8bcf625e6bcc370d87933 | jstangroome/kubernetes | /pkg/cloudprovider/providers/gce/gce_loadbalancer_external_test.go | Go | go | 14,675 | 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, ... |
71ce629c8c439bf3ef6924713a98fb94c62862a9 | d816c3dc385c3d6b57294fa995667c44457d489b | Project-Planner/backend | /model/task.go | Go | go | 2,923 | no_license | package model
import (
"encoding/xml"
"github.com/google/uuid"
"net/http"
)
type Task struct {
Text string `xml:",chardata"`
ID string `xml:"id,attr"`
Name Attribute `xml:"name"`
Milestone struct {
Text string `xml:",chardata"`
ID string `xml:"id,attr"`
} `xml:"milestone"`
StartD... |
499ac009cea109a422d67fac4c04f2f5c3056a51 | 1c7ce7a51550c136b9989513223717cb695d2a30 | pengxianghu/shipper | /user-service/repository.go | Go | go | 1,084 | no_license | // user-service/repository.go
package main
import (
"github.com/jinzhu/gorm"
pb "github.com/pengxianghu/shipper/user-service/proto/user"
)
type Repository interface {
GetAll() ([]*pb.User, error)
Get(id string) (*pb.User, error)
Create(user *pb.User) error
GetByEmailAndPassword(user *pb.User) (*pb.User, error)
... |
5bf91b61aeec2b9984ea95802699fd23e16f4452 | 0240eb05f7b5c4a620e00bd3993f00cfdca8f789 | WarpCloud/walm | /vendor/github.com/docker/docker/distribution/pull.go | Go | go | 7,420 | permissive | package distribution // import "github.com/docker/docker/distribution"
import (
"context"
"fmt"
"runtime"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api"
"github.com/docker/docker/distribution/metadata"
"github.com/docker/docker/pkg/progress"
refstore "github.com/docker/docker/refere... |
47f993c85eae73b5289390374820eb63699322c4 | 495a1ffcfa3c1fd26bfe8eea06b956385ae87c95 | K-Daiki-0ne/Gin_Practice | /src/main.go | Go | go | 224 | no_license | package main
import (
"0ne/src/config"
"0ne/src/router"
"github.com/gin-gonic/gin"
)
func init() {
config.Connect()
}
func main() {
app := gin.Default()
router.Router(app)
app.Run(":3000")
defer config.Close()
}
|
ee60efb8d7dee7447d4701a80e87c782bcac20ba | de60189a678b098c9fd61f505be6e09050131b73 | adibrastegarnia/kubernetes-controller | /pkg/controller/util/k8s/resources.go | Go | go | 6,230 | permissive | // Copyright 2019-present Open Networking Foundation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
eaae69b18ecbaf05f566ac9618c225a7ffd85be6 | d8c170f8cc84e812f62f2da352a0ea8a1d1b08e9 | imissyouso/textmagic-rest-go | /model_timezone.go | Go | go | 669 | permissive | /*
* TextMagic API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package TextMagic
type Timezone struct {
// Internal timezone ID.
Id int32 `j... |
46927de4aa472aefba4c07a43dc1102e52fade40 | a0f1b33a0d791e486d88aa4cfff49dab28c82171 | Bhaskers-Blu-Org1/PublicRegulationFabric-Food-IBPV20 | /chaincode/write_ledger.go | Go | go | 15,583 | permissive | /*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this f... |
4da1339c417b33a7e917a5ae116903b13e35d7e8 | a354ee5ffd1710e24c925518654da697fceae18a | TenderChen/gofunctiontest | /mp3fromjsonbase64html5_test.go | Go | go | 233 | permissive | package gofunctiontest
import (
"testing"
)
func TestMp3FromBase64(t *testing.T) {
jsonFile := "./track.json"
outdir := "./tmp"
if err := Mp3FromBase64(jsonFile, outdir); err != nil {
t.Errorf("error:\n%s", err.Error())
}
}
|
0eaa17c5ba460affd9c8bed01ca72a107745afba | d0f55e8bd7778f32deedff47074cfaa8a75f2b62 | xieydd/Go_Zh | /go-language-programming/chapter4/cgss/src/cgss.go | Go | go | 2,549 | no_license | package main
import (
"bufio"
"fmt"
"github.com/xieydd/Go_Zh/go-language-programming/chapter4/cgss/src/cg"
"github.com/xieydd/Go_Zh/go-language-programming/chapter4/cgss/src/ipc"
"os"
"strconv"
"strings"
)
var centerClient *cg.CenterClient
func startCenterServer() error {
server := ipc.NewIpcServer(&cg.Cente... |
e9c0dcd47135b3608f7442129ddd1e548db24b98 | d9d953fb9c7235b4816f8d657e53b192c5425d5b | definaldhi97/ottopoint-purchase | /controllers/v2/vouchers/use_vouchers/useVoucherVidioController.go | Go | go | 2,265 | no_license | package use_vouchers
import (
"fmt"
"net/http"
"ottopoint-purchase/constants"
redishost "ottopoint-purchase/hosts/redis_token/host"
"ottopoint-purchase/models"
usevoucher "ottopoint-purchase/services/v2/vouchers/use_vouchers"
"ottopoint-purchase/utils"
"strings"
"github.com/gin-gonic/gin"
"github.com/sirups... |
0c48466bbdf74eb44224da1cd73be3abd4cd88ff | c703bbf4cb75b631466864c91232ca9f56cec04f | megamcloud/omelette | /entity/user.go | Go | go | 800 | permissive | package entity
import (
"time"
"github.com/jinzhu/gorm"
)
type User struct {
gorm.Model
Name string `gorm:"type:varchar(100);DEFAULT:NULL"`
UserName *string `gorm:"type:varchar(100);unique_index;DEFAULT:NULL"`
Email *string `gorm:"type:varchar(100);unique_index;DEFAULT:NULL"`
EmailVerif... |
427af0ca3ea1d898275dc5b54fe3787b24d6800e | fd7f06d6d5694d739e8998614b4c6bbce8bf6fe9 | mapleFU/tidb | /util/testleak/leaktest.go | Go | go | 5,347 | permissive | // Copyright 2013 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.
// Copyright 2016 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the... |
3ec8b22be4b99a5b653a810dd35134705afbf304 | cb599baa9d19f3972c403861aba3319e8e74654b | sofyan48/gempi | /api/callback.go | Go | go | 1,429 | no_license | package api
import (
"encoding/json"
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/sqs"
"github.com/sofyan48/gempi/entity"
"github.com/sofyan48/gempi/libs"
)
// Callback ...
type Callback struct{}
// GetCallbackFunction ...
func GetCallbackFunction() *Callback {
return &Callback{}
... |
d07aa6be852de7de1e43a8bc2dabc03fbcc752ef | c2d331780b5edac80d7e90f7f72f3c56d60cac89 | daemin9527/test17 | /main.go | Go | go | 442 | no_license | package main
import (
"fmt"
"log"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
title := "Jenkins X golang http example"
from := ""
if r.URL != nil {
from = r.URL.String()
}
if from != "/favicon.ico" {
log.Printf("title: %s\n", title)
}
fmt.Fprintf(w, "Hello from: "+title+"\n")
... |
b75dd0fcd4a4f8100c711ea0c5e7567ac50b4074 | 6582418ea63f3cfde62809f38870c3b74fea426c | ruifly2012/lanxi-mahjong-server | /src/code.google.com/p/go.tools/go/types/methodset.go | Go | go | 7,842 | permissive | // Copyright 2013 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.
// This file implements method sets.
package types
import (
"bytes"
"fmt"
"sort"
"sync"
)
// A MethodSet is an ordered set of concrete or ... |
7dd33ab4c5bc7f37ffc41a652ee4ce2b2e205bce | 743ad708aea0bdca8ed885ce45fdfe9ed794e0f5 | muxinc/kapacitor | /alert.go | Go | go | 33,782 | permissive | package kapacitor
import (
"bytes"
"encoding/json"
"errors"
"fmt"
html "html/template"
"log"
"net"
"net/http"
"os"
"os/exec"
"path/filepath"
"sync"
text "text/template"
"time"
"github.com/influxdata/influxdb/influxql"
imodels "github.com/influxdata/influxdb/models"
"github.com/influxdata/kapacitor/ex... |
cdcd9defe6ce6ff86d1b2f8e9b0ca5079c0751ba | 213208b4229dbcaf1a4006bcc2b50712d78bccab | appleboy/smsender | /smsender/model/route.go | Go | go | 907 | permissive | package model
import "regexp"
type Route struct {
Id int64 `json:"-"`
Name string `json:"name"`
Pattern string `json:"pattern"`
Provider string `json:"provider"`
From string `json:"from" db:"fromName"`
IsActive bool `json:"is_active" db:"isActive"`
provider Provider
regex *regexp.Regexp
}... |
2ae877fa5d37bdc89eabd2d30e9dedbe0beb70a5 | 53e71a380233f93f1d8d2af274d07f2077f03b0c | julienchan/suratan | /smtpd/protocol.go | Go | go | 10,173 | no_license | package smtpd
import (
"encoding/base64"
"errors"
"io"
"net"
"net/textproto"
"regexp"
"strings"
"time"
)
type Command struct {
cmd string
args string
orig string
}
type SMTPMessage struct {
From string
To []string
Data io.Reader
Helo string
}
func ParseCommand(line string) *Command {
words := stri... |
c846727f88758fd964ffb6990624212a413e04e9 | 2faa2bcc2ed5ff9d8d97996b47884d2b931a6298 | simhaonline/webfmwk | /example/request_id.go | Go | go | 528 | permissive | package main
import (
"github.com/burgesQ/webfmwk/v4"
"github.com/burgesQ/webfmwk/v4/handler"
)
// register the RequestID BEFORE the logger
func request_id() {
// init server w/ ctrl+c support and middlewares
var s = webfmwk.InitServer(webfmwk.WithCtrlC(),
webfmwk.WithHandlers(handler.Logging, handler.RequestID... |
f16834931a629ac2027751207921187ee4814a49 | b070a958532587f5c7ea52d4417d902692fd215c | niyonghui-master/studying-go | /.history/Day20200604/Example_01/main_20200604183517.go | Go | go | 442 | no_license | package main
import (
"fmt"
"time"
)
func main() {
d, err := time.ParseDuration("1h15m30.918273645s")
if err != nil {
panic(err)
}
round := []time.Duration{
time.Nanosecond,
time.Microsecond,
time.Millisecond,
time.Second,
2 * time.Second,
3 * time.Second,
4 * time.Second,
time.Minute,
10 *... |
ca8979960890c5cc93dc7b1508ecca30ad589d93 | a4ccc36f5bbea0e2a24f1ba61320d181c6c3e356 | sneal/rep | /cmd/rep/executor.go | Go | go | 7,631 | permissive | package main
import (
"flag"
executorinit "github.com/cloudfoundry-incubator/executor/initializer"
)
var gardenNetwork = flag.String(
"gardenNetwork",
executorinit.DefaultConfiguration.GardenNetwork,
"network mode for garden server (tcp, unix)",
)
var gardenAddr = flag.String(
"gardenAddr",
executorinit.Defa... |
06f21d4ff2b6e39edbd3df7d72e2fa9c90160ce8 | 5a8935fcc8f3658fe597a2593fbb0764fb5ae351 | Halo1996/algorithm012 | /Week_04/Jump Game II.go | Go | go | 905 | no_license | package main
//45. 跳跃游戏 II
//给定一个非负整数数组,你最初位于数组的第一个位置。
//
//数组中的每个元素代表你在该位置可以跳跃的最大长度。
//
//你的目标是使用最少的跳跃次数到达数组的最后一个位置。
//
//示例:
//
//输入: [2,3,1,1,4]
//输出: 2
//解释: 跳到最后一个位置的最小跳跃数是 2。
//从下标为 0 跳到下标为 1 的位置,跳 1 步,然后跳 3 步到达数组的最后一个位置。
func jump(nums []int) int {
//获取数组长度
length:=len(nums)
end:=0
maxP:=0
steps:=0
//遍历数组... |
cd56996fbe7d7ac429fa2eb213dc2217a91702c2 | 7ac02ceeb29e39e0e5381ab4c23a675d954d9a95 | sshyran/go-1 | /test/fixedbugs/bug039.go | Go | go | 285 | permissive | // errchk $G $D/$F.go
// 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 main
func f (x int) { // GCCGO_ERROR "previous"
var x int; // ERROR "redecl|redefinition"
}
|
d96ada87a93f1c674ab94f30815d4c567e75a32b | aa9bb7c7085d83be8d3b86256f423692524b9690 | somaliz/terrascan | /pkg/iac-providers/terraform/v14/load-dir_test.go | Go | go | 10,728 | permissive | /*
Copyright (C) 2020 Accurics, 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... |
63ff92f12084181d5a907068e3d5d63510acfc4e | b92974bdf36c27c468f273e0a83c354e075daf9b | radanalyticsio/oshinko-cli | /vendor/github.com/openshift/origin/pkg/oc/admin/create_login_template.go | Go | go | 1,676 | permissive | package admin
import (
"errors"
"io"
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"github.com/openshift/origin/pkg/auth/server/login"
"github.com/openshift/origin/pkg/oc/cli/util/clientcmd"
)
const CreateLoginTemplateCommand = "creat... |
cfe30f11cc4d422fad36213ff19ab7dc8aacffb0 | 1a442b71afdc077ab334ad18afb9194179a446a4 | hujimori/atcoder | /ABC137/C/solve.go | Go | go | 970 | no_license | package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
var sc = bufio.NewScanner(os.Stdin)
func nextInt() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
return i
}
func nextLine() string {
sc.Scan()
return sc.Text()
}
func main() {
sc.Split(bufio.ScanWords)
... |
df9046706e2f46b783e79fc46bef519de6aa59ca | d581d6630465c8b12bbccb63fa9f393a46f59e9d | championshuttler/kyverno | /test/e2e/validate/validate_test.go | Go | go | 6,492 | permissive | package validate
import (
"errors"
"fmt"
"os"
"testing"
"time"
"github.com/kyverno/kyverno/test/e2e"
commonE2E "github.com/kyverno/kyverno/test/e2e/common"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
k8sErrors "k8s.io/apimachinery/pkg/api/errors"
)
var (
// Cluster Polict GVR
policyGVR = e2e.Ge... |
316855ff020d22e9e842c34c3dba50b063f9be5c | e9fa5efc4f479a5ac10320d2717bf819a5200d51 | NEO2756/exonomy-sdk-backend | /engine/engine_test.go | Go | go | 12,241 | permissive | package engine
import (
"context"
"github.com/HydroProtocol/hydro-sdk-backend/common"
"github.com/labstack/gommon/log"
"github.com/shopspring/decimal"
"github.com/stretchr/testify/suite"
"sync"
"testing"
)
type engineTestSuite struct {
suite.Suite
}
func TestEngineTestSuite(t *testing.T) {
suite.Run(t, new(... |
f94e13cab54043d11f34a2c3369969fab5f3f431 | c053be928b37f2a37c1adae1744cf45038201f08 | lkh42088/cmpService | /dbmigrator/mysqllayer/mysql_table_config.go | Go | go | 957 | no_license | package mysqllayer
import (
"cmpService/dbmigrator/cbmodels"
"github.com/jinzhu/gorm"
)
// 192.168.10.33
// cmpService/Nubes1510!
// database: db_db
func CreateCbTable(db *gorm.DB) {
if db.HasTable(&cbmodels.Item{}) == false {
db.AutoMigrate(&cbmodels.Item{})
db.Set("gorm:table_options", "ENGINE=InnoDB").AutoM... |
b0f1e2ba2cb320c01228f0f8b3b58f1b18c46e09 | 91923f48c62c11ce3845df957310d7a167dc173d | txjzxz/beidoutianxuan | /code/txjzxz/sdkInit/sdkInfo.go | Go | go | 1,639 | no_license | package sdkInit
import (
"github.com/hyperledger/fabric-sdk-go/pkg/client/channel"
mspclient "github.com/hyperledger/fabric-sdk-go/pkg/client/msp"
"github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt"
contextAPI "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/context"
)
type OrgInfo struct {
OrgAd... |
5a177f7cf69808885e972ffe42280cd074e5fc74 | 0acf6636bdc421feb9fd9c5ff5629427d66abb74 | super-type/supertype | /pkg/dashboard/subscribers.go | Go | go | 929 | no_license | package dashboard
// TODO this definitely shouldn't be in dashboard service as we move forward
// MasterBedroom is the high-level attribute for master bedroom
type MasterBedroom struct {
Attribute string `json:"attribute"`
Lights Lights `json:"lights"`
Curtains Curtains `json:"curatins"`
Subscribers... |
98ff895cb1a283d1cb0a462ad55c847b08508418 | d1161a45ff4374287b5a01830ca44f3f1ca86a59 | lyft/atlantis | /server/logging/logger.go | Go | go | 5,380 | permissive | // Copyright 2017 HootSuite Media 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 ... |
4cb2547482493601b7bace79595aab694ba4f8cd | 98ec7cbe8ab36fb7381edfe45942420d6360e72c | hexdigest/apdu | /apdu.go | Go | go | 1,916 | permissive | package apdu
import (
"encoding/hex"
"errors"
"strings"
)
// APDU represents ISO-7816 APDU command
type APDU struct {
Cla byte
Ins byte
P1 byte
P2 byte
Data []byte
Le byte
}
var (
errInvalidDataLength = errors.New("Lc byte does not match data length")
errInvalidLength = errors.New("invalid len... |
6a6ffda5d66a4f2ceb29ca8a275c8ebba4d1fdb7 | e9e44ccfe5c56941577541feb0527e1b8e670461 | thesayyn/protoc-gen-ts | /test/conformance/maps/maps.go | Go | go | 604 | permissive | package main
import (
"io/ioutil"
"log"
"os"
maps "github.com/thesayyn/protoc-gen-ts/test/conformance/maps/pb"
"google.golang.org/protobuf/proto"
)
func main() {
tags := maps.Tags{
Key: "this is unique",
Keys: map[string]string{
"key1": "value1",
},
Topics: map[string]*maps.Topic{
"key2": &maps... |
28bf3b21e515686f012fb39df94e4605b70e2e68 | ab4540b1e80bfd6b7ca1d2685c36619e1f810045 | StvnWthrsp/adventofcode2020 | /day4/part2/part2.go | Go | go | 2,682 | permissive | /*
Steven Weatherspoon
2020 Advent of Code Challenge
Day 4, Part 2
This program takes the first argument as the input filepath
*/
package main
import (
"fmt"
"os"
"path/filepath"
"io/ioutil"
"strings"
"regexp"
"strconv"
)
func validatePassport(passport map[string]string) bool {
byr, err := strconv.Atoi(pass... |
39d8526061da2858dec36cb97d0d4573f4855910 | 1d880b03c98c261117f071325f09cab13bfe2817 | miffa/grpc_test | /examples/helloworld/greeter_server/recovery.go | Go | go | 613 | no_license | package main
import (
"context"
"fmt"
//"gitlab.10101111.com/oped/dbms_lib/logrus"
"github.com/sirupsen/logrus"
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
)
var (
rcustomfunc grpc_recovery.RecoveryHandlerFunc
rcustomfuncCtx grpc_recovery.RecoveryHandlerFuncContext
)
func Recove... |
98d91a033ea6f27a23503473da12d08497fa013c | 0beb75cb3f7dab22206614918d319e7dd8ff7447 | travisghansen/cert-manager | /pkg/internal/apis/certmanager/validation/certificate_test.go | Go | go | 16,488 | permissive | /*
Copyright 2019 The Jetstack cert-manager contributors.
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... |
d2dabe6b19533e7eb7249719071567b56849ebaf | 139da9fda74a0405f1f6925b78f740263d69f5e3 | zeptonaut/luci-go | /common/auth/localauth/ctx_test.go | Go | go | 1,350 | permissive | // Copyright 2017 The LUCI Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package localauth
import (
"testing"
"time"
"golang.org/x/net/context"
"golang.org/x/oauth2"
"github.com/luci/luci-go/common/clock"
"g... |
ededa267ce118aea6ae876ca1f14f639d0699adb | 157143d432bcab33bb024a95e499227b4a014e27 | xiaoxfan/geecache | /day6-single-flight/geecache/http.go | Go | go | 2,687 | no_license | package geecache
import (
"fmt"
"geecache/consistenthash"
"io/ioutil"
"log"
"net/http"
"net/url"
"strings"
"sync"
)
const (
defaultBasePath = "/_geecache/"
defaultReplicas = 50
)
type HTTPPool struct {
self string
basePath string
sync.Mutex
peers *consistenthash.Map
httpGetters map[string]*h... |
7e25f46d8ed2b212d00bbf47a2085e3bad0c1d22 | 75f260626b9fb40252d3c98f75cc1f03d4e9ab97 | xiaochenl/premo | /tester/interrelay_tester/tester_test.go | Go | go | 1,240 | permissive | package interrelay_tester
import (
"testing"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/crypto/asym"
rpcx "github.com/meshplus/go-bitxhub-client"
"github.com/meshplus/premo/internal/repo"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"github.com/stretchr/tes... |
10b92521d8abd78d457c7e1bc955f8fe5aeaedb6 | 474c836a13cad6bb7b42c0bf0ca4cc3879185d7f | die-net/fotomat | /vips/init.go | Go | go | 1,310 | permissive | package vips
/*
#cgo pkg-config: vips
#include <stdlib.h>
#include <vips/vips.h>
#include <vips/vips7compat.h>
#include "init.h"
*/
import "C"
import (
"os"
"runtime"
)
// Initialize starts up the world of VIPS. You should call this on program
// startup before using any other VIPS operations.
func Initialize() {
... |
d2f34298f6d5419e226f9e471c647ea54def7c76 | 049a7a3629f229d988d9ecce1b70fe66c04f3754 | snyderf/nsxt-bulk-group-add | /nsxt/model/model_node_service_status_properties.go | Go | go | 974 | 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
// Node service status properties
type NodeServiceStatusProperties struct {
// Link to this resource
Self *SelfResourceLink... |
9041b07046faaa2da68863e5dbd1d523251d0638 | d23f1328cbb1a2ecf37484d0ef1e72b84ca12b3e | berty/go-libtor | /libtor/darwin_openssl_crypto_ts_ts_req_utils.go | Go | go | 354 | permissive | // go-libtor - Self-contained Tor from Go
// Copyright (c) 2018 Péter Szilágyi. All rights reserved.
// +build darwin,amd64 darwin,arm64 ios,amd64 ios,arm64
// +build staticOpenssl
package libtor
/*
#define DSO_NONE
#define OPENSSLDIR "/usr/local/ssl"
#define ENGINESDIR "/usr/local/lib/engines"
#include <../crypto/t... |
ca1fa542254f9498528b5238e7f883e2b790e0c5 | fee18d24c6df87f720243b445e6b4fe3b03cf733 | tbobo555/PorkOldMan | /core/data_structure.go | Go | go | 771 | no_license | package core
const (
AppErrorDebugStatus = "debug"
AppErrorInfoStatus = "info"
AppErrorExceptionStatus = "exception"
AppErrorAlertStatus = "alert"
)
const (
MatchingActionKey = "Matching"
MatchedActionKey = "Matched"
StartActionKey = "Start"
JumpActionKey = "Jump"
LeftActionKey = "... |
566a1cec39a43f2400625b5546e6439d87cd0926 | 1486a55faa37aaa5e088c559731e8d0395cdf919 | dknlam/vsphere-automation-sdk-go | /services/nsxt-mp/api/SystemAdministrationLifecycleManagementMigrationStatsTypes.go | Go | go | 8,770 | permissive | // Copyright © 2019-2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
// Auto generated code. DO NOT EDIT.
// Data type definitions file for service: SystemAdministrationLifecycleManagementMigrationStats.
// Includes binding types of a structures and enumerations defined in the service.
... |
97ac8a4a3b0e88635b105643e0fd4792aba68a5b | 80e77839f31cbe1aba7523b2bc5b2587e9f6ae1e | ChimeraCoder/golang-stuff | /github.com/tumblr/gocircuit/src/circuit/kit/xor/xor_test.go | Go | go | 1,257 | permissive | // Copyright 2013 Tumblr, 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... |
3cc14d2965083d1b469328af08ee6c2b63f81420 | 91bd954a58692335559d4d40a6e8262a12a2a02e | ma6174/goplus | /cl/expr.go | Go | go | 51,292 | permissive | /*
Copyright 2020 The GoPlus Authors (goplus.org)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed t... |
9de35cf7ce747b3424e9d3cc93cc52037c05db00 | ea728c259cf4a5f15112557742286b7ccc334a9f | blackjyn/eonza | /config.go | Go | go | 5,676 | permissive | // Copyright 2020 Alexey Krivonogov. All rights reserved.
// Use of this source code is governed by a MIT license
// that can be found in the LICENSE file.
package main
import (
"eonza/lib"
"eonza/users"
"fmt"
"os"
"path"
"path/filepath"
"github.com/kataras/golog"
"gopkg.in/yaml.v2"
)
const (
ModeDefault ... |
a26e498be4c061cd9ae9634c73dd2131887c994d | b2746278e9d3e3fb0f3439d98d745c30d4524985 | squillace/porter-mysql | /pkg/mysql/schema_test.go | Go | go | 2,197 | permissive | package mysql
import (
"fmt"
"io/ioutil"
"testing"
"github.com/ghodss/yaml" // We are not using go-yaml because of serialization problems with jsonschema, don't use this library elsewhere
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/xeipuuv/gojsonschema"
)
func TestMi... |
08f6d346535eca50657ec4136374cc81536ec24f | 41203d9fa11de5586dba688ba1a40a17d5399e74 | pilgrim2go/rack | /manifest/run.go | Go | go | 4,006 | permissive | package manifest
import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
)
type Run struct {
App string
Dir string
Cache bool
Sync bool
done chan error
manifest Manifest
output Output
processes []Process
proxies []Proxy
syncs []Sync
}
// NewRun Default ... |
93762c124d612de2ff5c5ae29af02ec0f1a8aedd | a8dcfb5f8051b75be932b91ca0cb9c92123b38b8 | alshamiri5/linode-k8s-e2e-tests | /framework/streaming_replication.go | Go | go | 2,447 | permissive | package framework
import (
"fmt"
"strings"
"time"
v1 "github.com/appscode/kutil/core/v1"
"github.com/kubedb/postgres/pkg/controller"
"github.com/kubedb/postgres/pkg/leader_election"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func (f *Framework) GetPrimaryPodName(meta metav1.Ob... |
7a8e372790c79c3588c5769bfeec3de00ee468a4 | 4f4a0413f153f35a31fb23237c300afa00c8f99e | cashwu/go | /fun.go | Go | go | 281 | no_license | package main
import "fmt"
func add(x int, y int) int {
return x + y
}
func add1(x, y int) (int, int) {
return x + y, x - y
}
func add2(x, y int) (a, b int) {
a = y
b = x
return
}
func main() {
fmt.Println(add(1, 2))
fmt.Println(add1(1, 2))
fmt.Println(add2(1, 2))
}
|
d04940f3d35a9c96bbb779fdd299e86f6dc4130b | c1d766dd2060cd6c7e17cfc0dbdc4ee1a8d37da4 | alveraboquet/FirstMiner | /goex/poloniex/Poloniex.go | Go | go | 13,261 | permissive | package poloniex
import (
"encoding/json"
"errors"
. "zmyjobs/goex"
"fmt"
"log"
"net/http"
"net/url"
"strconv"
"strings"
"time"
)
const EXCHANGE_NAME = "poloniex.com"
const (
BASE_URL = "https://poloniex.com/"
TRADE_API = BASE_URL + "tradingApi"
PUBLIC_URL = BASE_URL + "public"
TICKER_AP... |
69110a1c50f8ccf74df5f4dedfa322be1654b979 | 0cd92ee9fd66aafd162b2c23420ff7ba8cbe93b9 | ZupIT/charlescd | /gate/web/api/handlers/representation/permission.go | Go | go | 1,271 | permissive | /*
*
* Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
*
* 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... |
aa0318950433097fb1238d4a37b0669299545793 | 44f07e0a66ad7fb5bb8154ff9be3aeab05f582bb | dereknit/tidb | /store/tikv/store_test.go | Go | go | 7,408 | permissive | // Copyright 2016 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... |
e6e0243c3e215751298d9c99ec4cd21860f51d91 | 86c69417cc0d990ec6604cfc3abe8237de62ae47 | qinshulei/skia-buildbot | /golden/go/issuestore/issuestore_test.go | Go | go | 7,239 | permissive | package issuestore
import (
"fmt"
"math/rand"
"sort"
"strings"
"testing"
assert "github.com/stretchr/testify/require"
"go.skia.org/infra/go/testutils"
"go.skia.org/infra/go/util"
)
const (
TEST_DATA_DIR = "./testdata"
// Prefixes for different generated item types.
ISSUE_PREFIX = "ISSUES_"
DIGEST_PREF... |
c4843d7d2a5e5a2532aa86ae15d86b6e19522f23 | 2bcf50ba48cea4534a979580e263a177ebc8107f | wbensalah/terraform-provider-openstack-old | /openstack/resource_openstack_secgroup.go | Go | go | 6,372 | no_license | package openstack
import (
"bytes"
"fmt"
"log"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/openstack/compute/v2/extensions/secgroups"
)
func resourceSecgroup() *schema.Resource {
return &s... |
b486198999d9e2b0130ac34836a45701482a5c14 | 8c6e3ff7c38cda93ae023f37a8f15a839240f904 | nch-bowstave/nchain-ably | /vendor/github.com/ably/ably-go/ably/proto_error.go | Go | go | 838 | permissive | package ably
// errorInfo describes an error returned via ProtocolMessage.
type errorInfo struct {
StatusCode int `json:"statusCode,omitempty" codec:"statusCode,omitempty"`
Code int `json:"code,omitempty" codec:"code,omitempty"`
HRef string `json:"href,omitempty" codec:"href,omitempty"` //spec TI4... |
510b34bd3858829aa504be9b83839b478d03a756 | 5112a43bd12d56795f553c7d6b0e407680706a21 | xialuo1990/moha | /agent/cleaner_test.go | Go | go | 1,030 | permissive | // Copyright 2018 MOBIKE, 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... |
7651b5b01fa172913828626af821e121b85e9770 | 6a57f49ad2b48a56b88f0eb94a6cf67f356e7faf | nlukjanov/go-tdd | /structs-methods-interfaces/shapes.go | Go | go | 537 | no_license | package main
import "math"
type Shape interface {
Area() float64
}
type Rectangle struct {
Width float64
Height float64
}
func (r Rectangle) Area() float64 {
return r.Width * r.Height
}
type Circle struct {
Radius float64
}
func (c Circle) Area() float64 {
return math.Pi * c.Radius * c.Radius
}
func Perim... |
b6e5b65d3f36e7f2996b8ecc1861b0a5b9a4e4d1 | 5c156541bad790b36bb343ce9b8fb381adcd1cbd | couchbase/moss | /segment_stack.go | Go | go | 6,176 | permissive | // Copyright 2016-Present Couchbase, Inc.
//
// Use of this software is governed by the Business Source License included
// in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
// in that file, in accordance with the Business Source License, use of this
// software will be governed by the Apach... |
c3e0005a34aaf521f54686d976d4932589ab80ad | 268d8b2a8b8c152c0bdf85a41129776493248a39 | dashboardijo/martian-components | /body/request-body/modifier.go | Go | go | 3,183 | permissive | // Package requestbody registers a request modifier for modify request bodies
package requestbody
import (
"bytes"
"encoding/json"
"io/ioutil"
"log"
"net/http"
"strings"
"github.com/devopsfaith/flatmap/tree"
"github.com/google/martian/parse"
)
func init() {
parse.Register("modify_request_body", FromJSON_mod... |
57dd1ee74a00518a293cbac4640deb342d75405a | b6158ac64af3892b8ee4a82fb4ad6bcec77d89c1 | katena-chain/sdk-go | /examples/retrieve_secret/main.go | Go | go | 2,253 | permissive | /**
* Copyright (c) 2018, TransChain.
*
* This source code is licensed under the Apache 2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
package main
import (
"fmt"
"github.com/katena-chain/sdk-go/client"
"github.com/katena-chain/sdk-go/entity/certify"
entityCommon "gith... |
1415b76e9c4b6b20ca7ab93f37fbaa85c94b3324 | c2c5267b6ffd14e13130d6f99b9d4c92f5b80686 | georgekuruvillak/gardener-extensions | /pkg/webhook/controlplane/handler.go | Go | go | 4,561 | permissive | // Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lice... |
7c996a6bc4e56d424a9a551fb333dfe64a69abe9 | 59b45f2b8b3b856f66a566bb0b1edbe2978e078e | TheNewNormal/corectl | /vendor/github.com/coreos/etcd/store/stats.go | Go | go | 3,745 | permissive | // Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.