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 |
|---|---|---|---|---|---|---|---|---|
a24fe55805b248e032d7470a779e161748224ba0 | c938c3c6176981777182795f9f709441c667d5bb | chenk008/ghw | /block.go | Go | go | 7,022 | permissive | //
// Use and distribution licensed under the Apache license version 2.
//
// See the COPYING file in the root project directory for full text.
//
package ghw
import (
"fmt"
"math"
"strings"
)
// DriveType describes the general category of drive device
type DriveType int
const (
DRIVE_TYPE_UNKNOWN DriveType = i... |
fa95fb19b05fb15c8d30d61b2879f3efaa9d028d | 6a32ac1761dced8b1bd363dcaeff2b62d17a9698 | opentelekomcloud/gophertelekomcloud | /openstack/dcaas/v2/direct-connect/Update.go | Go | go | 990 | permissive | package direct_connect
import (
golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
)
type UpdateOpts struct {
// description of the direct connect
Description string `json:"description,omitempty"`
// name of the direct connect
Name string `... |
6b930f4b90c449ccd6fec396419c95f67c9fcf47 | 2149b461a4f253ffca21f1f64db7aaeb76da5317 | brianmafu/audrop_api_go | /models/user.go | Go | go | 365 | no_license | package models
import (
"gopkg.in/mgo.v2/bson"
"time"
)
// User
type User struct {
ID bson.ObjectId `bson:"_id"`
MSISDN string `json:"msisdn"`
Name string `json:"name"`
Surname string `json:"surname"`
Email string `json:"email"`
Created time.Time `json:"created"`
Modified time.Time `json:"modified"`
}
// U... |
6ecd126bcb971936f26bb49939aa4c8ac64f6d6f | e287950b955f7f65d500653543deb1f4b94ecc5c | psaab/docker-sriov-plugin | /driver/dualport_sriov.go | Go | go | 5,653 | permissive | package driver
import (
"fmt"
"github.com/docker/go-plugins-helpers/network"
"log"
"strconv"
)
type dpSriovNetwork struct {
genNw *genericNetwork
vlan int
privileged int
}
type dpPfDevice struct {
childNetdevLlist []string
maxChildDev int
state string
nwUseRefCount int
}
// ... |
60c04e96b1692d5d2ead33bffff87d59f8958853 | e9935b4e70d2a9301555b19d848fdbe7bf683227 | annanay25/opencensus-service | /receiver/opencensus/opencensus_test.go | Go | go | 4,362 | permissive | // Copyright 2018, OpenCensus 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... |
7489c62a066a84cfac073c8dd3afd194ad22291f | d8d10d1a08e684479572b2f96df16f5e85c45216 | siman-man/golang-sandbox | /protobuf_app/main.go | Go | go | 978 | no_license | package main
import (
pb "github.com/siman-man/golang-sandbox/protobuf_app/addressbook"
"github.com/golang/protobuf/proto"
"log"
"io/ioutil"
"fmt"
)
const FNAME = "person.pb"
func main() {
encodePerson()
person := decodePerson()
fmt.Printf("person id = %d\n", person.Id)
}
func encodePerson() {
p := &pb.Pe... |
b1b56eb7b12035800f4b024f83d20ff8a0fbe908 | d9316f1203374f4155b9048cbb830cb3ac701d6a | RobertTheProfessional/haproxy-ingress | /pkg/converters/ingress/types/annotations.go | Go | go | 5,398 | permissive | /*
Copyright 2019 The HAProxy Ingress Controller 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... |
5209fe82d97a2999edc9a81aded7ecd677978a08 | 4cfc6d67ad7a9150d920cb303f61240e58ee5d13 | cipherbin/cipher-bin-cli | /cmd/root.go | Go | go | 3,001 | permissive | package cmd
import (
"fmt"
"net/http"
"os"
"time"
"github.com/cipherbin/cipher-bin-cli/pkg/api"
"github.com/spf13/cobra"
)
// Version constant that represents the current build version
const Version = "v.0.5.2"
// Email will be hydrated with it's value if a user runs the create cmd with the
// flag --email (o... |
79d3055421b20397fc210db5d513b555595e5448 | 2edbde0e9b1e8618613e09240502c1cce620fbc3 | ItsMurumba/rest-api-go-mysql | /main.go | Go | go | 2,992 | no_license | package main
import (
"database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
_"github.com/go-sql-driver/mysql"
"github.com/gorilla/mux"
)
// Post struct definition
type Post struct{
ID string `json:"id"`
Title string `json:"title"`
}
var db *sql.DB
var err error
func main() {
db, err = sql.Open("mys... |
e497f914b8514fbdba67336eabb72dc7125938c4 | 5691f50427bc7e6c8caaf324beb15491be34d6c5 | arctiqgreg/kuma | /app/kumactl/pkg/install/k8s/kuma-cni/templates_vfsdata_test.go | Go | go | 1,146 | permissive | // +build !dev
package kumacni_test
import (
"io/ioutil"
"path/filepath"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
kumacni "github.com/kumahq/kuma/app/kumactl/pkg/install/k8s/kuma-cni"
"github.com/kumahq/kuma/pkg/test/vfsgen"
)
var _ = Describe("Templa... |
d397ce36fbc64e1541e0577bf509dca9faa09679 | 291ee3652d3ec84799a921fb8496a07259fe35c8 | pion/rtcp | /raw_packet.go | Go | go | 1,025 | permissive | // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
package rtcp
import "fmt"
// RawPacket represents an unparsed RTCP packet. It's returned by Unmarshal when
// a packet with an unknown type is encountered.
type RawPacket []byte
// Marshal encodes the packet in bina... |
be8d64ddffcb5cc979dbf4c3ae261a83cb0d638e | 66ddc1825787449e310c1adea4c6efc11b3c51c0 | gagliardetto/golang-go | /cmd/compile/internal/ssa/gen/AMD64Ops.go | Go | go | 72,540 | permissive | // Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import "strings"
// Notes:
// - Integer types live in the low portion of registers. Upper portions are junk.
// - Boolean typ... |
6cb0a347f6655e22085d793a430504fad447ea77 | 662b44143bff89ecbf8b126fd9954a8cfdb1601f | stsully/oci-go-sdk | /applicationmigration/soacs_discovery_details.go | Go | go | 2,035 | permissive | // Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
f96401628f3cfb5fedb4535cac8776a3ae5352bb | 8efaec21b24b2ad8ec3b67d9b55b3acb3c2aea69 | johscheuer/openstack-exporter | /exporters/ironic.go | Go | go | 1,438 | permissive | package exporters
import (
"strconv"
"github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes"
"github.com/prometheus/client_golang/prometheus"
)
// IronicExporter : extends BaseOpenStackExporter
type IronicExporter struct {
BaseOpenStackExporter
}
var defaultIronicMetrics = []Metric{
{Name: "node", La... |
a8cf22c91f8b1fbf373e6754e866b044f52e2234 | c1870a9fac2229590617d960ecc00cd78b4fff95 | MZ195/GO-Remote-Access-Tool | /06_malware/malware_server/core/move/mv.go | Go | go | 811 | no_license | package move
import (
"bufio"
"fmt"
"net"
"os"
"strings"
)
func Navigate_file_system(connection net.Conn) (err error) {
connection_reader := bufio.NewReader(connection)
initial_pwd_raw, err := connection_reader.ReadString('\n')
initial_pwd := strings.TrimSuffix(initial_pwd_raw, "\n")
loopControl := true
f... |
487c4c322fb3d3d7c0b5ba48286c8a56d402a30e | 1b7409ea61cbeced16d3d29fbf36031d48b9c589 | AlexVagrant/gmc | /start.go | Go | go | 740 | no_license | package gmc
import (
"log"
"net/http"
"os"
"os/signal"
"time"
)
type Mux struct {
ServerMux *http.ServeMux
app *http.Server
}
func (m Mux) quit() {
quit := make(chan os.Signal)
signal.Notify(quit, os.Interrupt)
go func() {
<-quit
// 接受退出通知
if err := m.app.Close(); err != nil {
log.Fatal("Close se... |
e523565b32df9105c17d8a7e821bca3238d3d656 | c1fc9c32bbab0a50d3ea9f29721a1f4cce71ba63 | indigos33k3r/control | /pkg/workflows/steps/amazon/create_load_balancer.go | Go | go | 4,988 | permissive | package amazon
import (
"context"
"io"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/elb"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/supergiant/control/pkg/workflows/steps"
"github.com/supergiant/control/pkg/util"
)
const St... |
201d53217862f660db749250bb17621e0ce100fb | 90d40cecac86ca5bd45b71b7b522d8bfa4670c07 | naturezhm/makisu | /lib/parser/dockerfile/add.go | Go | go | 1,264 | permissive | // Copyright (c) 2018 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law... |
eff9262e9f1d39bc79faeb1b7ec3e068e6582bcb | c3a326dd49450b3c0039d1d48b172716390c448a | pharmer/pharmer | /vendor/github.com/onsi/gomega/matchers.go | Go | go | 17,700 | permissive | package gomega
import (
"time"
"github.com/onsi/gomega/matchers"
"github.com/onsi/gomega/types"
)
//Equal uses reflect.DeepEqual to compare actual with expected. Equal is strict about
//types when performing comparisons.
//It is an error for both actual and expected to be nil. Use BeNil() instead.
func Equal(ex... |
be3e9bd2e458d8dea5cd9cc16d9b1de438ba5089 | adad82bf79cb558084de14cf4481a35899a0b33f | liuleo60/Fuse-Distributed-File-System | /src/triblab/client.go | Go | go | 301 | no_license | package triblab
import (
"trib"
)
// client constructor
/*func NewClient(addr string) trib.Storage {
panic("TODO")
}
*/
// bin client constructor
func NewBinClient(backs []string) trib.BinStorage {
rClient := &ReplicaBinClient{backs, make(map[string]bool)}
rClient.FindChord()
return rClient
}
|
51973bb6443500443711418c03414df5ed9f86c4 | ccab3abf2b58e92821c4b684d48348509dafcec2 | elitecodegroovy/gnetwork | /apps/micro/rpc3/user-web/main.go | Go | go | 1,845 | no_license | package main
import (
"fmt"
"github.com/elitecodegroovy/gnetwork/apps/micro/rpc3/basic"
"github.com/elitecodegroovy/gnetwork/apps/micro/rpc3/basic/common"
"github.com/elitecodegroovy/gnetwork/apps/micro/rpc3/basic/config"
"github.com/elitecodegroovy/gnetwork/apps/micro/rpc3/user-web/handler"
"github.com/micro/c... |
688d5f91ed6ece1815df4e4775b5d21bd92dad25 | 260d5148218b13809374a254cc67b19e85102989 | eswaribala/amexws | /banking/dao/customerdao.go | Go | go | 1,742 | no_license | package dao
import (
"fmt"
"github.com/amexws/banking/models"
"math/rand"
"strconv"
)
/*
type Address struct {
door_no string
street string
city string
state string
}
func CreateCustomers() {
customerList := map[int64]struct {
name string
email string
address Address
}{
rand.Int63n(1000... |
95e64be297c25714f83ae6b48377ccb74a8804a6 | 038ac6a341cd1e84eae45d107118940fa7c78804 | Thunder33345/dragonfly | /server/session/handler_modal_form_response.go | Go | go | 1,075 | permissive | package session
import (
"bytes"
"fmt"
"github.com/df-mc/dragonfly/server/player/form"
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
"go.uber.org/atomic"
"sync"
)
// ModalFormResponseHandler handles the ModalFormResponse packet.
type ModalFormResponseHandler struct {
mu sync.Mutex
forms ... |
d1f1d05d1679621b807c8c03607792c1a5d9201a | 70f428a197920bda223a7bfbd1c86d9527676a8b | alxarch/ksonnet | /pkg/actions/import.go | Go | go | 6,639 | permissive | // Copyright 2018 The ksonnet authors
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
b9a5798ee1e239e35545681549b56823dfe1dd3d | 37e267e154c9e551273ef004ba863eb71046424a | dustinspecker/kpt-remove-resource | /main.go | Go | go | 1,400 | permissive | package main
import (
"fmt"
"io"
"os"
"sigs.k8s.io/kustomize/kyaml/kio"
"sigs.k8s.io/kustomize/kyaml/yaml"
)
func main() {
if err := RunPipeline(os.Stdin, os.Stdout); err != nil {
fmt.Fprint(os.Stderr, err)
os.Exit(1)
}
}
func RunPipeline(reader io.Reader, writer io.Writer) error {
readWriter := &kio.By... |
d7f9c6c5a81c7b4062178082f795decd719ca4af | 19fcf7158136c58dc8a584f44668279e376a69bb | tuotuobukaixin/demo | /third_party/src/scheduler/algorithm/dynamic_loadblance_algorithm.go | Go | go | 7,852 | no_license | package algorithm
import (
"container/list"
"fmt"
"sort"
"time"
)
const (
nMax = 30
nnMax = 900
nResource = 10
cnResource = 2
)
var nApps int
var nClusters int
var maxCluster int
type nodeType struct {
cLoad [nMax][nResource]float32
uLoad [nMax][nResource]float32
rules [n... |
81645a4360a3fb61daa385a5a1b72f766157f945 | 881568bcc6f8ef6dedc1e8ad2ba80c19c75c47a1 | grant-unwin/bigcommerce-api-go | /client.go | Go | go | 2,757 | permissive | package bigcommerce
import (
"fmt"
"io"
"io/ioutil"
"net/http"
)
// App represents basic app settings
type App struct {
StoreHash string
ClientID string
AccessToken string
}
// Client is a collection of services that interacts with the BigCommerce API.
type Client struct {
app App
HTTPClient htt... |
bb8235e370f9d482059bf56ede710f1e48752a8e | 84b8b1ddff96af94a8df31532f3c1ea360e08058 | cloud-barista/cb-spider | /cloud-control-manager/iid-manager/IIDManager.go | Go | go | 14,791 | permissive | // IID(Integrated ID) Manager of CB-Spider.
// The CB-Spider is a sub-Framework of the Cloud-Barista Multi-Cloud Project.
// The CB-Spider Mission is to connect all the clouds with a single interface.
//
// * Cloud-Barista: https://github.com/cloud-barista
//
// by CB-Spider Team, 2020.03.
package iidmanager
imp... |
18abee5db1acd682f710c2c9307470b0be89603b | b4d88e18759e8912f2a0e329f7d633f7d7ee4b76 | KnightOfNight/sudoku-v2 | /src/sudoku.go | Go | go | 4,879 | no_license | package main
import (
"fmt"
"time"
"os"
"strings"
"io/ioutil"
"strconv"
)
const SIZE = 9
const UNIT = SIZE / 3
const TOTAL_SIZE = SIZE * SIZE
const UNASSIGNED = 0
func in_row(grid [][]int, r int, num int) bool {
for c,_ := range grid[r] {
if grid[r][c] == num {
return ... |
aabcdc6a847038cb6ad5e6405dafc193b8037711 | 38ffa9e480637b8d3bbce025c243a0a94d91c72c | gfanton/go-ipfs-log | /utils/lamportclock/lamportclock.go | Go | go | 1,839 | no_license | package lamportclock // import "berty.tech/go-ipfs-log/utils/lamportclock"
import (
"bytes"
"encoding/hex"
"math"
cbornode "github.com/ipfs/go-ipld-cbor"
"github.com/polydawn/refmt/obj/atlas"
)
type LamportClock struct {
ID []byte
Time int
}
func (l *LamportClock) Tick() *LamportClock {
l.Time++
return ... |
acbf5094acfb848ed7b6299cfeac5c226ea78e38 | 694de13b4deb48ba2ccead868090db8c17786d3d | astraw99/etcd | /tests/e2e/v3_cipher_suite_test.go | Go | go | 2,325 | 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... |
d58d79d5ef54254fef36a41d164db0b91b16d68e | 9ea9f299e1af480dbba785138dabcbe1c73c6a99 | mmaker/otot | /encodings/netstring.go | Go | go | 922 | no_license | package encodings
import (
"bufio"
"fmt"
"io"
)
func isMarshal(data []byte) (off int, total int) {
var i int
for i = range data {
if data[i] == ':' {
break
}
}
_, err := fmt.Sscanf(string(data[:i]), "%X", &total)
off = i + 1
total += off
if total <= len(data) && err == nil {
return
} else {
ret... |
11a64242daaa0cd4f71e2ae323bd0deca106c5aa | 361e257a8ec544620071b01c61d5ec4a44139dd4 | dineshbhoopathy/GoGonicBlogApi | /controllers/likes.go | Go | go | 4,606 | no_license | package controllers
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/melardev/GoGonicBlogApi/dtos"
"github.com/melardev/GoGonicBlogApi/infrastructure"
"github.com/melardev/GoGonicBlogApi/middlewares"
"github.com/melardev/GoGonicBlogApi/models"
"github.com/melardev/GoGonicBlogApi/services"
"net/http"
"str... |
a34d088eef5079db0f710fa06d94f7ab32e24966 | 96dd99302d083e149061020df26630465b4e0b53 | douyu/jupiter | /pkg/core/autoproc/autoproc.go | Go | go | 1,299 | permissive | // Copyright 2021 rex lv
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
e9059b0d512752d2034e9a26381f8f10bd3341f4 | 68f51f66e145bc2b5fba802ceb5bc4eeb4aaa4f0 | zhlhahaha/bazeldnf | /pkg/repo/fetch.go | Go | go | 6,051 | no_license | package repo
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"hash"
"io"
"net/http"
"net/url"
"path"
"path/filepath"
"strings"
"github.com/rmohr/bazeldnf/pkg/api"
"github.com/rmohr/bazeldnf/pkg/api/bazeldnf"
log "github.com/sirupsen/logrus"
)
type RepoFetcher interface {
Fetch() error
}
type RepoFetcher... |
552fffa7781a99840833febf686ddc91d2aa3447 | 4b1dea492629147154dd321636da6649c0571e48 | ChandraStation/akash | /provider/cluster/reservation.go | Go | go | 702 | permissive | package cluster
import (
ctypes "github.com/ovrclk/akash/provider/cluster/types"
atypes "github.com/ovrclk/akash/types/v1beta2"
mtypes "github.com/ovrclk/akash/x/market/types/v1beta2"
)
func newReservation(order mtypes.OrderID, resources atypes.ResourceGroup) *reservation {
return &reservation{order: order, resou... |
1b3d3e4e456406e31d889855afbe37cbde4214dc | 10c626ab26f8581cf1f00c09a0b63423a67cdcab | prebid/openrtb | /openrtb2/publisher.go | Go | go | 1,525 | permissive | package openrtb2
import (
"encoding/json"
"github.com/prebid/openrtb/v20/adcom1"
)
// 3.2.15 Object: Publisher
//
// This object describes the publisher of the media in which the ad will be displayed.
// The publisher is typically the seller in an OpenRTB transaction.
type Publisher struct {
// Attribute:
// ... |
8d0b4b39050fa5ee27f90d89cd0190e8c5edb4fd | 673cee2d3dc6e60fb4734581f269b68488ad504f | sjatsh/tidb | /server/driver_tidb.go | Go | go | 10,208 | permissive | // Copyright 2015 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... |
47e0ae77fb202e13ffb970fd6a73391a98445f86 | a4a05016e92e01dc03722aafceb69e03e594254e | threefoldfoundation/tfchain | /vendor/github.com/ethereum/go-ethereum/cmd/devp2p/nodeset.go | Go | go | 2,251 | permissive | // Copyright 2019 The go-ethereum Authors
// This file is part of go-ethereum.
//
// go-ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... |
6f18d706d291f33e3a6905d223b28fe8d22d3306 | 63463d7f8437e064cf94dccb2cf0671287ca72dd | kentquirk/little-free-library | /pkg/date/date.go | Go | go | 3,705 | permissive | package date
import (
"encoding/json"
"fmt"
"regexp"
"strconv"
"time"
)
// Date represents a date without time information; it may represent only a year
// (month and day may be zero, comparisons work correctly in this case).
type Date struct {
Year int
Month int
Day int
}
// Build creates a Date from yea... |
a6033c2b7598870845ae0c5608bd9b3a65d2bf96 | 72e0aaefbb775eddf433202c8dea2c7adcb0e4c4 | karmab/kubevirt | /tests/network/vmi_passt.go | Go | go | 11,279 | permissive | /*
* This file is part of the kubevirt project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
12088647f310b775504cf264e7652168f71e2c86 | 5cb2e528acd9fb1c64b441495d0aaa8e27c9c755 | bpkgoud/pulumi-azure-native | /sdk/go/azure/insights/v20210501preview/getAutoscaleSetting.go | Go | go | 1,656 | permissive |
package v20210501preview
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupAutoscaleSetting(ctx *pulumi.Context, args *LookupAutoscaleSettingArgs, opts ...pulumi.InvokeOption) (*LookupAutoscaleSettingResult, error) {
var rv LookupAutoscaleSettingResult
err := ctx.Invoke("azure-native:insights/v2... |
65101a4b110273f1dddd102cedb51f651209c386 | 06495d816f682b45f02528fbd9bd2006bd56124f | ambrisko/fiano | /pkg/visitors/insert.go | Go | go | 5,927 | permissive | // Copyright 2018 the LinuxBoot 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 visitors
import (
"errors"
"fmt"
"io/ioutil"
"github.com/linuxboot/fiano/pkg/uefi"
)
// InsertType defines the insert type operation that i... |
4565ebde6219ded2bf4305cebde05dbb76c254f6 | c2a4006540c19ee4c39ec85bdb6a033ebb659e16 | irr/go-labs | /http/post-json-file.go | Go | go | 504 | permissive | package main
import (
"bufio"
"fmt"
"log"
"net/http"
"os"
)
func main() {
inFile, err := os.Open("test.json")
if err != nil {
log.Fatal(err)
}
defer inFile.Close()
client := &http.Client{}
req, err := http.NewRequest("POST", "http://localhost:8082/test", bufio.NewReader(inFile))
if err != nil {
log.Fa... |
c6eeca005ee2894786735485133bdbb499fda749 | c920e8a6e7e32dcba6084597b748d0a2a527d6e9 | Matts966/nilarg | /testdata/src/a/a.go | Go | go | 1,887 | no_license | package a // want package:"&{}"
import "bytes"
type X struct{ f, g int }
func f(i int, ip *int, x X, xp *X) { // want f:"&map\\[1:{} 3:{}\\]"
print(i, *ip /* can be nil dereference */, x, *xp /* can be nil dereference */)
}
func f2(x *int, ptr *[3]int, i interface{}, m map[int]int) { // want f2:"&map\\[0:{} 1:{} 2... |
107880e2932ff9293b66483fd5421fe9acf65518 | 87220c5e9055d1a8b274cc67c8d63464b536d574 | noragalvin/dl-basic | /practice/cnn/cnn.go | Go | go | 1,565 | no_license | package main
import (
"fmt"
"log"
)
func main() {
X := [][]float64{}
X = append(X, []float64{float64(1), float64(1), float64(1), float64(0), float64(0)})
X = append(X, []float64{float64(0), float64(1), float64(1), float64(1), float64(0)})
X = append(X, []float64{float64(0), float64(0), float64(1), float64(1), f... |
ea663224eaf89b6364a814de69c5d441e668d15d | e052eead6bd7846f13d9a3d5c0d74747ec62237c | evepraisal/go-evepraisal | /appraisal_id.go | Go | go | 463 | permissive | package evepraisal
import "github.com/martinlindhe/base36"
// AppraisalIDToUint64 returns a Uint64 appraisal ID for the given string version appraisalID.
// This is used to make nicer/smaller appraisal IDs
func AppraisalIDToUint64(appraisalID string) uint64 {
return base36.Decode(appraisalID)
}
// Uint64ToAppraisal... |
f7da9e9b627668f25c9e43d98fd8080a769d6e60 | becfc2189b4c338559f992d5873e14267da2557f | behouba/web_scapper_project | /models/stores/pdastoreci.go | Go | go | 1,885 | permissive | package models
import (
"fmt"
"log"
"net/url"
"github.com/PuerkitoBio/goquery"
)
const (
pdastoreciURLFormat = "http://shop.pdastoreci.com/epages/265339.sf/fr_FR/?ViewAction=FacetedSearchProducts&ObjectID=524324&PageSize=30&SearchString=%s&Page=%d"
)
// AllFromPdastoreci search for all article
// related to a ... |
12227f4e831b20e5f219b00ccc6e2e67dc86148f | 0271b13495f8c2cc7bf4aec3fe4c9505b346b2a5 | ivch/ipninja-test | /time.go | Go | go | 843 | no_license | package main
import (
"database/sql/driver"
"strings"
"time"
)
// Time type for json time parsing
type Time struct {
time.Time
}
// UnmarshalJSON unmarshal my time from json, layout: 1504 (Hi)
func (ct *Time) UnmarshalJSON(b []byte) (err error) {
ct.Time, err = time.Parse(`"2006-01-02 15:04:05"`, string(b))
i... |
376f0e535ff3cb6d9719598a05705af531f4f5a6 | 0d2898c632d2954b106740e1cbda4e4e46f61168 | bistuzx/onecloud | /pkg/apis/monitor/alertpanel.go | Go | go | 655 | permissive | package monitor
import "yunion.io/x/onecloud/pkg/apis"
type AlertPanelCreateInput struct {
apis.ScopedResourceInput
apis.ProjectizedResourceListInput
CommonMetricInputQuery
AlertCreateInput
Refresh string `json:"refresh"`
DashboardId string `json:"dashboard_id"`
}
type AlertPanelListInput struct {
Alert... |
955ac112403d9d10bad0c9d54ec420da0c0d4ece | a09c541c6577d2e9c433372e4f267ed8ede49e81 | wuzhl2018/AnnotatedVersion | /TarsGo/tars/panic.go | Go | go | 383 | permissive | package tars
import (
"fmt"
"os"
"path/filepath"
"runtime/debug"
"time"
)
func checkPanic() {
if r := recover(); r != nil {
path, _ := filepath.Abs(filepath.Dir(os.Args[0]))
os.Chdir(path)
file, _ := os.Create(fmt.Sprintf("panic.%s", time.Now().Format("20060102-150405")))
file.WriteString... |
8325f6047b71b50694f9123c0ea56055fa415077 | d6e9e27a06b58f8bbbd427b2a9cafa7ceb303136 | redspread/localkube | /vendor/github.com/google/cadvisor/fs/fs.go | Go | go | 15,425 | permissive | // Copyright 2014 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
4353bcd1b8b569666a59842decbd62870d857faf | 99917cd5f140641ad847e38f104ad37f464cfabc | huangnauh/learngo | /test_07/test_nil.go | Go | go | 347 | no_license | package main
import (
"bytes"
"io"
)
const debug = false
func main() {
var buf *bytes.Buffer
//var buf io.Writer
if debug {
buf = new(bytes.Buffer)
}
f(buf)
}
func f(out io.Writer) {
//debug 为 false 时 out 的 动态类型 不为 nil 而是 *bytes.Buffer,所以 out 不为 nil
if out != nil {
out.Write([]byte("done!\n"))
}
}
|
947bc487c525de0d0ff7c67e47c052a461315df0 | e8803fa35fbe3ade4048acd05d8abfa6a554b4ac | thel5coder/appointment | /server/bootstrap/routers/file_routes.go | Go | go | 550 | no_license | package routers
import (
"github.com/gofiber/fiber/v2"
"profira-backend/server/handlers"
"profira-backend/server/middleware"
)
type FileRoutes struct {
RouteGroup fiber.Router
Handler handlers.Handler
}
func (route FileRoutes) RegisterRoute() {
handler := handlers.FileHandler{Handler: route.Handler}
jwtMid... |
38eedd5c9864bc745f3b37dad5be81f0a764591a | 36d40b5af25463a7c693e7a9b641119c867f4824 | spacemeshos/go-spacemesh | /tortoise/model/hare.go | Go | go | 765 | permissive | package model
import (
"math/rand"
"github.com/spacemeshos/go-spacemesh/common/types"
)
func newHare(rng *rand.Rand) *hare {
return &hare{rng: rng}
}
// hare is an instance of the hare consensus.
// At the end of each layer it outputs input vector and coinflip events.
type hare struct {
rng *rand.Rand
}
// OnM... |
d2569016ba7206f1ce85a47986c840dbc6f72984 | adaca76a62c09724f597f6d2ad40175ec1a12ff7 | huilinux/htgolang-20200919 | /course/day07-20201107/codes/scope/main.go | Go | go | 259 | no_license | package main
import (
"fmt"
"scope/pkg"
)
type EmailSender struct {
}
func (s *EmailSender) send(msg string) error {
fmt.Println("msg", msg)
return nil
}
func main() {
// var sender pkg.Sender = new(EmailSender)
// fmt.Println(sender)
pkg.Test()
}
|
9e80b206902bbab0979059d45d2b30e7914a503e | 71ea4617a92b9b7b0715d4c0794fe2c7693f81ed | uk-gov-mirror/ONSdigital.dp-frontend-search-controller | /routes/routes.go | Go | go | 894 | permissive | package routes
import (
"context"
"github.com/ONSdigital/dp-api-clients-go/renderer"
search "github.com/ONSdigital/dp-api-clients-go/site-search"
"github.com/ONSdigital/dp-frontend-search-controller/config"
"github.com/ONSdigital/dp-frontend-search-controller/handlers"
health "github.com/ONSdigital/dp-healthch... |
a7aee5c4e38511eb1b3c53f36ffc64ae410c8fc5 | b69770ce43785560d53f3c1e2f3020fa9b594774 | mewspring/l-tm | /asm/type.go | Go | go | 16,766 | no_license | package asm
import (
"fmt"
"sort"
"strconv"
"strings"
"github.com/llir/l/ir/types"
"github.com/mewmew/l-tm/asm/ll/ast"
"github.com/mewmew/l-tm/internal/enc"
"github.com/pkg/errors"
)
// resolveTypeDefs resolves the type definitions of the given module. The
// returned value maps from type name (without '%' p... |
d42612a0c470ddec0c167ebe64e7b2c954300c91 | e6d0fbd2f897bf45a64bef09b485f24714fe6266 | gaybro8777/optisam-backend | /license-service/pkg/service/v1/metric_oracle_nup.go | Go | go | 4,032 | permissive | // Copyright (C) 2019 Orange
//
// This software is distributed under the terms and conditions of the 'Apache License 2.0'
// license which can be found in the file 'License.txt' in this package distribution
// or at 'http://www.apache.org/licenses/LICENSE-2.0'.
package v1
import (
"context"
"fmt"
"optisam-back... |
fafa7789c761959cb9ac8c1ecb30eb9d73c97a86 | f243e06dcaf5309556670cb9cd1f271172017540 | knsnisa/Investree-Internship | /routes/handle.go | Go | go | 909 | permissive | package routes
import (
"encoding/json"
"log"
"net/http"
"strconv"
"github.com/cakazies/go-postgre/application/api"
)
type (
// HandlerFunc ...
HandlerFunc func(http.ResponseWriter, *http.Request) (interface{}, error)
)
func (fn HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) {... |
5ec0a623229585f771462b2e418f80a9fdcb48fe | 7badb93d2c604d1e813c2ef060fbc99930a0ccaf | pandatix/gocket-chat | /api/chat/postMessage.go | Go | go | 4,327 | permissive | package chat
import (
"bytes"
"encoding/json"
"net/http"
gochat "github.com/pandatix/gocket-chat"
"github.com/pandatix/gocket-chat/api"
)
// PostMessageParams combines all the parameters for an
// /api/v1/chat.postMessage call.
type PostMessageParams struct {
Channel string `json:"channel"`
Text ... |
73737b79145716a63b2c84ccc9264c1f9f77d43c | ccaaece70ee3c3849378563fe6f4976bd126766c | MuCephei/sdk | /rest-datasource.go | Go | go | 3,688 | permissive | package sdk
/*
Copyright 2016 Alexander I.Grafov <grafov@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless require... |
aed74d948b7baa19bd66074504ab44cb8f517512 | 581f39c6729f8759e9974b7d984df74ea42c04c5 | marcoshuck/tflitego | /interpreter.go | Go | go | 2,266 | permissive | package tflitego
/*
#include <stdio.h>
#include <tensorflow/lite/c/c_api.h>
#cgo LDFLAGS: -ltensorflowlite_c
#cgo linux LDFLAGS: -lm -ldl -lrt
*/
import "C"
import (
"fmt"
)
// TfLiteStatus represents TFLiteStatus
type TfLiteStatus int
// options to represent TFLiteStatus
const (
TfLiteOk TfLiteStatus = iota
TfLi... |
0702999b10aca158e4c16368be731e24b395ccee | 671be45f02ca17835385292d9729c1a26dd3dfbb | mrlauer/pdfmaker | /gopath/src/pdfapp/pdfrouter_test.go | Go | go | 2,392 | no_license | package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"local/document"
"net/http"
"net/http/httptest"
"path"
"runtime"
"testing"
)
func do_request(t *testing.T, req *http.Request, expStatus int) []byte {
response, err := http.DefaultClient.Do(req)
url := req.URL.Path
if err != nil {
t.Errorf(... |
ec6674286dafc629d1bf2e5b6bb07134399431f9 | c821509cc8db93642328f77e5ac280b9308f85f2 | 2opremio/cli | /Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go | Go | go | 19,491 | permissive | package cli_test
import (
"bytes"
"flag"
"fmt"
"io"
"os"
"strings"
"testing"
"github.com/convox/cli/Godeps/_workspace/src/github.com/codegangsta/cli"
)
func ExampleApp() {
// set args for examples sake
os.Args = []string{"greet", "--name", "Jeremy"}
app := cli.NewApp()
app.Name = "greet"
app.Flags = []... |
21caa70f282b805501292f79730ce7527529e0ff | 0f233859d5252309ac3f647cbc1778f45ec73dbd | crixo/woa-go-api | /test/utils.go | Go | go | 766 | no_license | package test
import (
"os"
"testing"
"github.com/crixo/woa-go-api/model"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
var dbFile = "woa-go-test.db"
func SetUp(t *testing.T) (db *gorm.DB) {
os.Remove(dbFile)
db, err := gorm.Open("sqlite3", dbFile)
if err != nil {
t.Error(err)
}
... |
1f0b49ec5b98d009d0b604671e1f5ecce2259c53 | 98daefd9ca08e58bcbc9dd7321bc4050533faf79 | ur4nium235/be-graphql | /internal/logging/logrus.go | Go | go | 3,176 | no_license | package logging
import (
"github.com/sirupsen/logrus"
lumberjack "gopkg.in/natefinch/lumberjack.v2"
"io"
"os"
)
/**
*
* @author: hoangtq
* @timeCreate: 20/05/2020 23:11
* To change this template use File | Settings | Editor | File and Code Template | Includes
* */
type logrusLogEntry struct {
entry *logrus... |
935309d84ebbbba635a182bf1c4bd84bf0acadb1 | adc79a3fd3973ca052525fb35746c59d23534cc2 | cocoklp/config-parser | /parsers/tcp/tcp-request.go | Go | go | 2,714 | permissive | /*
Copyright 2019 HAProxy Technologies
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... |
f71eb97799c7696e98aced0a833ff411afe81096 | 23f41efc6ee42e44cfbf04a7baeac6749212b20f | wtsi-hgi/ssh-keydgen | /main.go | Go | go | 2,433 | permissive | package main
import (
"fmt"
"io/ioutil"
"os"
"golang.org/x/crypto/ssh/terminal"
"gopkg.in/urfave/cli.v1"
)
const (
// exit codes
errCode = 1
bugCode = 5
// key types
DSA = "dsa"
ECDSA = "ecdsa"
ED25519 = "ed25519"
RSA = "rsa"
)
func init() {
cli.AppHelpTemplate = `NAME:
{{.Name}}{{if .Us... |
558affcb82e609b15168ab6e75a41941494f280a | 340751e47a86f0bd6a581e80e5845c08e82f481c | anacanm/learning | /learningGo/type/main.go | Go | go | 617 | no_license | package main
import (
"fmt"
)
// Hour represents the hour :)
type Hour int
// PrintHour prints the Hour to stdout
func PrintHour(h Hour) {
fmt.Printf("%#v hour", h)
}
func main() {
// var a int = 42
// fmt.Println(a)
// fmt.Printf("%T\n", a)
//
// type myType int
//
// var b myType = 43
// fmt.Println(b)
... |
be032fb2a5257e0297cc39c020898409b9fb50b0 | 9a52b63159c5f970391fb917dc959d127622d30a | blischalk/go-system-programming | /chapter10/cOfC.go | Go | go | 642 | no_license | package main
import (
"fmt"
)
var numbers = []int{0, -1, 2, 3, -4, 5, 6, -7, 8, 9, 10}
func f1(cc chan chan int, finished chan struct{}) {
c := make(chan int)
cc <- c
defer close(c)
total := 0
i := 0
for {
select {
case c <- numbers[i]:
i = i + 1
i = i % len(numbers)
total = ... |
c67a6fc3fc04da955af4277bbad229835b6405e7 | ea63ed7f9560da73b9fd38ed252c6a860dd44cac | Fxztam/oracall | /lib/plsql.go | Go | go | 30,593 | permissive | // Copyright 2013, 2021 Tamás Gulácsi
//
// SPDX-License-Identifier: Apache-2.0
package oracall
import (
"bytes"
"fmt"
"go/format"
"io"
"os"
"sort"
"strings"
"text/template"
"github.com/godror/godror"
)
// MaxTableSize is the maximum size of the array elements
var MaxTableSize = 128
const batchSize = 1024... |
72340b645f48f7dc9259e6845482f8bd02c5cce5 | 4f718a246b90fc15f06f805f259cb8e662ba3b7d | chebrolus/golearn | /stringutil/palindrome_test.go | Go | go | 1,010 | permissive | package stringutil
import (
"math/rand"
"testing"
)
func TestIsPalindrome(t *testing.T) {
// test data with expected result
var tests = []struct {
s string
isPalindrome bool
}{
{"", false},
{"m", true},
{"ace", false},
{"ana", true},
{"anna", true},
{"aloha", false},
{"alola", true},... |
447894da2ed1f48c10fa82ef541dce9db81253e6 | de8b35348bc54d30a30cbc29a7aa6ed7d6ed0528 | santosomar/cheat | /cmd/cheat/cmd_directories.go | Go | go | 626 | permissive | package main
import (
"bytes"
"fmt"
"text/tabwriter"
"github.com/cheat/cheat/internal/config"
"github.com/cheat/cheat/internal/display"
)
// cmdDirectories lists the configured cheatpaths.
func cmdDirectories(opts map[string]interface{}, conf config.Config) {
// initialize a tabwriter to produce cleanly colum... |
b00ecb56939e55dd67b88b2ab6e8b3a84a1fae0d | 692bfa88f7a2f3266d0c462c0abaf1d3486aa6b4 | avahowell/Sia | /modules/host/announce.go | Go | go | 2,744 | permissive | package host
import (
"errors"
"github.com/NebulousLabs/Sia/modules"
)
var (
// errAnnWalletLocked is returned during a host announcement if the wallet
// is locked.
errAnnWalletLocked = errors.New("cannot announce the host while the wallet is locked")
// errUnknownAddress is returned if the host is unable to... |
b3dfa822696ed7cb8349924a506ea0ebd92028e0 | 7a7198a2d9c8ca19c718d33ad168e6ad0ab17f80 | segmentio/pkgsite | /internal/licenses/licenses.go | Go | go | 16,836 | permissive | // Copyright 2020 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 licenses detects licenses and determines whether they are redistributable.
// The functions in this package do not return errors; instead, they log a... |
24cebe968b47d229f7b1d4a53ae84b9cd138c967 | 56e52bf528c6089764d63164816d0558be183286 | lucodealethea/docker-machine-kvm | /cmd/docker-machine-driver-kvm/main.go | Go | go | 201 | permissive | package main
import (
"github.com/lucodealethea/docker-machine-kvm"
"github.com/docker/machine/libmachine/drivers/plugin"
)
func main() {
plugin.RegisterDriver(kvm.NewDriver("default", "path"))
}
|
8c99f979c6759be0c7ed3d2a87a55a6e7eb9533a | 3db3d7539e07e03bc4cc569d456e07250403d098 | qyzhaoxun/tencentcloud-sdk-go | /tencentcloud/tke/v20180525/models.go | Go | go | 73,001 | permissive | // Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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
//
... |
af683adf8dd694444540434a73ab7a0085f7d86b | 5f4403d37003b6232464265b157e4e4b19b6e96f | moisespsena-go/goenv | /goenv/cmd/activate.go | Go | go | 1,197 | permissive | // Copyright © 2018 Moises P. Sena <moisespsena@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by ap... |
e97b410febe4eec02a9cdfa7f676d41425f5bd4c | c12be9529ef84880c70fe705500821ffc2bb009f | eamirgh/go-twitter-cleaner | /config/config.go | Go | go | 490 | permissive | package config
import "os"
// Config is what's necessary for the app to run
type Config struct {
AccessToken string
AccessSecret string
APIKey string
APISecret string
ScreenName string
}
// New returns a new Config struct
func New() *Config {
return &Config{
AccessToken: os.Getenv("ACCESS_TOKEN"... |
82e04f9aaa3d691c1a51c31f7223337687721435 | 0f44ec87c2f67dc1a1dd95f82b25766b24adf18d | cwx-hannoschulz/sftp-exporter | /pkg/utils/utils.go | Go | go | 1,654 | no_license | package utils
import (
"fmt"
"strings"
log "github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh"
)
func IsEmpty(s string) bool {
return len(strings.TrimSpace(s)) == 0
}
func IsNotEmpty(s string) bool {
return !IsEmpty(s)
}
func PanicIfErr(err error) {
if err != nil {
panic(err.Error())
}
}
func SSHAuth... |
7919be0e66089bf1b50d46204ab5d6a14d3d07a1 | 7aa0858fd597ff5752ef55dcab2c3dcf1e4b518f | quangminh1297/my-kube-proxy | /all/pkg/scheduler/framework/plugins/noderesources/fit_test.go | Go | go | 29,241 | permissive | /*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
c8a522b8a7a77f910b2c380500057e4afa455676 | 14bf818e279748d8bfdbd15e14bdf43bf5ab1ff1 | incherre/sudokuproj | /sudokugenmain/main.go | Go | go | 287 | permissive | package main
import (
"fmt"
"math/rand"
"time"
"github.com/incherre/sudokuproj/sudokugen"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
board := sudokugen.NewBoard()
sudokugen.FindBoard(board, 0, 6)
sudokugen.PrintBoard(board)
var input string
fmt.Scanln(&input)
} |
678e4b8415d0cbafdb9c659aa5b62e968a820c8c | eef8880a01e647903cac986aa05b784381dd20cc | Melenium2/inhumanCocain | /support/logic/grpc_servers.go | Go | go | 421 | no_license | package support
import (
"github.com/go-kit/kit/log"
auth "github.com/inhumanLightBackend/auth/logic"
"google.golang.org/grpc"
)
var (
AuthserverPort = ":1011"
)
func AuthGRPCService(instance string, logger log.Logger) (auth.Service, *grpc.ClientConn, error) {
conn, err := grpc.Dial(instance, grpc.WithInsecure(... |
af14a8cd62be3cd319b5110466d2b0563ab6b8b7 | 405129589fff8a812ebd03a85f5171661893a3f4 | jamescarr/go-learning | /integrations/memcached/main.go | Go | go | 251 | no_license | package main
import (
"fmt"
"github.com/bradfitz/gomemcache/memcache"
)
func main() {
mc := memcache.New("127.0.0.1:11211")
mc.Set(&memcache.Item{Key: "foo", Value: []byte("my value")})
it, _ := mc.Get("foo")
fmt.Println(string(it.Value))
}
|
2c3c1de367d59833b50179159c94d2ad44fa9bdc | 473e01b18b81e9a75d139aefe235425742ba7193 | gaozhengshuang/familyfight | /server/gopath/src/github.com/gorilla/websocket/client_server_test.go | Go | go | 11,142 | permissive | // Copyright 2013 The Gorilla WebSocket 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 websocket
import (
"crypto/tls"
"crypto/x509"
"encoding/base64"
"io"
"io/ioutil"
"net/http"
"net/http/cookiejar"
"net/http/httpt... |
0292b8c099b2cd7e657b24ae4222902802260267 | aa7c68024dbee0865a07e216b6ecced849cab301 | jhhe66/amqp-go-mongodb | /mongo.go | Go | go | 1,603 | no_license | package main
import (
"fmt"
"log"
"os"
"time"
"github.com/streadway/amqp"
mgo "gopkg.in/mgo.v2"
)
// Message inserted in MongoDB
type Message struct {
Date time.Time
Queue string
Fields struct {
ConsumerTag string
DeliveryTag uint64
Redelivered bool
Exchange string
RoutingKey string
}
Pro... |
4d7b619d7bf4558e8216271e0f66aebb7852e005 | f39be2916694d900dae1195636fa06af70c9ee43 | cpacia/openbazaar-go | /vendor/gx/ipfs/QmWUswjn261LSyVxWAEpMVtPdy8zmKBJJfBpG3Qdpa8ZsE/go-libp2p-peer/peerset/peerset.go | Go | go | 1,366 | permissive | package peerset
import (
"sync"
peer "gx/ipfs/QmWUswjn261LSyVxWAEpMVtPdy8zmKBJJfBpG3Qdpa8ZsE/go-libp2p-peer"
)
// PeerSet is a threadsafe set of peers
type PeerSet struct {
ps map[peer.ID]struct{}
lk sync.RWMutex
size int
}
func New() *PeerSet {
ps := new(PeerSet)
ps.ps = make(map[peer.ID]struct{})
ps.s... |
92cf2a13d4c6baada1375d240607857fda8f38f4 | 5f55b41beacd30b6ad0fc12a0c5f3acc795286ae | github/vitess-gh | /go/vt/vttablet/endtoend/misc_test.go | Go | go | 29,777 | permissive | /*
Copyright 2019 The Vitess 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, soft... |
ea69a2a9866b65a8a9c0cf6f211d4c9c6171409c | 8dc3eb83dba656cd60eb7eec8daee0e67144040a | alextanhongpin/consistent-hashing | /main.go | Go | go | 1,456 | no_license | package main
import (
"errors"
"fmt"
"hash/crc32"
"sort"
"sync"
)
func NewRing() *Ring {
return &Ring{Nodes: Nodes{}}
}
func NewNode(id string) *Node {
return &Node{
ID: id,
HashID: crc32.ChecksumIEEE([]byte(id)),
}
}
func (r *Ring) AddNode(id string) {
r.Lock()
defer r.Unlock()
node := NewNode(i... |
015eab224031373bda3367c320b8804650179e05 | d43ab6e448bce4f95cc85a5ab3fe43ee0679ced4 | yyf330/gophercloud | /openstack/networking/v2/extensions/lbaas/members/requests.go | Go | go | 4,555 | permissive | package members
import (
"github.com/yyf330/gophercloud"
"github.com/yyf330/gophercloud/pagination"
)
// ListOpts allows the filtering and sorting of paginated collections through
// the API. Filtering is achieved by passing in struct field values that map to
// the floating IP attributes you want to see returned. ... |
c6020b435925c68208349d747ce71b0d2445db6b | e2fee6aa1b7bb8b52cfc2e7f7ca939e319d95731 | optlsnd/uploadcare-go | /internal/codec/codec.go | Go | go | 6,913 | permissive | // Package codec holds encoding decoding reading writing stuff
package codec
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"net/textproto"
"net/url"
"reflect"
"strconv"
"strings"
"sync"
"time"
"github.com/uploadcare/uploadcare-go/internal/confi... |
058101d0bc05f0a2b2d4d6dc53c729bc5bba0c76 | 69179a7d8d8a1153a6169db043c8ce34721e3161 | FlorianOtel/k8s-client | /vendor/github.com/FlorianOtel/client-go/pkg/apis/authentication/v1beta1/types.generated.go | Go | go | 33,924 | 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, ... |
5fceb0cbbdcbec5625fc202523cb80b7d9f946f0 | 71538ca824a1392d76e8c790abc0ff03598eef10 | bbkbk222/qitmeer-lib | /params/btc/btc_params.go | Go | go | 25,264 | no_license | // Copyright (c) 2017-2018 The nox developers
package btc
import (
"time"
"math"
"math/big"
"github.com/HalalChain/qitmeer-lib/common/hash"
"github.com/HalalChain/qitmeer-lib/core/types"
)
// newHashFromStr converts the passed big-endian hex string into a
// chainhash.Hash. It only differs from the one availabl... |
879f285e269fcd9e812ef6e751248553f7d8bd8d | 7e2e4ddb1dc7f6507daae0d84020a55e641ab53b | zaung/coherence-operator | /pkg/utils/arrays.go | Go | go | 457 | permissive | /*
* Copyright (c) 2020, Oracle and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*
*/
package utils
func StringArrayContains(list []string, s string) bool {
for _, v := range list {
if v == s {
return true
... |
6ffbda146095778cd96aa6c404bf1c68eddc8616 | 25bfd654392d7c0bd9b7bd8c7b443169a5fcaef7 | ParadiseTaboo/go-filecoin | /mining/scheduler.go | Go | go | 7,891 | permissive | package mining
// The Scheduler listens for new heaviest TipSets and schedules mining work on
// these TipSets. The scheduler is ultimately responsible for informing the
// rest of the system about new blocks mined by the Worker. This is the
// interface to implement if you want to explore an alternate mining strate... |
d18067eb663680447bf39ed5d99616127258c198 | 622a6da035834e5efe5d1c24df1591317a0b810f | naveen584/pachyderm | /src/client/pkg/tracing/tracing.go | Go | go | 7,956 | permissive | package tracing
import (
"context"
"fmt"
"io"
"os"
"strings"
"sync"
"time"
otgrpc "github.com/opentracing-contrib/go-grpc"
opentracing "github.com/opentracing/opentracing-go"
log "github.com/sirupsen/logrus"
"github.com/uber/jaeger-client-go"
jaegercfg "github.com/uber/jaeger-client-go/config"
"google.go... |
dc789bf457bb7c6364e14a2d20aad3b9384ebc70 | 6fe19a4913dfc98bd970ceeef00b18476719bd7b | cdsalmons/cockroach | /gossip/client.go | Go | go | 5,550 | permissive | // Copyright 2014 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
f34df8e341d0b01eb7210c3126813b58243dcd04 | d61027e788380b50609daad15106a566f762223d | inkyblackness/hacked | /ss1/resource/Resource.go | Go | go | 1,194 | permissive | package resource
// Properties describe the meta information about a resource.
type Properties struct {
// Compound tells whether the resource should be serialized with a directory.
// Compound resources can have zero, one, or more blocks.
// Simple resources always have exactly one block.
Compound bool
// Conte... |
e96aa892d8cf1aaaddff9be8bfaa96bb400f5d55 | 17e3ce9504349cad36936dec63beec6e838812cd | kunal-kushwaha/thanos | /pkg/cache/inmemory_test.go | Go | go | 2,958 | permissive | // Copyright (c) The Thanos Authors.
// Licensed under the Apache License 2.0.
package cache
import (
"context"
"github.com/go-kit/kit/log"
"testing"
"time"
prom_testutil "github.com/prometheus/client_golang/prometheus/testutil"
"github.com/thanos-io/thanos/pkg/testutil"
)
func TestInmemoryCache(t *testing.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.