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 |
|---|---|---|---|---|---|---|---|---|
f7e754c3f8759541d45feb8323f832656c00a534 | 5138856fd1d4daadc1e9ea5fb57a1540462913c4 | alifa20/kops | /pkg/apiserver/registry/instancegroup/etcd.go | Go | go | 1,751 | 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, ... |
c6f625c32d1449e378a70e5de14d08f7aacdd5de | f7a0ee331c13124c42049520c7e1d5710928bbd2 | alexellis/jaas | /vendor/github.com/docker/docker/client/image_tag_test.go | Go | go | 4,182 | permissive | package client
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"strings"
"testing"
"golang.org/x/net/context"
)
func TestImageTagError(t *testing.T) {
client := &Client{
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
}
err := client.ImageTag(context.Background(), "image_... |
55632277e96d9e7b79b7a67af5dcf0c605b456d3 | a7925cd19b157091eae7008a7d17f8dfa8efe45d | ChengTiesheng/netplugin | /netplugin/cluster/cluster.go | Go | go | 8,395 | permissive | /***
Copyright 2014 Cisco Systems Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... |
ab23e5867419d988c28bf03fa5efaa0a4640a5c3 | a1e672233cb3dd1c861ca442ad2e903e5ff684ea | fujiwara/fluent-agent-hydra | /cmd/fluent-http-tailf/main.go | Go | go | 6,354 | permissive | package main
import (
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/fujiwara/fluent-agent-hydra/fluent"
"github.com/fujiwara/fluent-agent-hydra/ltsv"
)
var (
MessageCh = make(map[string]map[int64]chan ... |
cee6a91ca35b49f4613d56de4494809687768604 | a9edfd9a3a68aaf1574c26feaf44fa9a7c943528 | souled3000/kindergarten | /models/exceptional_child.go | Go | go | 8,705 | no_license | package models
import(
"math"
"github.com/astaxie/beego/orm"
"time"
"strconv"
"strings"
)
type ExceptionalChild struct {
Id int `json:"id";orm:"column(id);auto"`
ChildName string `json:"child_name";orm:"column(child_name);size(20)"`
Class int `json:"class";orm:"column(class)"... |
62227693a1319d3bb0fa271c419082f13883e7f7 | 73f35238df1bb235b2d8ee316f9dc7d86492c980 | aruaru0/golang_myatcoder | /ABC/214/B/main.go | Go | go | 2,073 | no_license | package main
import (
"bufio"
"fmt"
"math"
"os"
"sort"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)
func out(x ...interface{}) {
fmt.Fprintln(wr, x...)
}
func getI() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
... |
4c60b39de62af38a8ff4ef7a48c00929ab24f04b | 3a82b2bc78f2e77d6cb9ef8255ac84b42fdeeb3b | FengliangChen/learnning | /opentxt.go | Go | go | 278 | no_license | package main
import (
//"bufio"
"fmt"
"io"
"os"
)
func main() {
inputFile, _ := os.Open("./text_collection.txt")
var readfile io.Reader = inputFile
p := make([]byte, 10)
for {
_, err := readfile.Read(p)
if err == io.EOF {
return
}
fmt.Print(string(p))
}
}
|
5bbdbc189080407b37602a3c1c184bd5fe6e6b02 | d5254ec91c7915de805c9e7c399a1b13cbb91f75 | gabemontero/monitor-jenkins-lifecycle | /vendor/github.com/openshift/origin/pkg/cmd/infra/deployer/deployer.go | Go | go | 9,826 | permissive | package deployer
import (
"fmt"
"io"
"os"
"sort"
"time"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kv1core "k8s.io/client-go/kubernetes/typed/core/v1"
restclient "k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/api/legacyscheme"
kapi "k8s.io/kubernetes/pkg/apis/core"
kclientset ... |
a6109c7eeed91cdd56f7b28f0c0122b16e9541f3 | 970255f984221d005fb61bea8aee05034007c760 | EricHripko/dipod | /vendor/github.com/docker/libnetwork/resolver_test.go | Go | go | 7,225 | permissive | package libnetwork
import (
"bytes"
"net"
"syscall"
"testing"
"time"
"github.com/miekg/dns"
)
// a simple/null address type that will be used to fake a local address for unit testing
type tstaddr struct {
net string
}
func (a *tstaddr) Network() string { return "tcp" }
func (a *tstaddr) String() string { re... |
ca2bc8b948ed21eabef060e3c4564a5373c2fca1 | a28fbd43fa643d71e0ebbf259843ab552dbffbf3 | laura-brouckman/go-eloqua | /eloqua/custom_objects.go | Go | go | 3,475 | permissive | package eloqua
import (
"fmt"
)
// CustomObjectService provides access to all the endpoints related
// to custom object data within eloqua
//
// Eloqua API docs: https://goo.gl/cQyZYx
type CustomObjectService struct {
client *Client
}
// CustomObject represents an Eloqua custom object.
// These fields are taken fr... |
ec15f8b0a37e62fcef31f634e92674ef405758ed | a01353ebbd019f002e700cf2f1d67f4c5b6894a6 | th3architect/cloudfocker | /Godeps/_workspace/src/github.com/dotcloud/docker/api/server/server.go | Go | go | 40,996 | permissive | package server
import (
"bufio"
"bytes"
"crypto/tls"
"crypto/x509"
"encoding/base64"
"encoding/json"
"expvar"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"net/http/pprof"
"os"
"strconv"
"strings"
"syscall"
"code.google.com/p/go.net/websocket"
"github.com/cloudcredo/cloudfocker/Godeps/_workspace... |
89c5d7d029df668d9041ccce78c68f83cd1898e1 | 97d0da77472821d9917c2c80de964063ee03ca88 | killianmuldoon/cluster-api-provider-metal3 | /baremetal/utils.go | Go | go | 8,615 | permissive | /*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
e0500d2d02a946bb3d81364a57cfc13751a3569a | de272307948146bdc43afb0ee31d39935e672ff5 | poopmail/canalization | /internal/database/postgres/mailbox.go | Go | go | 4,207 | no_license | package postgres
import (
"context"
"errors"
"fmt"
"strings"
"github.com/bwmarrin/snowflake"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/poopmail/canalization/internal/shared"
)
// mailboxService represents the postgres mailbox service implementation
type mailboxService struct {
... |
d9181241b46acec871ba25d82d54bc271f021ff1 | bdc8873f749948dc3b12346ae954abc6e343524d | digitalocean/doctl | /vendor/github.com/erikgeiser/promptkit/selection/model.go | Go | go | 10,542 | permissive | package selection
import (
"bytes"
"fmt"
"strings"
"text/template"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/erikgeiser/promptkit"
"github.com/muesli/termenv"
)
// Model implements the bubbletea.Model for a selection prompt.
type Model[T any] struct {
... |
dee757902bac756bb0481e641037dfd5e6894684 | 8e42ca743dc51d90c1137627560c697e75bd39d6 | ManchersterByTheSea/openBilibili | /go-common/app/admin/main/vip/http/http.go | Go | go | 6,086 | no_license | package http
import (
"go-common/app/admin/main/vip/conf"
"go-common/app/admin/main/vip/service"
"go-common/library/log"
bm "go-common/library/net/http/blademaster"
"go-common/library/net/http/blademaster/middleware/permit"
)
var (
// depend service
vipSvc *service.Service
authSvc *permit.Permit
cf *co... |
ea53773b0a0a21de453b32cf48d31ff83394bdb1 | 30253c7e9a89d86cb6ddaf517ca31ed77d06e85b | Woellchen/godot-go | /cmd/generate/types/generate.go | Go | go | 10,885 | permissive | // Package types is responsible for parsing the Godot headers for type definitions
// and generating Go wrappers around that structure.
package types
import (
"bytes"
"log"
"os"
"os/exec"
"sort"
"strings"
"text/template"
"github.com/Woellchen/godot-go/cmd/generate/methods"
"github.com/kr/pretty"
"github.com... |
d86c680f6e6e21d8cc5178d17bf6d4844cc3e551 | 643dc5fe15436c0d9de502391ea3167a7fc75cb3 | etcd-io/etcd | /tools/etcd-dump-metrics/metrics.go | Go | go | 6,070 | permissive | // Copyright 2018 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... |
f875e6bcf8acf81cd1a647a003d39740cd4d4b26 | d9ac1b971a1591d39bd48283d698ac4408920ceb | Luoxin/FastestBilibiliDownloader | /engine/concurrent.go | Go | go | 2,063 | no_license | package engine
import (
"context"
"sync"
)
var _urlVisited = make(map[string]struct{})
type ConcurrentEngine struct {
WorkerCount int
Scheduler Scheduler
ItemChan chan *Item
}
func NewConcurrentEngine(workerCount int, scheduler Scheduler, itemChan chan *Item) *ConcurrentEngine {
return &ConcurrentEngine{... |
e7596ad20b023544f521336223d6ece71e4f87bd | 3b802b1aa1802064fe0fbc06ee5a067a35af6768 | johnlegend/cookiejar | /deque/deque.go | Go | go | 5,498 | permissive | // CookieJar - A contestant's algorithm toolbox
// Copyright (c) 2013 Peter Szilagyi. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the ab... |
0b60ea9bb4c4bce19656a78c83c87c76b66dd189 | cc75e5e48600c76171210ffb035b24f76a6f0300 | WinDaLex/crane | /manager/list.go | Go | go | 295 | permissive | package manager
import (
"fmt"
"github.com/windalex/crane/manifests"
"github.com/windalex/crane/packages"
)
func AllInstalledPackages() ([]string, error) {
return packages.All()
}
func AllManifests() ([]string, error) {
r, _ := manifests.All()
fmt.Println(r)
return []string{}, nil
}
|
f9cae286132a5c9bee5ab875a545e70e93641031 | 207a015ca1b6eeef8887e3551e4527efe313c739 | azhuang321/-learnCmd-Crone-Etcd-mongodb | /mongodb_usage/demo3/find.go | Go | go | 1,855 | no_license | package main
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"time"
)
type TimePoint struct {
StartTime int64 `bson:"startTime"`
EndTime int64 `bson:"endTime"`
}
type LogRecord struct {
JobName string `bson:"jobName"` //任务名
Command string `bson:"comma... |
37a47530599b2d81ef99509123b6432f453c8374 | d4325bf919e4626542c876be248a7347afc7ad7a | whistlinwilly/stackvm | /vm_basic_test.go | Go | go | 946 | no_license | package stackvm_test
import (
"testing"
. "github.com/jcorbin/stackvm/x"
)
// These tests are essentially "unit" tests operations and/or features of the
// vm.
// So far my testing strategy has been to write end-to-end or "integration"
// tests since it's been a decent trade-off of time to outcome, and it forced
... |
4979abc03b375e4de5d8799cb7777e97ea6a5a3c | 26db7e4c886811524d34c54a6bab4ae9f53af1a1 | Stingertough/tidb | /server/http_handler.go | Go | go | 34,808 | permissive | // Copyright 2018 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... |
ba71b17ecf1f8f589c39e02afcab34831880d62e | 8f4d8959274d3b552e5f6a7d43c0a753988beb4b | codacy-badger/agent | /engine/attach.go | Go | go | 2,870 | permissive | package engine
import (
"bufio"
"context"
"io"
"net/http/httputil"
"strings"
"time"
"github.com/docker/docker/pkg/stdcopy"
dockertypes "github.com/docker/docker/api/types"
coreutils "github.com/projecteru2/core/utils"
log "github.com/sirupsen/logrus"
"github.com/docker/go-units"
"github.com/projecteru2/... |
e7aeb3521b394a5b99e288d10eff69652691abf2 | 8834b2da649df32c58083cbc39e7323b9a274574 | yukpiz/go-firestore-example | /clienta/main.go | Go | go | 803 | no_license | package main
import (
"context"
"flag"
"log"
"strings"
"time"
firebase "firebase.google.com/go"
"github.com/yukpiz/go-firestore-example/domain"
"golang.org/x/xerrors"
"google.golang.org/api/option"
)
func main() {
msg := flag.String("msg", "", "message")
flag.Parse()
if len(strings.TrimSpace(*msg)) == 0 ... |
00e09dbdeec067c183eba8cb4eb0f9c21cf0da18 | de6591d183206940a7e34ceef9750c2ba77f0e26 | mkristiansen/bootkube | /vendor/k8s.io/kubernetes/pkg/controller/node/nodecontroller.go | Go | go | 32,102 | 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... |
b2eaa727e4d57b3fe57d5529da75783b4a6732cf | 2a487289fb1af2fbe73cd9331725eb9770a091db | maguroguma/go-competitive | /sho-jin/past_contests/workout/1st/joined/ABC147-E/main.go | Go | go | 6,394 | permissive | /*
URL:
https://atcoder.jp/contests/abc147/tasks/abc147_e
*/
package main
import (
"bufio"
"errors"
"fmt"
"io"
"math"
"os"
"strconv"
)
/********** FAU standard libraries **********/
//fmt.Sprintf("%b\n", 255) // binary expression
/********** I/O usage **********/
//str := ReadString()
//i := ReadInt()
//X... |
e833e895a19116ff3cfd05d17472fc7f3373c383 | 96b0dc275441c894c419c9b7e04cd65e6983f73b | siongui/html2rst | /element2rst.go | Go | go | 942 | permissive | package html2rst
import (
"golang.org/x/net/html"
"strings"
)
func a2rst(n *html.Node) string {
if isImgElement(n.FirstChild) {
rstText := img2rst(n.FirstChild)
href, ok := getAttribute(n, "href")
if ok {
rstText += " :target: "
rstText += href
rstText += "\n"
}
return rstText
}
text := str... |
6145aa5e9774481283d4899f82bcab7b33aed777 | edc8df97ecf19b8971812449bd955c4bce2ee2e2 | willshang/go-leetcode | /source/1401-1500/1432_max-difference-you-can-get-from-changing-an-integer/2-暴力法.go | Go | go | 551 | no_license | package main
import (
"strconv"
"strings"
)
func main() {
}
// leetcode1432_改变一个整数能得到的最大差值
func maxDiff(num int) int {
maxValue, minValue := num, num
str := strconv.Itoa(num)
for x := 0; x < 10; x++ {
for y := 0; y < 10; y++ {
newStr := strings.ReplaceAll(str, string('0'+x), string('0'+y))
if newStr[0]... |
5abf80403844a827580e79596635d12dd07f5083 | 8a30fb12e7e8f4e673d6a064e88307dad05c31d4 | jcbsmpsn/kce | /cmd/version.go | Go | go | 364 | permissive | package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
func init() {
RootCmd.AddCommand(versionCmd)
}
var versionCmd = &cobra.Command{
Use: "kceversion",
Short: "Print the version number of kce",
Long: `All software has versions. This is kce's`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("... |
b2db717ecaf8ec8a4c0b73438cfa8a18106de835 | bda2b69d71f7f9aed92ae2971de2e60dc6967953 | ooncn/common | /util/sys_test.go | Go | go | 687 | no_license | package util
import (
"encoding/binary"
"fmt"
"net"
"testing"
)
func TestIp(t *testing.T) {
result := Ip2Long("98.138.253.109")
fmt.Println(result)
// or if you prefer the super fast way
faster := binary.BigEndian.Uint32(net.ParseIP("98.138.253.109")[12:16])
fmt.Println(faster)
faster64 := int64(faster)
fm... |
3f6399c5482b7696f2562da372772a4b12ce8f3e | 3cba55f15e81d27f2573a173b77817b65cb226ec | mguzelevich/sauron | /storage/engines/bolt/bolt_tx.go | Go | go | 1,189 | permissive | package bolt
import (
"github.com/boltdb/bolt"
)
type TxContext struct {
tx *bolt.Tx
}
func NewTx(tx *bolt.Tx) *TxContext {
return &TxContext{
tx: tx,
}
}
func (t *TxContext) name() {
}
func (t *TxContext) getBucket(names []string) (*bolt.Bucket, error) {
var bucket *bolt.Bucket
for _, bn := range names {... |
b866741f822b8a04a9dd20ec85cf205b2ffd055e | c3b29399e9f8149e1331612145818a54459f6abe | hskwakr/misc-go | /src/webcrawler/crawler/crawler.go | Go | go | 507 | permissive | package crawler
import (
"fmt"
"github.com/gocolly/colly"
)
type Link struct {
URL string `json:"URL"`
}
func GetLinks(site string) ([]Link, error) {
links := make([]Link, 0)
c := colly.NewCollector()
c.OnHTML("a[href]", func(e *colly.HTMLElement) {
href := e.Attr("href")
link := Link{URL: href}
links ... |
1d59c96d7e35d873c810f553e9c9bf31a1add3ef | b4fcdd798e741300a2b977d65762fb3a815ed771 | PomeloCloud/pcfs | /drone/storage/startup.go | Go | go | 2,131 | permissive | package storage
import (
bftraft "github.com/PomeloCloud/BFTRaft4go/server"
pcfs "github.com/PomeloCloud/pcfs/server"
"log"
"os"
"os/signal"
"time"
)
var FS PCFS
func initDB(dbPath string) {
if _, err := os.Stat(dbPath); os.IsNotExist(err) {
if err := os.MkdirAll(dbPath, os.ModePerm); err != nil {
panic(... |
255ce9f986d611677a3f8fe162a15f89f0bda6ef | 1550796c942db4e84f5b8875a8affd34a29b2e6d | yiippee/esim | /tool/db2entity/domain-file/dao_domain_file.go | Go | go | 3,312 | permissive | package domainfile
import (
"path/filepath"
"strings"
"errors"
"github.com/jukylin/esim/log"
"github.com/jukylin/esim/pkg"
filedir "github.com/jukylin/esim/pkg/file-dir"
"github.com/jukylin/esim/pkg/templates"
"github.com/spf13/viper"
)
type daoDomainFile struct {
withDaoTarget string
withDisableDao bool... |
6a1b5c4eda68139339a163ba72e70330c1d7cc6c | b597c9e4fde05b5e1a9f69360916cc04896b4c5a | pokekrishna/kome-automation | /filesystem/files_test.go | Go | go | 647 | no_license | package filesystem
import (
"log"
"os"
"testing"
)
func TestFileExists(t *testing.T) {
path := "./randomfilename123"
err := FileExists(path)
if err == nil {
t.Errorf("File '%s' should not exist but it does.\n %v", path, err)
}
err = os.Mkdir(path, 0750)
if err != nil {
log.Fatalf("Cannot create dummy di... |
224a715dda82ef201790c82ab956f94456b602f9 | 7c1ea83009d502241ae9d3288a1755e9ba210421 | alimoeeny/perkeep | /dev/devcam/mount.go | Go | go | 3,359 | permissive | /*
Copyright 2013 The Perkeep Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
1132aab65c15127a68249207bb6df41734aeb2b9 | cbb6803634c8ee196f208a87d60bcb2165595e59 | terabyte128/golaundrybot | /generators.go | Go | go | 630 | no_license | package main
import (
"log"
"strconv"
mqtt "github.com/eclipse/paho.mqtt.golang"
)
func generateMachineUpdateFn(mac *LaundryMachine) func(client mqtt.Client, message mqtt.Message) {
return func(client mqtt.Client, message mqtt.Message) {
amps, err := strconv.ParseFloat(string(message.Payload()), 32)
if err ... |
866b21e6f4091de6d7bc07eb9ca9c8da0e349894 | b8ac2c0f21d171ebedc7dc7eff4ea6c2cf765972 | zhouziqunzzq/leetcode-golang | /mycode/52_n_queens_ii.go | Go | go | 754 | no_license | package mycode
func totalNQueens(n int) int {
return totalNQueensHelper(
0,
make(map[int]bool),
make(map[int]bool),
make(map[int]bool),
0,
n,
)
}
func totalNQueensHelper(row int, cols, diags, antiDiags map[int]bool, cnt, n int) int {
for col := 0; col < n; col++ {
diag := row - col
antiDiag := row ... |
caf30001d010200b3877138097bd628e6c86ec6c | 2b4029be4cb731cebcb33799240d43acdff6aac9 | r3aker/puppy-hids | /server/models/mongo.go | Go | go | 564 | no_license | package models
import (
"puppy-hids/server/utils"
"gopkg.in/mgo.v2"
)
func conn(netloc string, dbname string) (*mgo.Database, error) {
info := mgo.DialInfo{
Addrs: []string{netloc},
Username: "root",
Password: "root",
}
session, err := mgo.DialWithInfo(&info)
if err != nil {
return ... |
f1b05b4166cbd8526df1476381a688847bade4fe | fb82a34586711e421a80f44bc12e1981c808b9ff | LinMAD/gobattle | /pkg/game/room.go | Go | go | 1,893 | no_license | package game
import (
"fmt"
)
// WarRoomMediator game room with players
type WarRoomMediator interface {
// JoinPlayer to room
JoinPlayer(p *Player) error
// MakeTurn for player and return if he succeed
MakeTurn(p *Player) bool
// GetActivePlayer returns player who must make turn
GetActivePlayer() *Player
}
/... |
bc64e911a04ee64ae5dbd338b473db0dcda80179 | 60becbbd3c6fa568cb53835ed62414aa70f9a51f | manish-bhardwaz/OrderManagement | /payment-gateway-server/main.go | Go | go | 881 | no_license | package main
import (
"net"
"golang.org/x/net/context"
"OrderManagement/store"
"google.golang.org/grpc"
)
// PaymentGatewayServer : represents a Quantity Server
type PaymentGatewayServer struct {
}
// NewPaymentGatewayServer : instantiates a new quantity server
func NewPaymentGatewayServer() *PaymentGatewaySe... |
de93d26350583565d29cc5b42817979c0d11fa64 | 00cfc62108502165381a5137b24c0eb6c67f7b0b | tukaianirban/sdk.go.spotify | /core/spotify.go | Go | go | 8,585 | permissive | // Package spotify provides utilties for interfacing
// with Spotify's Web API.
package core
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
"time"
)
// Version is the version of this library.
const Version = "1.0.0"
const (
// DateLayout can be used with ti... |
71a3ca5b5a54c7a403d5cb3b033b54032f19faae | aa436014701b72eb54f70b3602a529fe4da01d54 | nwmahoney/bosh-bootloader | /vendor/github.com/genevieve/leftovers/aws/ec2/network_interfaces.go | Go | go | 1,695 | permissive | package ec2
import (
"fmt"
"strings"
awsec2 "github.com/aws/aws-sdk-go/service/ec2"
"github.com/genevieve/leftovers/aws/common"
)
type networkInterfacesClient interface {
DescribeNetworkInterfaces(*awsec2.DescribeNetworkInterfacesInput) (*awsec2.DescribeNetworkInterfacesOutput, error)
DeleteNetworkInterface(*a... |
56d126f1bb19622f83e64e0b477d679b3d41e295 | 4ccf9601ead5bebc049d388e2404f1616d2657a8 | JackySmith/single | /utils/api.go | Go | go | 801 | no_license | package utils
import (
"net/http"
"net/url"
"github.com/JackySmith/single/model"
)
func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request) {
T, _ := GetTranslationsAndLocale(w, r)
title := T("api.templates.error.title", map[string]interface{}{"SiteName": ClientCfg["SiteName"]})
messag... |
21c9b983e1a4f09a141fbb5ee1bee1f3bff22905 | 39caf5f835d8c4d086b9d7b105616d0216c1f898 | sgtest/monorepo-test-3 | /kubernetes-3/pkg/registry/rbac/rest/storage_rbac.go | Go | go | 14,092 | 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, ... |
39ca02f160f358ba5eacc9ce30a47e241d08674a | ecda48ddbef4d127be5ffad3d9d907a2cbe3cf85 | huaweicloud/huaweicloud-sdk-go-v3 | /services/bms/v1/bms_invoker.go | Go | go | 9,700 | permissive | package v1
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/bms/v1/model"
)
type AddServerNicsInvoker struct {
*invoker.BaseInvoker
}
func (i *AddServerNicsInvoker) Invoke() (*model.AddServerNicsResponse, error) {
if result, err := i.Base... |
d4d1e0cb1855b635b16cb9fee42c487ca33e04b2 | 025c600993b1ed3cd685b0a0799a9814c1674cf2 | jirfag/fabric8-auth | /test/witservice.go | Go | go | 1,030 | permissive | package test
import (
"context"
"github.com/fabric8-services/fabric8-auth/account/repository"
"github.com/fabric8-services/fabric8-auth/app"
testservice "github.com/fabric8-services/fabric8-auth/test/service"
"github.com/fabric8-services/fabric8-auth/wit"
goauuid "github.com/goadesign/goa/uuid"
"github.com/goju... |
609bb9af8335a4122bf1780683a2b513873a6b71 | 696210fa3106b56ca738415bc774dda85686dd51 | erikh/ent-bug | /schema/repository.go | Go | go | 847 | no_license | package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/edge"
)
// Repository holds the schema definition for the Repository entity.
type Repository struct {
ent.Schema
}
// Fields of the Repository.
func (Repository) Fields() []ent.Field {
return []ent.Field{}
}
// E... |
19dd4a1e69a7101fd05a7944fd707725e2b02363 | f7c8655dc2b91503636776961558ca83895df08b | tiwillia/ocm-sdk-go | /accountsmgmt/v1/cluster_registration_response_type.go | Go | go | 5,945 | permissive | /*
Copyright (c) 2019 Red Hat, 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 writing, software... |
38aa2e045742c02312a46ad2b6a3b933dbc81852 | 447cb03e256f52136244cd8ae4ffa2eb3859eeb1 | vishal-biyani/fission | /crd/function.go | Go | go | 2,890 | permissive | /*
Copyright 2016 The Fission 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, sof... |
0e89536a5f3b6683401ae1b338fe9e4583fa4f24 | b1487768880bd991a329ab35a28b6621eea8e819 | yrj2011/my-test-infra | /vendor/golang.org/x/crypto/ssh/kex.go | Go | go | 14,098 | 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.
package ssh
import (
"crypto"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/subtle"
"errors"
"io"
"math/big"
"golang.org/x/crypto/curve25519... |
b5fbf4d5b6d5886c7ff6d6b98b936648fcfd9181 | 02e1f1199d24883ba1a2780829b350d97453b548 | dashaun/cf-nozzle-tcp | /main.go | Go | go | 1,525 | no_license | package main
import (
"crypto/tls"
"fmt"
"log"
"os"
"github.com/cloudfoundry/noaa/consumer"
"github.com/cloudfoundry/sonde-go/events"
"github.com/kelseyhightower/envconfig"
"github.com/prydin/cf-nozzle-tcp/nozzle"
)
func main() {
nozzleConfig := &nozzle.NozzleConfig{}
err := envconfig.Process("nozzle", noz... |
f4fe7aad8aefad61647f29fd9eb5694f98f9cdab | 47c26d9635b2578196165a5accf37bdadb027d27 | gpfti/wash | /plugin/kubernetes/container-log.go | Go | go | 1,628 | permissive | package kubernetes
import (
"bytes"
"context"
"fmt"
"io"
"github.com/puppetlabs/wash/activity"
"github.com/puppetlabs/wash/plugin"
corev1 "k8s.io/api/core/v1"
k8s "k8s.io/client-go/kubernetes"
)
type containerLogFile struct {
plugin.EntryBase
namespace, podName, containerName string
client ... |
712ed963d0e6cfae5d518750f1ae91916190e3b0 | e240b731f1441d01ecff803aed2a763b08b6fd1b | whoisandy/gokatas | /problems/has_unique_chars.go | Go | go | 318 | no_license | package problems
// HasUniqueChar :finds unique character in string
func HasUniqueChar(str string) bool {
charMap := map[string]string{}
for _, elem := range str {
char := string(elem)
_, charPresent := charMap[char]
if !charPresent {
charMap[char] = char
} else {
return false
}
}
return true
}
|
5bb180188e22f5fc7e71a092ae56bf4f1ae9c427 | ba45d2eae805616414cbe6c41cc099295b11c1ee | bububa/opentaobao | /model/legalcase/EntrustModel.go | Go | go | 1,484 | permissive | package legalcase
// EntrustModel 结构体
type EntrustModel struct {
// 附件
AttachmentList []FileModel `json:"attachment_list,omitempty" xml:"attachment_list>file_model,omitempty"`
// 案件ids
CaseIds []int64 `json:"case_ids,omitempty" xml:"case_ids>int64,omitempty"`
// 委托项
EntrustTypes []string `json:"entrust_types,omi... |
e88ccb7f5d2aa8f4aade4fdfba1f41cb1d8a4aaf | a194704982a3994ff8540e51151a1618613772fc | nmarley/dashrates | /coinbase.go | Go | go | 1,939 | permissive | package dashrates
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strconv"
"time"
)
// CoinbaseAPI implements the RateAPI interface and contains info necessary for
// calling to the public Coinbase price ticker API.
type CoinbaseAPI struct {
BaseAPIURL string
PriceTickerEndpoint string
}
// N... |
052ce72b633285de10c21bb94fe67e07d81b807d | 239710137edd6846095109655076c4e468f311b8 | fanxy-app/nft-stays | /x/marketplace/genesis.go | Go | go | 833 | no_license | package marketplace
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/kryptopoo/marketplace/x/marketplace/keeper"
"github.com/kryptopoo/marketplace/x/marketplace/types"
)
// InitGenesis initializes the capability module's state from a provided genesis
// state.
func InitGenesis(ctx sdk.Context, k keepe... |
62e32eb1fde60fec51f6bb7889d5a56dbd0a1e51 | 32f25ee01f04ceff465a4c30395f012439b99ecb | hillsdong/hcode | /dataStructuresAndAlgorithms/bsearch/bsearch_test.go | Go | go | 430 | permissive | package bsearch
import "testing"
func nums() []int {
return []int{2, 3, 4, 8, 8, 8, 8, 9, 10}
}
func TestB1(t *testing.T) {
t.Error(b1(nums(), 10))
}
func TestB2(t *testing.T) {
t.Error(b2(nums(), 7))
}
func TestB3(t *testing.T) {
t.Error(b3(nums(), 8))
}
func TestB4(t *testing.T) {
t.Error(b4(nums(), 8))
}
... |
e2b23628673cdcd54b76b86016e135695e9a0644 | f8a12f233003811a819abfa4a96a418c343675a4 | 767829413/go-algorithm | /greedy/huffman_test.go | Go | go | 263 | no_license | package greedy
import (
"testing"
)
func TestNewHuffManTree(t *testing.T) {
str := []rune(`对输入的英文大写字母进行统计概率 然后构建哈夫曼树,输出是按照概率降序排序输出Huffman编码`)
h := NewHuffManTree(str)
h.Print()
}
|
e1021d42611713f38ae6920d25765b5ed85a9d7b | 27aa279fc8a10ebf953f46b6465b95673b0de5a0 | maxamillion/cloud-connector | /internal/controller/api/openapi_spec_handler_test.go | Go | go | 1,434 | no_license | package api
import (
"io/ioutil"
"net/http"
"net/http/httptest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/gorilla/mux"
)
const (
OPENAPI_SPEC_ENDPOINT = URL_BASE_PATH + "/openapi.json"
)
var _ = Describe("OpenAPI", func() {
Describe("Serve openapi.json", func() {
Context("With a ... |
5397e305a117ce18d2de87e1d0e99b5525713858 | 893bef57d120d4f15f5044917fe992296f32e284 | bdshadow/kubernetes-client-android | /kubernetes-model/vendor/github.com/openshift/origin/test/extended/prometheus/prometheus.go | Go | go | 11,726 | permissive | /**
* Copyright (C) 2015 Red Hat, 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... |
f802e92ada1140dfcd368834024468b6cca2f0bf | d261774491a574dae5509ebc96283ab8d500b511 | aruaru0/golang_myatcoder | /PM9/ABC/abc184/E/main.go | Go | go | 3,734 | no_license | package main
import (
"bufio"
"container/heap"
"fmt"
"math"
"os"
"sort"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)
func out(x ...interface{}) {
fmt.Fprintln(wr, x...)
}
func getI() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
return... |
1c94e281cfb92e2dafb9374c9ec9ae44310fb474 | b929a573d90204c04956c8226e77a5975d081e6a | openshift/kubernetes | /openshift-hack/e2e/annotate/rules_test.go | Go | go | 3,112 | permissive | package annotate
import (
"testing"
"github.com/onsi/ginkgo/v2/types"
)
type testNode struct {
text string
}
func (n *testNode) CodeLocations() []types.CodeLocation {
return []types.CodeLocation{{FileName: "k8s.io/kubernetes"}}
}
func (n *testNode) Text() string {
return n.text
}
func (n *testNode) AppendTex... |
82fa6432c16230bc3a68c887617d46c88453053c | 3d7286e5c531bef64e9b757b3cf13abf127dd02c | cb-kubecd/jr-goreleaser-test1 | /cmd/main.go | Go | go | 200 | permissive | package main
import (
"os"
"github.com/cb-kubecd/jr-goreleaser-test1/cmd/root"
)
// Entrypoint for the command
func main() {
err := root.Execute()
if err != nil {
os.Exit(1)
}
os.Exit(0)
}
|
dc9584ce74b18eeed6796986cb4897ba9f31994e | a6027d93bf1d68b2b81ed013ea19d88c3d3864fc | stcatz/hackerrank | /arrays_and_sorting/find-median/test.go | Go | go | 477 | no_license | package main
import "fmt"
//import "strings"
func partition(x []int) int {
i,j := 0, len(x)-1
key := x[j]
for i < j {
for x[i] <= key && i<j {
i++
}
x[i], x[j] = x[j], x[i]
for x[j] > key && i<j {
j--
}
x[i], x[j] = x[j], x[i]
}
return j
}
func main() {
var s int
fmt.Scanln(&s)
ar :... |
899691ecfe9779c62bb097f1864ef321713db289 | f04072b447960eb6b062eba0fde012ac0df5a6e3 | mrizkyanditama/lelangin-backend | /api/controllers/login_controller.go | Go | go | 2,379 | no_license | package controllers
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"github.com/gin-gonic/gin"
"github.com/mrizkyanditama/lelangin/api/auth"
"github.com/mrizkyanditama/lelangin/api/models"
"github.com/mrizkyanditama/lelangin/api/security"
"github.com/mrizkyanditama/lelangin/api/utils/formaterror"
"gol... |
613d7ce7f2456928b4422ecc3d069a8d76458ca7 | ba2fb11428d48f900dbbd604197389e17f7eedf1 | scottcagno/net-tools | /pkg/ngin/_mapper.go | Go | go | 10,675 | permissive | package ngin
import (
"bytes"
"errors"
"fmt"
"io"
"log"
"os"
"path/filepath"
"runtime"
"syscall"
)
const (
KB int = (1 << 10) // kilobyte
MB int = (1 << 20) // megabyte
PAGE int = 4 * KB // page size
EMPTY byte = 0xC1 // empty marker
)
type Mapper struct {
file *os.File // underlying file
data ... |
fcf5ba91da1a618f07e0618be9d460abecb1f1fc | 1c7da6826a092c04e2906a8b1eb27f5f71533f4b | notnoopci/minio | /vendor/github.com/minio/minio-go/api_functional_v2_test.go | Go | go | 22,677 | permissive | /*
* Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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
*
... |
c5bcd34092aebdd0c03bcf0a9117a3be1163c754 | 661012de53cf0af049208bcb3d64e1533c05ac28 | yang262/golang-samples | /kms/asymmetric_test.go | Go | go | 4,121 | permissive | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
33c881e267c157a4ee15051a803fa602099c0a4b | 9697c6c803e33b23e3ad65e5fb2378396184880c | Improwised/docker-phabulous | /phabulous/app/connectors/irc_message.go | Go | go | 1,284 | permissive | package connectors
import "github.com/fluffle/goirc/client"
// NewIRCMessage constructs a new instance of an IRCMessage.
func NewIRCMessage(line *client.Line, self string) *IRCMessage {
return &IRCMessage{line, self}
}
// IRCMessage is Phabulous's representation of an IRC message. This
// implementation is mainly a... |
717d77b584a6157d2369f8ca60c4d208a34de46c | d6d01863073e918925eb2ed913fee3ab7ab32760 | christat/search | /test/blind/depth_first_test.go | Go | go | 1,655 | permissive | package blind_test
import (
"testing"
"github.com/christat/dot"
"github.com/christat/search/blind"
tracer "github.com/christat/search"
)
func TestDepthFirst(t *testing.T) {
ok, graph := dot.ParseFile("../test_dot_files/simple_graph_test.dot", false)
if !ok {
t.Errorf("Failed to parse DFS test file")
}
verte... |
f40d037dba4dcbed87e29aae8373e421d4965f8a | f09862bf6db55fa71008656cbc53d885607a3fc3 | s-archer/k8s-bigip-ctlr | /pkg/appmanager/appManager.go | Go | go | 59,327 | permissive | /*-
* Copyright (c) 2016,2017, F5 Networks, 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 l... |
d16d8117948acf033598b185994160885b30cc7f | f9558a6492ca6abfc958c2d460b74590da8dd32a | ekara-platform/model | /generatedTComponent.go | Go | go | 2,665 | permissive | package model
//*****************************************************************************
//
// _ _ ____ _ _
// / \ _ _| |_ ___ / ___| ___ _ __ ___ _ __ __ _| |_ ___ __| |
// / _ \| | | | __/ _ \ | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \/ _` ... |
b7d7d289a0e7adf7f3067dc00b8d50d2e3cc28bb | 9db788f61fb0bd903b3705d488e0866d1c46f71a | Colstuwjx/chaos-mesh | /pkg/webhook/inject/command_test.go | Go | go | 6,555 | permissive | // Copyright 2020 Chaos Mesh 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... |
8e49dbf0b10429498acc7bb6541e5aa1c7e2cc69 | 816e91ccb064cae07c414584ffa0b2588a89ab37 | andrewstucki/jobs | /bolt/store.go | Go | go | 1,358 | no_license | package bolt
import (
"fmt"
"github.com/andrewstucki/jobs"
"github.com/boltdb/bolt"
)
func NewBoltStore(path string) (jobs.PersistentStore, error) {
db, err := bolt.Open(path, 0600, nil)
if err != nil {
return nil, err
}
db.Update(func(tx *bolt.Tx) error {
// if we can't create it, it means it exists
t... |
33d67773e6189f7f56e9ef74037169b33d952306 | 0f01513479b3ef64fcabb83fe5b7ee01037abf3a | iotaledger/wasp | /packages/vm/gas/feepolicy_test.go | Go | go | 1,560 | permissive | package gas
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/iotaledger/wasp/packages/util"
)
func TestFeePolicySerde(t *testing.T) {
feePolicy := DefaultFeePolicy()
feePolicyBin := feePolicy.Bytes()
feePolicyBack, err := FeePolicyFromBytes(feePolicyBin)
require.NoError(t, err)
require.E... |
c017ea22fda356c7db675c2ca47a4cd86292b672 | af41b6c5073379424a323e1d8dffe500b7ef0ee2 | yc146146/Golang_Tree | /AVL树/AVLTree.go | Go | go | 5,364 | no_license | package main
import (
"errors"
"fmt"
)
//适用于没有删除的情况
//红黑树的增删查改最优
type AVLnode struct {
//数据
Data interface{}
//左右指针
Left *AVLnode
Right *AVLnode
//高度
height int
}
//函数指针类型 对比大小
type comparator func(a, b interface{}) int
//函数指针
var compare comparator
//比较大小
func Max(a, b int) int {
if a >= b {
return a... |
c1ae5961b379bec89b5b39f1f23d671dc49fb938 | 14a9417b87f6fda7f31657f9ecfd54f0f0449e2d | freeformz/vertigo | /main.go | Go | go | 7,085 | permissive | package main
import (
"html/template"
"os"
"runtime"
"time"
. "github.com/9uuso/vertigo/databases/gorm"
. "github.com/9uuso/vertigo/misc"
. "github.com/9uuso/vertigo/routes"
. "github.com/9uuso/vertigo/settings"
"github.com/9uuso/timezone"
"github.com/go-martini/martini"
"github.com/martini-contrib/bindin... |
ed4bf61e8c1727626d43c8216293171b6868cea0 | 51c4165fb69ac0955af3e126439309a5568a1573 | donglaidongwang/istio | /pkg/kube/inject/inject.go | Go | go | 35,123 | 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... |
dd4ad2d0d77a25fccb43e582406535bb66fcd12a | 64dd634265cd3443b5e58f19d4398babf1cc6a60 | SocioProphet/cluster-operator | /pkg/v15/chartconfig/create.go | Go | go | 2,203 | permissive | package chartconfig
import (
"context"
"fmt"
"github.com/giantswarm/apiextensions/pkg/apis/core/v1alpha1"
"github.com/giantswarm/microerror"
apierrors "k8s.io/apimachinery/pkg/api/errors"
)
func (c *ChartConfig) ApplyCreateChange(ctx context.Context, clusterConfig ClusterConfig, chartConfigsToCreate []*v1alpha1... |
fbbece1cc5485a0ec5256658b35474a47e2f91b5 | 89ec9cb28e6d9ea427650958f72c086b69d8ea64 | adityagaikwad/antrea | /test/e2e/util.go | Go | go | 314 | permissive | package e2e
import (
"io"
"os"
)
// IsDirEmpty checks whether a directory is empty or not.
func IsDirEmpty(name string) (bool, error) {
f, err := os.Open(name)
if err != nil {
return false, err
}
defer f.Close()
_, err = f.Readdirnames(1)
if err == io.EOF {
return true, nil
}
return false, err
}
|
cbccad142519598e204cda2f13aefdb9587a0698 | 58de220a416411cb3b953cf35b2802a4dc64d125 | rafalpotempa/compass | /components/director/pkg/http/request/request_test.go | Go | go | 1,812 | permissive | package request_test
import (
"context"
"net/http"
"testing"
"github.com/kyma-incubator/compass/components/director/pkg/correlation"
"github.com/kyma-incubator/compass/components/director/pkg/http/request"
"github.com/stretchr/testify/assert"
)
func TestRequest_NewHttpRequest(t *testing.T) {
t.Run("when the c... |
6820fd4991cc738511f2d21cd3dd4f9310fe6245 | 2dbb0fd91c9819334b9df3b8dd59c698fd774334 | opencensus-integrations/mongo-go-driver | /core/session/client_session_test.go | Go | go | 6,010 | permissive | // Copyright (C) MongoDB, Inc. 2017-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 session
import (
"testing"
"github.com... |
076d0e9745b56c1efe6f085185da10789b8bc90c | 23c65791f0ecacbbbb7d9dd8afef69a915a34e5b | ravasconcelos/go_matrix_rest | /invert.go | Go | go | 657 | no_license | package main
import (
"fmt"
"strings"
)
// Invert is reponsible to invert the matrix and return the result as string
func Invert(records [][]string) string {
// create the new empty matrix
var matrixSize = len(records[0])
invertedMatrix := make([][]string, matrixSize)
for i := 0; i < matrixSize; i++ {
invert... |
e60d69e20bc19549b24c076eac0c018bb0a11ee3 | f220369c436ef279a15fcdeb2b6025cb33b49795 | 835127729/gojvm | /native/java/lang/Throwable.go | Go | go | 1,576 | permissive | package lang
import "fmt"
import "gojvm/native"
import "gojvm/rtda"
import "gojvm/rtda/heap"
const jlThrowable = "java/lang/Throwable"
type StackTraceElement struct {
fileName string
className string
methodName string
lineNumber int
}
func (self *StackTraceElement) String() string {
return fmt.Sprintf("%s.%... |
b514555e2376286b45fd553b5e9fb7fb518885fe | d3bec607b50676feb5997929a85077120ced1ef8 | yuriy-babenko/irs | /pkg/client/model_b_record_with1099_patr.go | Go | go | 3,359 | permissive | /*
* IRS API
*
* Package github.com/moov-io/irs implements a file reader and writer written in Go along with a HTTP API and CLI for creating, parsing, validating, and transforming IRS electronic Filing Information Returns Electronically (FIRE). FIRE operates on a byte(ASCII) level making it difficult to interface wi... |
92324f43af0d420eeece85dbf6d4b94318fcc697 | b577de67084b111204d90bf7f44175214a6f044e | nxgtw/caddy | /caddyhttp/httpserver/plugin.go | Go | go | 22,808 | permissive | // Copyright 2015 Light Code Labs, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
185d1da5aae28694ab04e142bc255348fbf6facc | 26c5ff729ad5a8514ba4ae954723fcf4efda5a5a | mblink/drone | /remote/gitlab3/gitlab_test.go | Go | go | 7,536 | permissive | // Copyright 2018 Drone.IO 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 ... |
9716092b0d1493b7a0f7ea1b1d4d21865abde5ca | b0b70a1e1de5c9ff2e4f0108492c8d2843053208 | ibrokethecloud/lb-controller | /controller/rancher/rancher.go | Go | go | 14,867 | permissive | package rancher
import (
"fmt"
"github.com/Sirupsen/logrus"
"github.com/rancher/go-rancher-metadata/metadata"
"github.com/rancher/go-rancher/v2"
"github.com/rancher/lb-controller/config"
"github.com/rancher/lb-controller/controller"
"github.com/rancher/lb-controller/provider"
utils "github.com/rancher/lb-contr... |
f8ca7420b6bddc649577a2d75d096d96b4ba4dd2 | 846c4e45d85fbb6c62e92b497b8b8a3ff617c9e6 | orionbetasp/g2 | /example/client/client.go | Go | go | 1,742 | permissive | package main
import (
"log"
"os"
"sync"
"github.com/appscode/g2/client"
rt "github.com/appscode/g2/pkg/runtime"
)
func main() {
// Set the autoinc id generator
// You can write your own id generator
// by implementing IdGenerator interface.
// client.IdGen = client.NewAutoIncId()
c, err := client.New(rt.N... |
0aa7fc3e6abe5b56ad4c2a2b276fd776c68c46ef | 0c03aad12b0cf00cc6c3e1be55b1b4f24d5ad807 | golang-design/under-the-hood | /gosrc/cmd/compile/internal/gc/const.go | Go | go | 27,866 | permissive | // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gc
import (
"cmd/compile/internal/types"
"cmd/internal/src"
"fmt"
"math/big"
"strings"
)
// Ctype describes the constant kind of an "ideal" (unty... |
72b2911aa32f4b023792abe3eec519691b70897d | 98a514a5aa6c64102f98d00477d1761852385d17 | keybase/client | /go/kbfs/libdokan/common.go | Go | go | 5,056 | permissive | // Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
package libdokan
import (
"strings"
"time"
"github.com/keybase/client/go/kbfs/data"
"github.com/keybase/client/go/kbfs/dokan"
"github.com/keybase/client/go/kbfs/i... |
08a7e31bf785a75dfbc524811e479c4a0a1f67e5 | ca67ab7cb98f4bca57e8a14e8dbadefb729caa67 | antmoveh/myredis | /pkg/redis/reply/asserts/assert.go | Go | go | 1,380 | no_license | package asserts
import (
"fmt"
"myredis/pkg/redis/reply"
"myredis/pkg/types/data/utils"
"myredis/pkg/types/scheme"
"testing"
)
func AssertIntReply(t *testing.T, actual scheme.Reply, expected int) {
intResult, ok := actual.(*reply.IntReply)
if !ok {
t.Error(fmt.Sprintf("expected int reply, actually %s", actua... |
1e587818c2d5bcbacd64f9e8ce72b62e94780296 | 542d046d22f460c14f4e2a84822015f71062d532 | pmuetschard/bazel-gazelle | /internal/language/proto/resolve_test.go | Go | go | 4,194 | permissive | /* Copyright 2018 The Bazel 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 ... |
81f2fc2a80a9d76a470134b1728c9020f9b0250b | ee5936009101a981b1049d05f3402cfde0fbfb4a | csrgxtu/gf | /encoding/gjson/gjson_z_unit_basic_test.go | Go | go | 12,603 | permissive | // Copyright 2017 gf Author(https://github.com/csrgxtu/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/csrgxtu/gf.
package gjson_test
import (
"github.com/csrgxtu/... |
71eb5e3050c722ed2e377d59694fb3ba155e1629 | adc2406e549b1be6c9a2ae77fce042da9790c36e | sourcegraph/src-cli | /internal/batches/executor/main_test.go | Go | go | 1,096 | permissive | package executor
import (
batcheslib "github.com/sourcegraph/sourcegraph/lib/batches"
"github.com/sourcegraph/sourcegraph/lib/batches/overridable"
"github.com/sourcegraph/src-cli/internal/batches/graphql"
)
var testRepo1 = &graphql.Repository{
ID: "src-cli",
Name: "github.com/sourcegraph/src... |
d7a622264d2460e2e8071471b05b7697fe7836fc | 1900349fd9e52c712bf4d0a2a78f6790c1a953e8 | andmorefine/buddha | /_vendor-20190311020953/goa.design/goa/codegen/service/endpoint.go | Go | go | 10,135 | permissive | package service
import (
"fmt"
"path/filepath"
"strings"
"goa.design/goa/codegen"
"goa.design/goa/expr"
)
type (
// endpointsData contains the data necessary to render the
// service endpoints struct template.
endpointsData struct {
// Name is the service name.
Name string
// Description is the service... |
b40b1f227aa8119d3cbf5c8868a2b82ae91494e3 | 9353d479bc562e0c8a1da93ead4a1876a2bbbdb1 | andreidenissov-cog/studio-go-runner | /vendor/github.com/leaf-ai/go-service/pkg/server/guages.go | Go | go | 2,572 | permissive | // Copyright 2018-2021 (c) The Go Service Components authors. All rights reserved. Issued under the Apache 2.0 License.
package server // import "github.com/leaf-ai/go-service/pkg/server"
import (
"fmt"
"os"
"github.com/leaf-ai/go-service/pkg/network"
"github.com/dustin/go-humanize"
"github.com/go-stack/stack"... |
58f2508b8f7b46bfc759c7b60eda6135d50c5aec | 1109a8e7d9e114f39201120a3cadb49140f5c631 | Naman-Singla777/training | /main.go | Go | go | 253 | permissive | package main
import (
"fmt"
"net/http"
)
func main() {
println("server started...")
http.HandleFunc("/", HelloWorld)
http.ListenAndServe(":8080", nil)
}
func HelloWorld(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello World")
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.