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 |
|---|---|---|---|---|---|---|---|---|
55d5e771a76584cd337d5c08db148642f034dd11 | 33ebe29cbb3dba659f68b6bbce2f6abf843be8e3 | abiquo/terraform-provider-abiquo | /tests_test.go | Go | go | 3,650 | permissive | package main
import (
"fmt"
"io/ioutil"
"testing"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
func checkDestroy(d *description) resource.TestCheckFunc {
return func(s *terraform.State) error {
for _, rs := range s.RootModule().Resources {
if rs.Type != d.N... |
083099f53b09ca29d4af9757127fe4e7eabb21db | 64a1ba8af9e96bf0bc311332a92fb9c7b510c2e3 | ihippik/etcd | /clientv3/integration/network_partition_test.go | Go | go | 9,950 | permissive | // Copyright 2017 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... |
916ab9b7485f19f8ecd746800e62643323f9da4f | 05516e96cdb4f8efdbb2360fbe168949ce77e976 | rogbas/cluster-api-provider-aws | /pkg/deployer/deployer.go | Go | go | 3,512 | permissive | // Copyright © 2018 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 ag... |
c504377aff855bc4bc4f197b6c6e5a4b366190d5 | 3ffb638c946c19254fe2da2b0572a8008b741b61 | grofers/descheduler | /pkg/descheduler/strategies/pod_antiaffinity.go | Go | go | 3,932 | 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, ... |
a5ba1bb011603bf9363b5e23d85c4dfe19f3ba0e | ca142221a94f40ceaa6c2eeb953835f4a567fc44 | doytsujin/pixie | /src/vizier/services/metadata/controllers/tracepoint/tracepoint_test.go | Go | go | 17,179 | permissive | /*
* Copyright 2018- The Pixie 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... |
14a6c896d79a88eb5f148343ff21f1e4e6454051 | ee215437f16a25e30ef1b47dc77505894a74217a | webclinic017/docker-slim | /pkg/app/sensor/monitors/ptrace/interface.go | Go | go | 748 | permissive | package ptrace
import (
"github.com/docker-slim/docker-slim/pkg/monitor/ptrace"
"github.com/docker-slim/docker-slim/pkg/report"
)
type AppRunOpt = ptrace.AppRunOpt
type Monitor interface {
// Starts the long running monitoring. The method itself is not
// blocking and not reentrant!
Start() error
// Cancels t... |
43d08931544312ffb6edbacef7c212e53e325cfa | c8c78362daadc44152c38c33e80dcb3f7882340d | jbloxham/go-ipfs | /dagutils/diff.go | Go | go | 4,793 | permissive | package dagutils
import (
"context"
"fmt"
"path"
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
"gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid"
dag "gx/ipfs/QmaDBne4KeY3UepeqSVKYpSmQGa3q9zP6x3LfVF2UjF3Hc/go-merkledag"
ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-... |
40d654e0c0bf31c8ebebf7716fe42bbec33cb029 | b41677ff3f52196f20ec90545e286bfb4d6c8663 | dgn/bots | /policybot/pkg/storage/spanner/query.go | Go | go | 28,963 | permissive | // Copyright 2019 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... |
62a3ee7fa464da24b73daf2e83b0241e6032430d | e473f654ddfdc4369f6e1eafa9671e1d92e6d707 | concourse/concourse | /atc/creds/noop/noop_test.go | Go | go | 586 | permissive | package noop_test
import (
"time"
. "github.com/concourse/concourse/atc/creds/noop"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Noop", func() {
var noop Noop
Describe("Get", func() {
var val interface{}
var expiration *time.Time
var found bool
var getErr error
Just... |
735806a18f22026862b93be6884d12340bea33fc | da3751a2c2aff22b8edffe6fc0c31cdb40495bc4 | rohansub/burrito | /src/main.go | Go | go | 798 | no_license | package main
import (
"fmt"
"github.com/rohansub/burrito/src/config"
"os"
"github.com/rohansub/burrito/src/server"
"github.com/rohansub/burrito/src/parser"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("Usage: ./main <burrito_file>")
return
}
cfg, err := config.NewConfigFromFile("burritoconfig.jso... |
12b681ac8d09213905b53b41f763734c3f234375 | 7e9fa41cb6a8fe54b027878438c10088352f1693 | jamesdio/virt-go | /cmd/AboutImage.go | Go | go | 1,742 | permissive | package cmd
import (
"fmt"
"io"
"os"
"os/exec"
"strconv"
"github.com/cheggaaa/pb/v3"
)
func GenDomDisk(image string, Num int, size int) (output string) {
output = Datadir + "/volumes/virt-go-" + image + "-" + strconv.Itoa(Num) + "root"
in, err := os.Open(Datadir + "/images/" + image)
if err != nil {
fmt.... |
27ef13ec93e090024e3d7cb8413b95012ed3ea38 | 1821a5429dd02121f0e168238f2707a82159a482 | jackluo2012/books | /orders-srv/main.go | Go | go | 2,124 | no_license | package main
import (
"books/basic"
"books/basic/common"
"books/basic/config"
"books/orders-srv/handler"
"books/orders-srv/model"
proto "books/orders-srv/proto/order"
"books/orders-srv/subscriber"
"fmt"
"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2"
"github.com/micro/go-micro/v2/registry"
"github... |
407427df482d51dbf0cdeed62c2f9bd687c7fce5 | a8ba4e54d61805495761cbc02a262c650a241b01 | zeikar/yorkie | /yorkie/rpc/yorkie_server.go | Go | go | 10,494 | permissive | /*
* Copyright 2020 The Yorkie 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... |
aa77cbf18f44e2e4b1507f15e23c130efa43ac45 | 415f6a28cfff99899d4315660cc8b9f680c083e7 | bensallen/duoldapsync | /duo_test.go | Go | go | 5,668 | permissive | package main
import (
"fmt"
"net/http"
"net/http/httptest"
"net/url"
"reflect"
"strings"
"testing"
"time"
duoapi "github.com/duosecurity/duo_api_golang"
"github.com/duosecurity/duo_api_golang/admin"
)
func buildAdminClient(url string, proxy func(*http.Request) (*url.URL, error)) *admin.Client {
ikey := "e... |
72aa7a6841b3ddeb4e579033d4c642d53f02a775 | 1cd41e7aebab954c147025d3babd9e21756e46a5 | MontyCarter/opentelemetry-collector | /receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_test.go | Go | go | 5,610 | permissive | // Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
838f66521a3d6ea13bc1490dd64b435e746b0ba0 | 96effe1f274e24c1765455083480f1b3dfa51279 | deiscc/controller-sdk-go | /ps/ps_test.go | Go | go | 6,632 | permissive | package ps
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"reflect"
"testing"
deis "github.com/deiscc/controller-sdk-go"
"github.com/deiscc/controller-sdk-go/api"
"github.com/deiscc/controller-sdk-go/pkg/time"
)
const processesFixture string = `
{
"count": 1,
"next": null,
"previous":... |
55b4cc3937df0457f574e2c2dfa930a5b8d342b5 | c162c529b0566de618ab9989f04a17de6de324cd | Lexkane/DataStructuresGo | /Sort/bubble_sort.go | Go | go | 453 | no_license | package main
/*
* Bubble sort - http://en.wikipedia.org/wiki/Bubble_sort
*/
import "fmt"
import "github.com/0xAX/go-algorithms"
func main() {
arr := utils.RandArray(10)
fmt.Println("Initial array is:", arr)
fmt.Println("")
tmp := 0
for i := 0; i < len(arr); i++ {
for j := 0; j < len(arr)-1-i; j++ {
if... |
f2370084be7568d6f1fca47c052f07bc6321a18c | 1778a6d9e246ab8f8d0e9d443c8b51d080bb46d2 | yext/apimachinery | /pkg/runtime/serializer/testing/types.go | Go | go | 5,579 | permissive | /*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
020d4b9cd5e4a73a8aee9e69a41bdfb78fa1ea17 | bd9335d5e8b7d2e331f940cd62eadf5c0ac78a98 | sfkshan/Boilerplates | /Go/app/utils/models.go | Go | go | 984 | no_license | package utils
import (
"errors"
"reflect"
"time"
)
func SetTimeStamp(m interface{}) (err error) {
typ := reflect.TypeOf(m).Elem()
val := reflect.ValueOf(m).Elem()
if typ.Kind() != reflect.Struct {
err = errors.New("Binding element must be a struct")
}
baseValue := val.FieldByName("Base")
updatedAt := ba... |
a9bf2de74a0e6c901e20a4317db178c71fee3c3c | 691c02e041ceb7286df7623c4eabaa68c519cca7 | zeroaffect/social-harvest-clone | /src/github.com/ant0ine/go-json-rest/rest/powered_by.go | Go | go | 724 | permissive | package rest
const xPoweredByDefault = "go-json-rest"
// PoweredByMiddleware adds the "X-Powered-By" header to the HTTP response.
type PoweredByMiddleware struct {
// If specified, used as the value for the "X-Powered-By" response header.
// Defaults to "go-json-rest".
XPoweredBy string
}
// MiddlewareFunc makes... |
38d8776d6e46ee54c142b2779044bbfcf3807b7d | 1c98fabc6b3f58ad0e850d0f19b506a4c8aae4ed | necessary2017/google-api-go-client | /managedidentities/v1alpha1/managedidentities-gen.go | Go | go | 186,259 | permissive | // Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package managedidentities provides access to the Managed Service for Microsoft Active Directory API.
//
// For product documentation, see: https... |
b72642de4c5c089b9e58c78b5bf5156a600ca197 | dfd2359772c71950390048db2cf6fa49634394ca | beeinstant-dev/beeinstant-go-sdk | /sender.go | Go | go | 5,222 | permissive | package beeinstant_go_sdk
import (
"net/http"
"time"
"bytes"
"strings"
"fmt"
"sort"
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"log"
"io"
"io/ioutil"
"net/url"
)
type Sender struct {
publicKey string
secretKey string
endpoint string
client *... |
c7be52bb2b658796fb6198746a013bccccaf4ee8 | 4ec2e8012c0d2bd4eb81ebfb279a1f1f9e8cf5ae | tichx/collaborative-photo-management | /servers/gateway/models/users/user_test.go | Go | go | 5,652 | no_license | package users
import (
"strings"
"testing"
"golang.org/x/crypto/bcrypt"
)
//TODO: add tests for the various functions in user.go, as described in the assignment.
//use `go test -cover` to ensure that you are covering all or nearly all of your code paths.
func createNewUser() *NewUser {
return &NewUser{
UserNa... |
6d17db9904620e060ee735515f46bb88758ba63d | b76ff3612ffefd330cf3f33af87580318b4a80d5 | zhangxiaoyu-zidif/test-infra | /boskos/janitor/janitor_test.go | Go | go | 4,353 | 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, ... |
1cb9769913f0959f32ee825a813c8184f45c7e7f | 55036aca62888e33753cfe31a3611dd5b7b7de75 | sandromello/wgadmin | /cmd/main.go | Go | go | 1,872 | no_license | package main
import (
"fmt"
"os"
"github.com/sandromello/wgadmin/pkg/cli"
"github.com/sandromello/wgadmin/pkg/version"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
func init() {
// Log as JSON instead of the default ASCII formatter.
// log.SetFormatter(&log.JSONFormatter{})
// Output to stdou... |
8cff54a295c6dca395c7a68d991525cec7decbef | 6fbbdb1aa73beb7a5150d20d3305492b04524ac0 | rchamorro/pulumi-azure-nextgen | /sdk/go/azure/aadiam/latest/diagnosticSetting.go | Go | go | 8,843 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package latest
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// The diagnostic setting resource.
// Late... |
90ed9304e760011fba3819f8b5a344f4a8f7045d | 55dfccd6825d7de46ff88d04f7c0e26fe4b9a476 | byuoitav/av-cli | /couch/dup.go | Go | go | 3,201 | permissive | package couch
import (
"bytes"
"context"
"fmt"
"io/ioutil"
"net/http"
"strings"
"github.com/go-kivik/kivik"
)
type statusErr interface {
StatusCode() int
}
func (d *DataService) CopyRoom(ctx context.Context, src, dst string) error {
rooms := d.client.DB(ctx, "rooms")
uiConfigs := d.client.DB(ctx, "ui-conf... |
4d559901cf27a1420d37137e3f46a57aba42ce87 | 4ab6811f6e5f8f97fff6bca70e394a78205a011f | somsubhojit1988/AdventOfCode_2k19 | /day7/amplifier/amp.go | Go | go | 2,195 | no_license | package amplifier
import (
"github.com/som.subhojit1988/aoc_2k19/intcomputer"
)
const (
ampStateInit = -1
ampStatePhaseProvided = 0
ampStateInputProvided = 1
ampStateFinishedExecution = 2
)
type Amplifier struct {
c *intcomputer.IntComputer
state int
pha... |
7b48047883bf9dfd5baa1e2cbc8122df678e3a29 | 7b2b5718c346b46ed7f2a7b318f6a2e96950fd41 | luci/luci-go | /gce/appengine/rpc/instances_test.go | Go | go | 7,544 | permissive | // Copyright 2019 The LUCI 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... |
35f89caf7df0619c790e3b4403f064af5bb3f73b | b640d080feedaf892cbae9d4338c0e1612b9c0b0 | NguyenTrungTin/go-echo-boilerplate | /api/user/validate.go | Go | go | 1,852 | permissive | package user
import "github.com/go-playground/validator"
func Validate(u *User) (bool, string) {
validate := validator.New()
err := validate.Struct(u)
if err != nil {
for _, err := range err.(validator.ValidationErrors) {
switch err.StructField() {
case "Email":
return false, "Invalid email address!"... |
d8b9f6eccc11e81670beb976ea8ab43abc5c6153 | dee108f90afecfc22c8dd36bbad3c8c8c6d08c85 | MisinformedDNA/pulumi-azure-native | /sdk/go/azure/devtestlab/v20160515/virtualMachine.go | Go | go | 22,229 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20160515
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// A virtual machine.
type VirtualMachin... |
9a538cf283d715df30532d2ce55f1bd8060ecd3b | 5f9469949ab7aa2c1fa57d7c1a5b7044e1debb5f | kenjones-cisco/yaml | /data_navigator.go | Go | go | 5,327 | permissive | package main
import (
"fmt"
"sort"
"strconv"
"gopkg.in/yaml.v2"
)
func entryInSlice(context yaml.MapSlice, key interface{}) *yaml.MapItem {
for idx := range context {
var entry = &context[idx]
if entry.Key == key {
return entry
}
}
return nil
}
func writeMap(context interface{}, paths []string, valu... |
dfcc59d2978050af23f8c0a363f800044ebe58eb | ef270572af5b6e013b8b2a9243396e62651309f6 | MattCurryCom/teleport | /lib/srv/db/common/role/role.go | Go | go | 3,078 | permissive | /*
Copyright 2021 Gravitational, 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, soft... |
100d97c258ea4a7974ef2f8a9eed16024baffef7 | 61d7f19d05c17a70b55b414ab5f5d3654f702312 | dant89/go-examples | /data-types/assignment/assignment.go | Go | go | 1,348 | no_license | package main
import (
"fmt"
"html"
"strconv"
)
func main() {
// int examples
var x int = 3
var y int8 = 127
var z uint64 = 4294967295
fmt.Printf("%T %d\n", x, x)
fmt.Printf("%T %d\n", y, y)
fmt.Printf("%T %d\n", z, z)
// string examples
var dbId string = "30594050-c1bd-ec25-b474-5360e7a700dd"
fmt.Prin... |
c6bce2a1cb2435a6ce1091422d9b784d493bc15e | 1460914e3a3c5a02d52d9c18592a5d6b04c95287 | IvarsVds/adventofcode2020 | /06/solution.go | Go | go | 1,332 | no_license | package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
input, err := getInput()
if err != nil {
panic(err)
}
res1 := solveFirstTask(input)
fmt.Println(res1)
}
func getInput() ([][]string, error) {
results := make([][]string, 0)
f, err := os.Open("./input.txt")
if err != nil {
return re... |
dee63f3649999573690479af80086c22eb135614 | 0ad89690c629853276a0cfed1d055a7c7ef66245 | arun1587/go-coap | /net/blockwise/blockwise.go | Go | go | 27,705 | permissive | package blockwise
import (
"bytes"
"context"
"fmt"
"io"
"net"
"time"
"golang.org/x/sync/semaphore"
"github.com/dsnet/golib/memfile"
"github.com/plgd-dev/go-coap/v2/message"
"github.com/plgd-dev/go-coap/v2/message/codes"
"github.com/plgd-dev/go-coap/v2/pkg/cache"
udpMessage "github.com/plgd-dev/go-coap/v2... |
5dc80adea9847cabb7386f9014f609896bed4b7e | 0c2c87e0350514951caf28cc15803ec1bb3f691b | helmutkemper/iotmaker.db.mongodb.config | /config/typeNetPort.go | Go | go | 284 | permissive | package iotmaker_db_mongodb_config
type NetPort int
func (el *NetPort) Set(value int) {
*el = NetPort(value)
}
const (
KNetPortMongodOrMongosInstance NetPort = 27017
KNetPortMongodIsAShardMember NetPort = 27018
KNetPortMongodIsAConfigServerMember NetPort = 27019
)
|
382519e9dec83b9df49682ea4f75f01d41a41358 | 2b3b12d0c2ff57ff57f8cfbc7c2702283fc6ff37 | liuyuhang791034063/GoLearn | /src/ch7/surface/surface.go | Go | go | 482 | no_license | package surface
import (
"fmt"
)
import "gopl.io/ch7/eval"
func parseAndCheck(s string) (eval.Expr, error) {
if s == "" {
return nil, fmt.Errorf("empty expression")
}
expr, err := eval.Parse(s)
if err != nil {
return nil, err
}
vars := make(map[eval.Var]bool)
if err := expr.Check(vars); err != nil {
re... |
e41cee979116e70656ad4926785d2dc78c289249 | 3955f6f81b3d39c1fd2a1ce59ed31b3ccd7ca942 | icycrystal4/steem-rpc | /apis/database/data.go | Go | go | 5,592 | permissive | package database
import (
// Stdlib
"encoding/json"
"strconv"
"strings"
// RPC
"github.com/icycrystal4/steem-rpc/types"
)
type Config struct {
SteemBlockchainHardforkVersion string `json:"STEEM_BLOCKCHAIN_HARDFORK_VERSION"`
SteemBlockchainVersion string `json:"STEEM_BLOCKCHAIN_VERSION"`
SteemBlockIn... |
b4c8ee9bce824ac6cb606a7b051cb473976589dd | 130187def2390536cab479166898a2dfb7e58b58 | arsa-dev/webrtc | /webrtc_js.go | Go | go | 8,332 | no_license | // +build js
package webrtc
import (
"fmt"
"sync"
"github.com/gopherjs/gopherjs/js"
)
var (
navigator *js.Object
peerConnection *js.Object
)
func init() {
navigator = js.Global.Get("navigator")
peerConnection = js.Global.Get("RTCPeerConnection")
}
// PeerConnection ...
type PeerConnection struct {
pc... |
c461c762c94d11d8352f350b2b4b2ba48e805089 | f1908e8d54b790c74d9620d0b1170e0d873b04c5 | ktpv/ignition | /cmd/ignition/main.go | Go | go | 6,978 | permissive | package main
import (
"log"
"os"
"path/filepath"
"strings"
cfclient "github.com/cloudfoundry-community/go-cfclient"
"github.com/cloudfoundry-community/go-cfenv"
"github.com/dghubble/sessions"
"github.com/kelseyhightower/envconfig"
"github.com/pivotalservices/ignition/http"
"github.com/pivotalservices/igniti... |
22366969a25cedb6c983593c3f59e6ea61f51f6c | d3ba35ecf60d158ebc7bff9430506ad5f6785f00 | YangSen-qn/go-curl-demo | /http-transport.go | Go | go | 2,796 | no_license | package main
import (
"context"
"fmt"
"math/rand"
"net/http"
"sync"
"syscall"
"time"
"github.com/YangSen-qn/go-curl/v2/curl"
"github.com/qiniu/go-sdk/v7/client"
"github.com/qiniu/go-sdk/v7/storage"
)
func main() {
rand.Seed(time.Now().UnixNano())
transport := &curl.Transport{
Transport: &http.Transpor... |
2b58f80bc56b1b5bb0231ff32066813276e0f010 | 101c131813a2f874e739371aa5ca913ba85194fc | rajiteh/brightpod | /vendor/github.com/mochi-co/mqtt/server/persistence/persistence.go | Go | go | 7,823 | permissive | package persistence
import (
"errors"
"github.com/mochi-co/mqtt/server/system"
)
const (
KSubscription = "sub"
KServerInfo = "srv"
KRetained = "ret"
KInflight = "ifm"
KClient = "cl"
)
// Store is an interface which details a persistent storage connector.
type Store interface {
Open() error
... |
e46970c8bebdb0e6e096958aae4ce3cc9ee0c058 | 25e57fbd472dc644d70b23c36b4e965fcdca624c | yuguanggo/algorithm | /liubobo/205isIsomorphic/main.go | Go | go | 1,133 | no_license | package main
/**
205. 同构字符串
给定两个字符串 s 和 t,判断它们是否是同构的。
如果 s 中的字符可以被替换得到 t ,那么这两个字符串是同构的。
所有出现的字符都必须用另一个字符替换,同时保留字符的顺序。两个字符不能映射到同一个字符上,但字符可以映射自己本身。
示例 1:
输入: s = "egg", t = "add"
输出: true
示例 2:
输入: s = "foo", t = "bar"
输出: false
示例 3:
输入: s = "paper", t = "title"
输出: true
说明:
你可以假设 s 和 t 具有相同的长度。
来源:力扣(LeetCode)... |
de3a4bf952428be73cd69998f4bf3b2ff87eb03c | afe9cdcae82028ff23a5d87f01eff29897d43a5c | NirmalVatsyayan/GoPractice | /thewaytogo/code_examples/chapter_6/defer_logvalues.go | Go | go | 432 | no_license | // defer_logvalues.go
package main
import (
"io"
"log"
)
func func1(s string) (n int, err error) {
defer func() {
log.Printf("func1(%q) = %d, %v", s, n, err)
}()
return 7, io.EOF
}
func main() { ... |
205845232449159ad97bee7385e0d6d4e18ffda5 | fc913612a02f27a17e15b695c7b1debdee7efb29 | knative/serving | /vendor/knative.dev/pkg/injection/factories.go | Go | go | 1,126 | permissive | /*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
7b8af6b14f2cbf928f58dd6228f590d08f364d9b | 855ba0b06f3b9458e0a86dfbfaffff5f76c898ba | CEPBEP/ipfs | /core/commands/unixfs/ls.go | Go | go | 5,945 | permissive | package unixfs
import (
"bytes"
"fmt"
"io"
"sort"
"text/tabwriter"
cmds "github.com/ipfs/go-ipfs/commands"
core "github.com/ipfs/go-ipfs/core"
e "github.com/ipfs/go-ipfs/core/commands/e"
merkledag "github.com/ipfs/go-ipfs/merkledag"
path "github.com/ipfs/go-ipfs/path"
unixfs "github.com/ipfs/go-ipfs/unixfs... |
e0199d2a628cacdff980373bcef2dc64a05080af | 6008f4da83a6332f5611e0dff6a04b4778347c25 | BabyCattleyaGP/go-basic | /struct/shapes.go | Go | go | 874 | no_license | package main
import "math"
// Shape interface to tell something is shape
type Shape interface {
Area() float64
}
// Rectangle has the dimensions of a rectangle
type Rectangle struct {
Width float64
Height float64
}
// Area returns the area of the rectangle
func (r Rectangle) Area() float64 {
return r.Width * r... |
650ff25c1e3eb485003c69a47dfab68927735f52 | b2ba130fef54393dfd7fe77215d5c81eea36b7c0 | sgtest/monorepo-test-3 | /kubernetes-15/pkg/kubectl/cmd/apply_test.go | Go | go | 35,493 | permissive | /*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
0401e4040c8a7e440ae3293a130918146a8df1e8 | e297b0d2bfe08ff228e1d96a16d3983bbfded862 | froberge/podset-operator | /pkg/apis/app/v1alpha1/podset_types.go | Go | go | 3,483 | no_license | package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// PodSetSpec defines the desired state of PodS... |
02d5644c666e2c125a9431aadf55dab83f839196 | 6776e19d708d2ed4ffbe6eb3577e262edc10e062 | BustosCecilia/ejercicioCircuitBreaker | /api/domain/myml/myml_users.go | Go | go | 1,747 | no_license | package myml
import (
"encoding/json"
"fmt"
"github.com/mercadolibre/ejercicioCircuitBreaker/src/api/utils/apierrors"
"github.com/sony/gobreaker"
"io/ioutil"
"net/http"
)
type User struct {
ID int64 `json:"id"`
Nickname string `json:"nickname"`
RegistrationDa... |
8c15047d730c1ed6a5628f5a51e5d147603575f6 | 3a0a30d00c0385adf89b7b2edee9f03569d4f147 | just-at-uber/cadence | /common/persistence/nosql/nosqlplugin/cassandra/gocql/client.go | Go | go | 3,594 | permissive | // Copyright (c) 2017-2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, ... |
9d1ca0006704f7c45bfccb69f1b5b7fafcbda4ae | b3c39883fe13d5ad4896bf5631a885b8362b6276 | kpmy/tiss | /ir/ast.go | Go | go | 6,426 | permissive | package ir //import "github.com/kpmy/tiss/ir"
import (
"fmt"
"reflect"
"strings"
"github.com/kpmy/tiss/ir/types"
"github.com/kpmy/ypk/fn"
. "github.com/kpmy/ypk/tc"
)
type Expression interface {
Validate() error
}
type CodeExpr interface {
Eval()
}
type Node interface {
Children() []interface{}
}
type ns... |
bd0881e1afa9d4570b717a449323c613de747489 | c05047533f827483fa926f823dc025dcb1efeaa3 | tfheen/secretd | /src/cmd/secretd/principals.go | Go | go | 1,858 | permissive | /*
Copyright 2015 Fastly Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... |
82d26e31d58fc27c8d292483949f6a28f9f812a1 | 3f081a16cbbd84d2ab1690b3cba50c1a946e4f8d | ajiraj2411/telegraf | /plugins/outputs/signalfx/signalfx_test.go | Go | go | 20,752 | permissive | package signalfx
import (
"context"
"errors"
"reflect"
"testing"
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/metric"
"github.com/influxdata/telegraf/plugins/outputs"
"github.com/influxdata/telegraf/testutil"
"github.com/signalfx/golib/v3/datapoint"
"github.com/signalfx/golib/v3/... |
5e4952235190e30f153053c081000fd7eb08d3f0 | 2ae09efd1ad18060afb4e2ef9039fa2d19a9b13d | ezShroom/odysee-api | /app/query/caller.go | Go | go | 11,185 | permissive | package query
import (
"encoding/json"
"fmt"
"net"
"net/http"
"strings"
"time"
"github.com/lbryio/lbrytv/app/query/cache"
"github.com/lbryio/lbrytv/app/rpcerrors"
"github.com/lbryio/lbrytv/app/sdkrouter"
"github.com/lbryio/lbrytv/app/wallet"
"github.com/lbryio/lbrytv/apps/lbrytv/config"
"github.com/lbryio... |
b543fb72bd7a90aae1f786e61145d833d7e75bff | d6baa566e40f031b077c116dbdfdc69ec2d02461 | owncloud/ocis-reva | /pkg/command/authbearer.go | Go | go | 4,116 | permissive | package command
import (
"context"
"os"
"os/signal"
"path"
"time"
"github.com/cs3org/reva/cmd/revad/runtime"
"github.com/gofrs/uuid"
"github.com/micro/cli/v2"
"github.com/oklog/run"
"github.com/owncloud/ocis-reva/pkg/config"
"github.com/owncloud/ocis-reva/pkg/flagset"
"github.com/owncloud/ocis-reva/pkg/se... |
8b57a85ad7273592d16f9bfb56f5236249e80353 | d4fb02943d48fd3bf3b7229104635b4b04f0fe07 | cweill/Euler | /utils/utils.go | Go | go | 3,620 | no_license | package utils
import (
"io/ioutil"
"math"
"math/big"
"regexp"
"set"
"sort"
"strconv"
"strings"
)
func GCD(a, b int64) int64 {
if b == 0 {
return a
}
return GCD(b, a%b)
}
func Sieve(n int) []int {
isPrimeArray := make([]bool, n)
for i := 0; i < len(isPrimeArray); i++ {
isPrimeArray[i] = true
}
for ... |
8122f0a4abafba9c6a810f561f745d6652e90b8a | 85de01b2bab529e6c5f9840ca514ac9c9ba9d04c | libp2p/go-libp2p | /p2p/security/noise/session_test.go | Go | go | 580 | permissive | package noise
import (
"context"
"testing"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/stretchr/testify/require"
)
func TestContextCancellationRespected(t *testing.T) {
initTransport := newTestTransport(t, crypto.Ed25519, 2048)
respTransport := newTestTransport(t, crypto.Ed25519, 2048)
init, resp ... |
98f7f98d1145e591c1f5017426adfbdf493af433 | 7b88d720e9d32a85a1d1fe2e3c2475a2b44740e2 | alexsaker/argocd-operator | /pkg/common/values.go | Go | go | 2,967 | permissive | // Copyright 2020 ArgoCD Operator Developers
//
// 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 a... |
64edb42725b68d93cc38c1d08204ba34045a6ea7 | 49028020a0580f22a4d0d125cbc78a69b0c7cb0e | csestuit/burry.sh | /vendor/github.com/hashicorp/consul/agent/dns.go | Go | go | 40,154 | permissive | package agent
import (
"encoding/hex"
"fmt"
"log"
"net"
"strings"
"sync/atomic"
"time"
"regexp"
"github.com/armon/go-metrics"
"github.com/coredns/coredns/plugin/pkg/dnsutil"
"github.com/hashicorp/consul/agent/config"
"github.com/hashicorp/consul/agent/consul"
"github.com/hashicorp/consul/agent/structs"
... |
7a01cdcfa6709f62e013b954f78d16dba3b4f0b8 | d9f8b804f05c2153e9a6f4f8b8c8efd8f829232d | storj/dbx | /sqlgen/common_test.go | Go | go | 1,383 | permissive | // Copyright (C) 2019 Storj Labs, Inc.
// Copyright (C) 2017 Space Monkey, Inc.
// See LICENSE for copying information.
package sqlgen
import (
"testing"
)
func TestFlattenSQL(t *testing.T) {
for _, test := range []struct {
in string
exp string
}{
{"", ""},
{" ", ""},
{" x ", "x"},
{" x\t\t", "x"},
... |
104e4eaa0f0f6948072e945b906d2db9103e3006 | bd4f8bafe2d5465b8065a347fe8f6f88211a4238 | hanneshofmann/go-c8y-cli | /pkg/cmd/inventory/subscribe/subscribe.manual.go | Go | go | 3,081 | permissive | package subscribe
import (
"time"
"github.com/MakeNowJust/heredoc/v2"
"github.com/reubenmiller/go-c8y-cli/pkg/c8yfetcher"
"github.com/reubenmiller/go-c8y-cli/pkg/c8ysubscribe"
"github.com/reubenmiller/go-c8y-cli/pkg/cmd/subcommand"
"github.com/reubenmiller/go-c8y-cli/pkg/cmdutil"
"github.com/reubenmiller/go-c8... |
bb4dc709aa130448fb35771aa586d135c498fdbb | 12f6fce905a67714a8b7965c08b0e48495465def | vulcangz/gopics | /page.go | Go | go | 335 | permissive | /*
A GoPics' page.
Copyright (c) 2015, Luca Chiricozzi. All rights reserved.
Released under the MIT License.
http://opensource.org/licenses/MIT
*/
package main
// A GoPics page.
type Page struct {
Title string
User *User
LoggedUser string // Username of the logged user
ValError string // Validation e... |
892acc9e73a28bdb12d5a20d30075a405518477c | cb153f1d127f1cfa1cefc4b578f3aa1820147acb | fentoncryptoshell/avalanchego | /snow/engine/avalanche/bootstrap/bootstrapper.go | Go | go | 16,423 | permissive | // (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package bootstrap
import (
"errors"
"fmt"
"math"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/ava-labs/avalanchego/cache"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avala... |
944c1ca402fd57d6182eeac7b83c2a3adb05fb36 | 7cd2a484f71d5e5e387ca58e293c933ce7f63174 | lye/jsonb | /error.go | Go | go | 1,271 | no_license | package jsonb
import (
"errors"
)
var (
// ErrNoSuchKind is returned when attempting to marshal a string
// to a kind that isn't in the table.
ErrNoSuchKind = errors.New("jsonb: no such kind")
// ErrSchema is returned by operations modifying Table/Lists wherein
// the operation is prohibited by the structure's... |
45ac47d2539b9b929a26a27be1def1c0e18c43e6 | 5a3d74485ef950ee5be2023f4a0b3e776dd89bbc | UnicodingUnicorn/webtoons-downloader | /images.go | Go | go | 1,895 | no_license | package main
import (
"errors"
"fmt"
"io/ioutil"
"mime"
"path"
"strconv"
"time"
)
func (d *Downloader) GetChaptersImages(chapterUrls []string, titles []string, imageUrls [][]string, update func(int)) error {
// Should probably use a struct for this
if !(len(chapterUrls) == len(titles) && len(titles) == len(i... |
51dd2381f1f46ff947fc7888ba9d4919a2bc0ca7 | 13d04375b8c427e16935a0450ebe3b51f33dcff1 | matsutake-eg/atcoder | /go/abc085/b/main.go | Go | go | 358 | no_license | package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
func readInt() int {
sc.Scan()
iv, _ := strconv.Atoi(sc.Text())
return iv
}
func init() {
sc.Split(bufio.ScanWords)
}
func main() {
n := readInt()
m := make(map[int]bool)
for i := 0; i < n; i++ {
d := readInt()
... |
6e8672cb18342d92106b9cde72e0a75ce83504cf | 14ee30f2de0e7d5998d0b97afda91bedd8322060 | danushkaf/amazon-apigateway-ingress-controller | /vendor/github.com/awslabs/goformation/v4/cloudformation/elasticloadbalancingv2/aws-elasticloadbalancingv2-listenerrule_querystringconfig.go | Go | go | 1,595 | permissive | package elasticloadbalancingv2
import (
"github.com/awslabs/goformation/v4/cloudformation/policies"
)
// ListenerRule_QueryStringConfig AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::ListenerRule.QueryStringConfig)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasti... |
96440e25dfd24533f4b5eb0e9423d3935cb32a77 | 0c9f63741de3bc2a61fe470e878bf802bac1fde5 | qnsoft/common | /net/qn_http/qn_http_request_param_ctx.go | Go | go | 1,298 | no_license | // Copyright 2017 gf Author(https://github.com/qnsoft/common). 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/qnsoft/common.
package qn_http
import (
"context"
"githu... |
bfaf37f140a8ff187c08e1cd2a7cff83a3fb041d | 189439cd0d8f37648f1ed63230e205e7b0533d29 | haru4a/go_skill_uper | /pkg/apiserver/server.go | Go | go | 3,458 | no_license | package apiserver
import (
"encoding/json"
"io"
"net/http"
"strconv"
"github.com/go_skill_uper/pkg/storage"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
)
type server struct {
router *mux.Router
logger *logrus.Logger
storage *storage.Storage
config *Config
}
fun... |
79b5edb07f41f33d453c41915417508d8b0a565a | 834dc2f92930b83170663306e4fc0930edbe5bdf | idoru/credhub-cli | /repositories/auth_repository_test.go | Go | go | 2,575 | permissive | package repositories_test
import (
. "github.com/cloudfoundry-incubator/credhub-cli/repositories"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"bytes"
"io/ioutil"
"net/http"
"github.com/cloudfoundry-incubator/credhub-cli/client/clientfakes"
"github.com/cloudfoundry-incubator/credhub-cli/config"
cre... |
a11a74355b222b07d92ec5722b2e3d071b8f2dba | 087c13cc048544f0e549c92f3918d0765a0a95a2 | nawada/monkey | /repl/repl.go | Go | go | 415 | no_license | package repl
import (
"../lexer"
"../token"
"bufio"
"fmt"
"io"
)
const PROMPT = ">> "
func Start(in io.Reader, out io.Writer) {
scanner := bufio.NewScanner(in)
for {
fmt.Print(PROMPT)
scanned := scanner.Scan()
if !scanned {
return
}
line := scanner.Text()
l := lexer.New(line)
for tok := l.... |
43056083619589ab930fe4044da1561708f1bf0e | 3006b879fc6c64dca15befb7e9216d46067f3c51 | 89243982/ds | /sortHelper.go | Go | go | 1,193 | permissive | package sortHelper
import (
"fmt"
"math/rand"
"time"
"github.com/alex/ds/sort"
)
/**
rangL<=rangR
**/
func GeneratorRandom(n int, rangL int, rangR int) []int {
arr := make([]int, 0, n)
rand.Seed(time.Now().Unix())
for i := 0; i < n; i++ {
arr = append(arr, rand.Int()%(rangR-rangL+1)+rangL)
}
return arr
}
... |
4fd1fb495b2689f0a73c0157bb5a8f8262d63a73 | 9269f3f425dafc52095f7ee1faf8dafb4e1236c1 | wangyjyj/ethr | /serverui.go | Go | go | 12,632 | permissive | //-----------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license.
// See LICENSE.txt file in the project root for full license information.
//-----------------------------------------------------------------------------
pa... |
8406cc0e3b605b471ee2361c822d9545696045a3 | 8569fa2b4198c92626091130a655026f16d22ce6 | git1568/nextdns | /discovery/dns.go | Go | go | 6,455 | permissive | package discovery
import (
"net"
"sync"
"time"
lru "github.com/hashicorp/golang-lru"
"github.com/nextdns/nextdns/host"
"github.com/nextdns/nextdns/internal/dnsmessage"
)
type DNS struct {
Upstream string
cache *lru.Cache
once sync.Once
antiLoop semaphoreMap
}
type cacheEntry struct {
Values []string
... |
a51062834586d68fbd2c1a0f4091b08deed5e170 | 7f349c10effedb6e0dbcab8ef025516df33a9211 | VManolas/golang-learning | /theLittleGoBook/learning-go/Example5_Structures/main.go | Go | go | 2,385 | no_license | // Example 5a
package main
import "fmt"
type Saiyan struct {
Name string
Power int
}
func main() {
goku := Saiyan{
Name: "Goku",
Power: 9000,
}
fmt.Printf("%s's power is %d\n", goku.Name, goku.Power)
}
// Example 5b
// package main
// import "fmt"
// type Saiyan struct {
// Name string
// Power int
... |
8faa9c500f6188313f5fda02024c0ac0bd705f7a | d8c07a404d0b4c18f8530d8efe37a05340927c4e | aydinemre/go-by-example | /03_variables/variables.go | Go | go | 723 | no_license | // In Go, variables are explicitly declared and used by the compiler to e.g. check type-correctness of function calls.
package main
import "fmt"
func main() {
// var declares 1 or more variables.
var a = "initial"
fmt.Println(a)
// You can declare multiple variables at once.
var b,c int = 1, 2
fmt.Println(b... |
f9ef79a0a565e1cd9e8bc6199237ea4027ba4ccc | e77e59ed927585b68b7005da3c6b36460701f672 | springdo/notification-go-microservice | /api/controllers.go | Go | go | 2,099 | no_license | package api
import (
"encoding/json"
"io/ioutil"
"net/http"
"redhat/notification-microservice/domain"
)
// StatusHandler will return the status of the app
func StatusHandler(w http.ResponseWriter, r *http.Request) {
RespondWithJSON(w, http.StatusOK, AppStatus{OK: true})
}
// EmailHandler used to handle emails
f... |
c09d2ab1e410b3a470175952cc298cbdf22ba12d | ac2d53c204521fb8662b11d4658a4bb7ccc9bfdc | olukas/hazelcast-go-client | /internal/set.go | Go | go | 5,810 | permissive | // Copyright (c) 2008-2018, Hazelcast, 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 a... |
921dc015f3d24ba1ea0e70f152763a68c6a84862 | 84acd513828d3e2863b8504b4af1be8973aa54de | parsnips/sniper | /main.go | Go | go | 692 | no_license | // Copyright © 2018 NAME HERE <EMAIL ADDRESS>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law ... |
82bbbc68b3995fa481211392678b3c1934a279df | efd0c01199c0c4ebb39533f41ab4535fb3d0610f | linus5/ignite | /cmd/ignite/run/rmk.go | Go | go | 1,501 | permissive | package run
import (
"fmt"
"os"
"github.com/weaveworks/ignite/pkg/metadata/loader"
"github.com/weaveworks/ignite/pkg/metadata/kernmd"
"github.com/weaveworks/ignite/pkg/metadata/vmmd"
)
type RmkFlags struct {
Force bool
}
type rmkOptions struct {
*RmkFlags
kernels []*kernmd.KernelMetadata
allVMs []*vmmd.V... |
e0e886222866c4395a55baa0ffc64f604318982d | 02d0a336e3a64601218ecb17fcb5800dfd93ba6e | nota-ja/cli | /src/cf/commands/application/app.go | Go | go | 3,863 | permissive | package application
import (
"cf/api"
"cf/command_metadata"
"cf/configuration"
"cf/errors"
"cf/formatters"
"cf/models"
"cf/requirements"
"cf/terminal"
"cf/ui_helpers"
"fmt"
"github.com/codegangsta/cli"
"strings"
)
type ShowApp struct {
ui terminal.UI
config configuration.Reader
... |
411634196d2807e2150824c810f6f284b3eab993 | c1d46ac825348f2ccdd79476ce9d50ef3f7d8f0b | cloudwan/gohan | /db/db_suite_test.go | Go | go | 793 | permissive | // Copyright (C) 2015 NTT Innovation Institute, 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 applicabl... |
fbbcaa90f40ba2ef5b2845bfd679907d781b150c | 3ecd2e55f56a8d13393aea410e06dd719dc35381 | asifdxtreme/external-dns | /provider/linode/linode.go | Go | go | 14,448 | 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, ... |
7ea3b5a1ee888c46a96d395edc4ca214d9f69d9b | bbf9918961ce28369b50c545efc102dfdc9e516e | rawkode/opentelemetry-collector | /exporter/jaeger/jaegerthrifthttpexporter/factory.go | Go | go | 2,459 | permissive | // Copyright 2019, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
19e88a06e1905bb093abd70b11baace92fbf8f2a | f6ef94d0ecaaa3f58430fd5b8f76f7ed1d2519a2 | dnote/fileutils | /main.go | Go | go | 2,394 | permissive | // Package fileutils provides functions to check and manipulate files
package fileutils
import (
"io"
"io/ioutil"
"os"
"path/filepath"
"github.com/pkg/errors"
)
// Exists checks if the file exists at the given path
func Exists(filepath string) bool {
_, err := os.Stat(filepath)
return !os.IsNotExist(err)
}
/... |
35986e2ad6275ede9e588537bb1de655cf4766d4 | 9c6947abefd5b52b88b9924ff229573c359e693b | bergwolf/kata-containers | /src/runtime/pkg/sev/ovmf.go | Go | go | 2,682 | permissive | // Copyright contributors to AMD SEV/-ES in Go
//
// SPDX-License-Identifier: Apache-2.0
package sev
import (
"bytes"
"encoding/binary"
"errors"
"os"
)
// GUID 96b582de-1fb2-45f7-baea-a366c55a082d
var ovmfTableFooterGuid = guidLE{0xde, 0x82, 0xb5, 0x96, 0xb2, 0x1f, 0xf7, 0x45, 0xba, 0xea, 0xa3, 0x66, 0xc5, 0x5a,... |
208b08347d46d929bc92451164eda39ae937fc00 | 12db128ccaedc022ad8345c7b1344619b3054e34 | jmontleon/controller | /pkg/inventory/model/client.go | Go | go | 12,312 | permissive | package model
import (
"database/sql"
"errors"
"github.com/go-logr/logr"
liberr "github.com/konveyor/controller/pkg/error"
fb "github.com/konveyor/controller/pkg/filebacked"
"os"
"sync"
"time"
)
const (
Pragma = "PRAGMA foreign_keys = ON"
)
//
// Database client.
type DB interface {
// Open and build the s... |
f494c27e946eacea9eae6eb14eb5f4cc2b968ba2 | 55e4eb91bdb5a2bfdf95d1d289841825f937f95e | jiangbing9293/wechat2 | /mp/media/client_media.go | Go | go | 3,845 | permissive | // @description wechat2 是腾讯微信公众平台 api 的 golang 语言封装
// @link https://github.com/philsong/wechat2 for the canonical source repository
// @license https://github.com/philsong/wechat2/blob/master/LICENSE
// @authors chanxuehong(chanxuehong@gmail.com)
package media
import (
"encoding/json"
"errors"
"fmt... |
205f72c6cd9bd377114fb0954a7080961853850d | 87041e3b597e736d59fdb44c61bfbf4b6ce1ed9f | foxli180/TDD_GO_Practice | /pointer/Wallet.go | Go | go | 563 | no_license | package pointer
import (
"errors"
"fmt"
)
type Bitcoin int
func (b Bitcoin) String() string {
return fmt.Sprintf("%d BTC", b)
}
type Wallet struct {
balance Bitcoin
}
func (wallet *Wallet) Deposit(amount Bitcoin) {
wallet.balance += amount
}
func (wallet *Wallet) Balance() Bitcoin {
return wallet.balance
... |
1bb230f85db62e9337e10d424243d5fed853d215 | 4895afee2ffa2c863b20f72bb86b4d802099c07f | JackTruskowski/rct | /genetic/run_experiment/main.go | Go | go | 398 | permissive | package main
import (
"flag"
"log"
"github.com/kevinburke/rct/genetic"
)
func main() {
packageRoot := flag.String("package-root", "/", "Path to the folder running github.com/kevinburke/rct (for finding commit hashes)")
flag.Parse()
if len(flag.Args()) > 0 {
log.Fatalf("Usage: genetic [-directory DIRECTORY] "... |
24115f129977931ef5d7d8fb35b3676e75c2752b | 65dab5c07ea2183a6a5cf90624bb84f75e96f524 | haoxuu/m3db | /encoding/ostream_test.go | Go | go | 2,651 | permissive | // Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
0ee6bda5bb593a67d89679470edcb2e8f0a62c12 | 9f51da6ad97b1358b2cbb59ad7454c477519614e | sdgdsffdsfff/bk-bcs | /bmsf-configuration/pkg/downloader/example/main.go | Go | go | 1,629 | permissive | /*
Tencent is pleased to support the open source community by making Blueking Container Service available.
Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of... |
72d0cb1c62649bcde0f7f1102f34a513af9df7bd | f4865bf71d13edc282981263f20741dfd428337b | dbentley/fuse | /reqs_node.go | Go | go | 5,053 | permissive | package fuse
import (
"fmt"
"time"
"unsafe"
)
// requests that operate on a non-open node: getattr, lookup, readlink
type GetattrRequest struct {
inHeader
in getattrIn
}
const getattrRequestSize = unsafe.Sizeof(GetattrRequest{})
const inHeaderSize = unsafe.Sizeof(inHeader{})
func (r *GetattrRequest) Node() N... |
5a4ef99749d194a27e7b081513b32c6c2060638d | b47563ebf6fcbfc69636e6a95789f3ddabcba4d2 | checkr/codeflow | /server/vendor/github.com/docker/docker/daemon/initlayer/setup_windows.go | Go | go | 541 | permissive | // +build windows
package initlayer
import (
"github.com/docker/docker/pkg/containerfs"
"github.com/docker/docker/pkg/idtools"
)
// Setup populates a directory with mountpoints suitable
// for bind-mounting dockerinit into the container. The mountpoint is simply an
// empty file at /.dockerinit
//
// This extra la... |
54470731133707775eac5ccc3f2a9af59a0d5bee | 9fe17a17dc2c653e050ef24b0e98746c89220bb9 | freebz/Go-Web-Programming-KR | /ch05/ex5-17.go | Go | go | 421 | no_license | // 예제 5-17. 템플릿에서 상황 인지를 위한 핸들러
package main
import (
"net/http"
"html/template"
)
func process(w http.ResponseWriter, r *http.Request) {
t, _ := template.ParseFiles("tmpl.html")
content := `I asked: <i>"What's up?"</i>`
t.Execute(w, content)
}
func main() {
server := http.Server{
Addr: "127.0.0.1:8080",
... |
88c4f4715395835b5ece56e93d2e05d51481e1e8 | b6151d67f1005bc5bb64e4a68dca880cb29a1a76 | jessesuen/argo-cd | /util/argo/normalizers/knowntypes_normalizer_test.go | Go | go | 7,310 | permissive | package normalizers
import (
"fmt"
"os"
"strings"
"testing"
"github.com/argoproj/argo-cd/v2/pkg/apis/application"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/pkg/errors"
"github.com/ghodss/yaml"
"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/apis/meta/... |
0898403464364bce35324a128c355fe42b8241c3 | 1d4277c2947f9412e4fc08ed8fc6b2030eda17f6 | benjaminhuanghuang/ben-leetcode | /1342_Number_of_Steps_to_Reduce_a_Number_to_Zero/solution.go | Go | go | 224 | no_license | /*
1342. Number of Steps to Reduce a Number to Zero
Level: Easy
https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero
*/
package leetcode1342
/*
Solution:
*/
func numberOfSteps (num int) int {
}
|
f4bffb69cf3d653b3278e6b662414a6d4aad33e9 | c41c7be315d2c7fc7138866946abd107c417af10 | mihaijust/backup | /miner/mineReqCtrl_test.go | Go | go | 3,592 | permissive | package miner
import (
"github.com/MatrixAINetwork/go-matrix/common"
"github.com/MatrixAINetwork/go-matrix/core/types"
"github.com/MatrixAINetwork/go-matrix/mc"
"math/big"
"testing"
)
func TestUinit1(t *testing.T) {
//初始化是否正常
tempHeader := &types.Header{
Number: big.NewInt(100),
}
reqCtrl := newMineReqData... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.