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 |
|---|---|---|---|---|---|---|---|---|
949475e6aa789e0b9e316a8a362f8dc93d871b37 | b6d503475c6f107c029ec0c5d6159c5ba2b5752f | acoshift/httpserver | /logger.go | Go | go | 871 | no_license | package main
import (
"log"
"net"
"net/http"
)
func logger(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
nw := &logResponseWriter{
ResponseWriter: w,
}
remoteHost, _, _ := net.SplitHostPort(r.RemoteAddr)
if remoteHost == "" {
remoteHost = r.Re... |
69665fcc2d66cae7346b6f51aecd6a6a0c58c8d3 | 399bd98cd7ce7e98bcf0e8251e8f8a2b8174c3d3 | zeta1999/mint | /syntax/encode_test.go | Go | go | 1,003 | permissive | package syntax
import (
"testing"
)
func TestEncodeErrors(t *testing.T) {
errorCases := map[string]interface{}{
"unsupported": float64(0),
"varint-too-big": struct {
V uint64 `tls:"varint"`
}{V: uint64(1) << 63},
"no-head": struct {
V []byte
}{V: buffer(0x20)},
"head-too-short": struct {
V [... |
6336e26228dbff3d53244327df0ebfb388389691 | cb5b3ec1e875ad3c9acace91791960723b4d15b1 | faddat/teleport | /lib/auth/permissions.go | Go | go | 8,328 | permissive | /*
Copyright 2015 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... |
2c66bffa89c798f6c4d475dfccc7627e9b1a1a57 | 2ab46098bc164c2f56345c71bfac923c99b43b80 | googlecorporation/tsuru-admin | /vendor/github.com/tsuru/tsuru/provision/provision.go | Go | go | 13,486 | permissive | // Copyright 2016 tsuru 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 provision provides interfaces that need to be satisfied in order to
// implement a new provisioner on tsuru.
package provision
import (
"encoding/js... |
2771654640ace3d01eef27dfe4a899be9d33bb0b | 3723c031c1194ccc0a7c00c141a072feceedf307 | dspking111/openshifit-origin | /Godeps/_workspace/src/github.com/google/cadvisor/storage/influxdb/influxdb.go | Go | go | 6,607 | 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... |
1c52eb53ea5fae5bfdaf3e6399ac34942b1c877b | 65f86fb1aabf7d6470aaa4476e0fb8055f19fe0e | dongnanpro/GO-MATRIX | /blkgenor/types.go | Go | go | 2,148 | permissive | // Copyright (c) 2018 The MATRIX Authors
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php
package blkgenor
import (
"errors"
"math/big"
"github.com/matrix/go-matrix/accounts/signhelper"
"github.com/matrix/go-matrix/baseinterf... |
ad80340ab868c08594d9300a77f45e33f0d874db | 039223d9dccadd91c6571965f97436faf4bc532d | pedrosland/contrib | /cluster-autoscaler/cloudprovider/gce/gce_cloud_provider.go | Go | go | 6,562 | 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, ... |
af9a39ac7c7ddfbe282e975a429eef2f6174ad26 | bb4a67beb83606fc092dd1fb8b095156066a79ae | cmaf/runtime | /virtcontainers/vhostuser_endpoint.go | Go | go | 5,041 | permissive | // Copyright (c) 2018 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package virtcontainers
import (
"encoding/hex"
"fmt"
"os"
"github.com/kata-containers/runtime/virtcontainers/device/config"
persistapi "github.com/kata-containers/runtime/virtcontainers/persist/api"
"github.com/kata-containers... |
2b6e360ab8c4e861a9ef51f11cfab62370b6f005 | 3666293ebc4b7f81e97247375c11403311865a55 | qtabot/cqlc | /generator/generator.go | Go | go | 3,183 | permissive | package generator
import (
"bytes"
"errors"
"go/format"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
)
var (
ErrInvalidOptions = errors.New("invalid options")
)
type Options struct {
Instance string `short:"i" long:"instance" description:"The Cassandra instance to connect to"`
Keyspace string `... |
e8251be5b4858a44bda0d8b2b4f732833a6e5ae3 | 6ef926f765f0289f26a628647aed5a398a714a90 | jayhill365/amazon-ssm-agent | /agent/framework/processor/executer/outofproc/master_test.go | Go | go | 11,772 | permissive | package outofproc
import (
"testing"
"time"
"github.com/aws/amazon-ssm-agent/agent/context"
"github.com/aws/amazon-ssm-agent/agent/contracts"
executermocks "github.com/aws/amazon-ssm-agent/agent/framework/processor/executer/mock"
procmock "github.com/aws/amazon-ssm-agent/agent/framework/processor/executer/outof... |
c54c41cc8330a82ab95b5fab2a9de285bd8cbe04 | a1ab34c7a6f6d788671fd8a5766c3efdcfdb1de9 | qamarian-lib/newton | /initReport_test.go | Go | go | 286 | permissive | package newton
import (
"fmt"
"gopkg.in/qamarian-lib/str.v3"
"testing"
)
func TestInitReport (t *testing.T) {
str.PrintEtr ("Test started...", "std", "TestInitReport ()")
fmt.Println ("Init report:", InitReport ())
str.PrintEtr ("Test failed!", "std", "TestInitReport ()")
}
|
d3d4aac1efe47250f7fcc396859a7967e6ef05a1 | 579483a0c1cc39a1a4c3f2cfdec2de5dfbcd2681 | dfc-cash/dfc-api | /services/horizon/internal/httpx/request.go | Go | go | 1,277 | permissive | package httpx
import (
"context"
"net/http"
horizonContext "github.com/dfc/go/services/horizon/internal/context"
"github.com/dfc/go/support/log"
)
func RequestFromContext(ctx context.Context) *http.Request {
found := ctx.Value(&horizonContext.RequestContextKey)
if found == nil {
return nil
}
return found... |
33c8f6cc4144fee417ce51c16d73138fa3572116 | 25e072cb98e8ae3a718e7733647dffa7adae7beb | zhaoning1987/milvus | /internal/querynode/query_node_test.go | Go | go | 6,261 | permissive | // Copyright (C) 2019-2020 Zilliz. 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 l... |
6dbabc4434ee3a70665d228355e2494346dee993 | 3eb71c083aff6feccc6953051e7c0d1a775bd862 | awsassets/keyserver | /logger/logger.go | Go | go | 1,185 | permissive | package logger
import (
"os"
"github.com/op/go-logging"
)
// Logging for keyserver:
// - Generic requests = Info
// - Active key response = Notice
// - Key active/inactive change = Notice
// - Inactive key response = Warn
var Log = logging.MustGetLogger("keyserver")
// Init sets up the logger
func Init()... |
09652a04a727521ca5a279dbff963524b5018d33 | 7e5bae30322b7a20f091f2eb9efbdbc41456d280 | BoseCorp/pulsar-client-go | /pulsar/internal/rpc_client.go | Go | go | 3,806 | permissive | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
d11fc47c91555e7746fe373eb79e706c5c3481b6 | 7e3538cac4b8b94dc64de5b3558e7dc524b8bd5b | Momo733/LeetCode-in-Go | /Algorithms/0002.add-two-numbers/add-two-numbers.go | Go | go | 1,079 | permissive | package problem0002
// ListNode defines for singly-linked list.
// type ListNode struct {
// Val int
// Next *ListNode
// }
type ListNode struct {
Val int
Next *ListNode
}
func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode {
result := &ListNode{}
temp := result
v, n := 0, 0
for {
// 在当前位上进... |
3fd30c5f04613355b47bfd1a7d51712e515f3718 | 66b377823ad6399dee17f69352067bbc0a9a9d24 | wizizm/cache2mysql | /service/user_service.go | Go | go | 258 | no_license | package service
import (
"cache2mysql/models"
"fmt"
)
func CreateUser() error {
_, err := models.CreateUser("user1", "user@qq.com")
return err
}
func GetUserForMysql() models.User {
user := models.GetUser(1)
fmt.Printf("%#v", *user)
return *user
}
|
6d328fd7543919075efaa412012459fa103879ec | 7af494590b52761eb0a0195d875b13682506f849 | JimLynchCodes/Fun-With-Go-Types-Repl.it | /other-file.go | Go | go | 443 | no_license | package main
import (
"fmt"
)
// Take note at what a beautiful
func (person Person) Wave() string {
return fmt.Sprintf("%s is waving at you!", person.FirstName)
}
// Lowercase functions are only hidden from OTHER PACKAGES but are still callable from anywhere withing the current package.
func (person Person) pri... |
989b8b0d52a7b2fb1dbdc4b09384e512d125906d | 53e08e07e6f2c758573af4b280331f0ae859c17b | TOUCH40/go-learn | /99_my-exercise/3.go | Go | go | 973 | no_license | package main
import (
"fmt"
"strings"
)
var PI float32 = 3.14
type Shape interface {
Perimeter() float32
Area() float32
}
type Circle struct {
// radius float32
Diameter float32
}
func (c *Circle) SetDiameter(v float32) {
c.Diameter = v
}
func (c *Circle) Perimeter() float32 {
return 2 * (c.Diameter / 2) ... |
f590e2ba97d65c3933c5c6ba8684e923becef825 | 5bdb032274cdf94a544b63bc4db9a1ea72a92989 | Anukriti2512/meshery | /mesheryctl/internal/cli/root/system/check.go | Go | go | 5,674 | permissive | package system
import (
"context"
"os/exec"
"runtime"
"github.com/pkg/errors"
"github.com/layer5io/meshery/mesheryctl/internal/cli/root/config"
"github.com/layer5io/meshery/mesheryctl/pkg/utils"
meshkitkube "github.com/layer5io/meshkit/utils/kubernetes"
log "github.com/sirupsen/logrus"
v1 "k8s.io/apimachine... |
f31729c47613416750b40216c63a0af13e70b04c | ad7be61af0a3d7ae6f64cce62f226124b6d1e96d | LordRalex/absol | /modules/factoids/factoids.go | Go | go | 4,969 | permissive | package factoids
import (
"fmt"
"github.com/bwmarrin/discordgo"
"github.com/lordralex/absol/api"
"github.com/lordralex/absol/api/database"
"github.com/lordralex/absol/api/env"
"github.com/lordralex/absol/api/logger"
"gorm.io/gorm"
"strings"
"time"
)
type Module struct {
api.Module
}
func (*Module) Load(ds ... |
fdfce25fcadafbddeceb59d8cf16ca1902cb45d7 | 7f974d6aafda8ebc76f2e60021497642e773f1f0 | tianhucn/gf | /.example/os/gview/layout/layout2/main.go | Go | go | 466 | permissive | package main
import (
"github.com/dxasu/gf/frame/g"
"github.com/dxasu/gf/net/ghttp"
)
func main() {
s := g.Server()
s.BindHandler("/main1", func(r *ghttp.Request) {
r.Response.WriteTpl("layout.html", g.Map{
"name": "smith",
"mainTpl": "main/main1.html",
})
})
s.BindHandler("/main2", func(r *ghttp.R... |
241af692fc412d19a50f74a9e47274affb76b455 | 7c39501ed120b0caa8e8125fcbd17f51664667b2 | digideskweb/bosh-softlayer-cpi | /Godeps/_workspace/src/github.com/maximilien/softlayer-go/client/softlayer_client.go | Go | go | 9,807 | permissive | package client
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/http/httputil"
"os"
"path/filepath"
"text/template"
"regexp"
services "github.com/maximilien/softlayer-go/services"
softlayer "github.com/maximilien/softlayer-go/softlayer"
)
const (
SOFTLAYER_API_URL = "api.sof... |
0d1e6cb17314c940c1da5dc50ce819310e9ba062 | 5c7ae6c76abb6e3ea62b21c8d069609c611e7144 | xlango/golang-practice | /dgraphtest/main.go | Go | go | 3,003 | no_license | package main
import (
"context"
"flag"
"fmt"
dgo "github.com/dgraph-io/dgo/v2"
api "github.com/dgraph-io/dgo/v2/protos/api"
"google.golang.org/grpc"
"log"
)
type Person struct{
Uid string `json:"uid,omitempty"`
Name string `json:"name,omitempty"`
From string `json:"from,omitempty"`
NameOFcn string `jso... |
f67294bd4af80225c72dd63b1d3731271a8f0247 | 5299453243ec612e6149b6ca8af7fd74ae0d9cc6 | songguang/ironcli | /vendored/github.com/iron-io/iron_go/examples/tasks/queue/main.go | Go | go | 2,303 | no_license | /*
This code sample demonstrates how to queue a worker from your your existing
task list.
http://dev.iron.io/worker/reference/api/
http://dev.iron.io/worker/reference/api/#queue_a_task
*/
package main
import (
"bytes"
"encoding/json"
"fmt"
"github.com/iron-io/ironcli/vendored/github.com/iron-io/iron_go/api"
... |
1f5fcfcbe1bb6feb9b676cb0893fa92c50fef136 | 31ba4c021606ad09b3fb15855a92bf8d9b92142b | FRINXio/magma | /symphony/graph/ent/equipmentporttype_update.go | Go | go | 21,859 | permissive | // Copyright (c) 2004-present Facebook All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated (@generated) by entc, DO NOT EDIT.
package ent
import (
"context"
"strconv"
"time"
"github.com/facebookincubator/ent/dialect/sql"
... |
1acb5deccbc8836d51954673d2e8feec5e0f2f92 | a3b2d69d98150ef23c885ceab2dabbeb25e698d6 | ThreeTigersLin/singularity | /cmd/starter/rpc.go | Go | go | 737 | permissive | // Copyright (c) 2018, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE.md file distributed with the sources of this project regarding your
// rights to use or distribute this software.
package main
import (
"net"
"os"
"github.com/sylabs/sin... |
fe99851adffbdd6a41972093b695524166e0aa13 | f5d8c97390625fb7e1d461bf8eabb45624a68e1a | yaltachen/crawler | /crawler/fetcher/fetcher.go | Go | go | 1,784 | no_license | package fetcher
import (
"bufio"
"io/ioutil"
"log"
"net/http"
"golang.org/x/net/html/charset"
"golang.org/x/text/encoding"
"golang.org/x/text/encoding/unicode"
"golang.org/x/text/transform"
)
// Fetch 获取网页
func Fetch(url string) ([]byte, error) {
var (
client *http.Client
req *http.Request
resp ... |
6361041444e386dc9ff5249d756f7c4d043b38a1 | 2cd36cfab3e42b25dcbb855b5c8c0922b781ac33 | Obirvalger/distrobuilder | /managers/apt.go | Go | go | 3,460 | permissive | package managers
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
lxd "github.com/lxc/lxd/shared"
"github.com/pkg/errors"
"github.com/lxc/distrobuilder/shared"
)
type apt struct {
common
}
func (m *apt) load() error {
m.commands = managerCommands{
clean: "apt-get",
install: ... |
116e145f538965f4915bee6936953f8013ae32d1 | f6bbf7d7994f10c75cb4ae4a19e0c2e90e612402 | ojukwu24/pdanalytics | /postgres/propagation.go | Go | go | 31,460 | permissive | package postgres
import (
"context"
"database/sql"
"fmt"
"math"
"strconv"
"strings"
"time"
"github.com/planetdecred/pdanalytics/chart"
"github.com/planetdecred/pdanalytics/dbhelper"
"github.com/planetdecred/pdanalytics/postgres/models"
"github.com/planetdecred/pdanalytics/propagation"
"github.com/volatile... |
83528260c703598eefa54e847a40d7fbe01aff9f | 33fc6e435ca7ecbaf72481fe0d3bab48f53ff8d9 | isgasho/rnm | /path_globber.go | Go | go | 1,167 | permissive | package main
import "github.com/go-git/go-billy/v5"
type pathGlobber struct {
repositoryPathFinder *repositoryPathFinder
fileSystem billy.Filesystem
}
func newPathGlobber(f *repositoryPathFinder, fs billy.Filesystem) *pathGlobber {
return &pathGlobber{f, fs}
}
func (g *pathGlobber) Glob(d string) ([]st... |
c57599937ef4cdacb7d1f201f4e134c18bcaadfa | de5a1baca4219cce7e5330bb94eb499f8bffa86a | adymitruk/gitea | /routers/user/setting.go | Go | go | 20,636 | permissive | // Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package user
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"strings"
"github.com/Unknwon/com"
"github.com/pquerna/otp"
"github.com/pquerna/otp/totp"
... |
8144d029ba4c687f13baab005f990da5e1c4d0ca | 33e0c4c7941201c77047b727b9f64274bc405bc3 | henriqueholanda/photoprism | /internal/entity/photo_album_test.go | Go | go | 921 | permissive | package entity
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewPhotoAlbum(t *testing.T) {
t.Run("new album", func(t *testing.T) {
m := NewPhotoAlbum("ABC", "EFG")
assert.Equal(t, "ABC", m.PhotoUID)
assert.Equal(t, "EFG", m.AlbumUID)
})
}
func TestPhotoAlbum_TableName(t *testing.T) {
... |
5e170875cfa2f1c69000f3f5b1ad726f9b732ba3 | 520b36054bb4d0548ee0d596c5e8522014d80763 | shaneutt/octant | /pkg/view/component/single_stat.go | Go | go | 992 | permissive | /*
* Copyright (c) 2019 VMware, Inc. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package component
import "github.com/vmware-tanzu/octant/internal/util/json"
type SingleStatValue struct {
Text string `json:"text"`
Color string `json:"color"`
}
type SingleStatConfig struct {
Title string ... |
b1a880e528f32b0903b08e1e89dfe0b4de6cbdf8 | 1fe63e43cc82d2a65e494b356eee97e9026a83c8 | Akarshit/sourcegraph | /enterprise/internal/a8n/resolvers/changesets.go | Go | go | 9,346 | permissive | package resolvers
import (
"context"
"database/sql"
"errors"
"fmt"
"sort"
"sync"
"github.com/graph-gophers/graphql-go"
"github.com/graph-gophers/graphql-go/relay"
"github.com/sourcegraph/sourcegraph/cmd/frontend/backend"
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
"github.com/sourcegra... |
5432b7db37268ae9aa977587f219d994f74bbc8b | 3d8f64dae6756507191c3d372cf3d7557b442288 | fzipi/pomerium | /internal/config/options.go | Go | go | 14,529 | permissive | package config // import "github.com/pomerium/pomerium/internal/config"
import (
"encoding/base64"
"errors"
"fmt"
"net/url"
"path/filepath"
"reflect"
"strconv"
"strings"
"time"
"github.com/pomerium/pomerium/internal/cryptutil"
"github.com/pomerium/pomerium/internal/fileutil"
"github.com/pomerium/pomerium/... |
1ecbb4aa08d8465cec36509cd47d1a9d0ebb8fff | 27cdcdbec3278fbfca15ebf411b16f066da0f1f4 | df010/ondemand-service-adapter | /adapter/adapter.go | Go | go | 399 | no_license | package adapter
import (
"log"
"github.com/df010/ondemand-service-adapter/config"
"github.com/pivotal-cf/on-demand-services-sdk/serviceadapter"
)
type ManifestGenerator struct {
StderrLogger *log.Logger
config config.Config
}
type Binder struct {
StderrLogger *log.Logger
config config.Config
}
v... |
61d6cf3156c577f42fa6bd09abb4fbfd41a9872b | 0ba61004130da2bb28bf414d380d18a1fd9025c9 | zengy927/GoEx | /okcoin/OKEx_Future_Ws_test.go | Go | go | 667 | no_license | package okcoin
import (
"github.com/wudian/GoEx"
"testing"
"time"
)
func TestNewOKExFutureWs(t *testing.T) {
okWs := NewOKExFutureWs()
okWs.ErrorHandleFunc(func(err error) {
t.Log(err)
})
okWs.SetCallbacks(func(ticker *goex.FutureTicker) {
t.Log(ticker, ticker.Ticker)
}, func(depth *goex.Depth) {
t.Log(... |
151af90f238c86c62aa59174a84b58fc76cf8cd6 | b24fb2057e327f0c35875dac5a4f247ccebb05eb | timn/cel-go | /parser/parser_test.go | Go | go | 23,313 | permissive | // Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
ddae96a8b897ce6fe37fa9f79ae8774ee4e3fad3 | 893605c1766a1dce482efe435706d1aac0a226a3 | freddierice/lht | /cmd/project.go | Go | go | 492 | no_license | package cmd
import "github.com/spf13/cobra"
// projectCmd represents the project command
var projectCmd = &cobra.Command{
Use: "project",
Short: "A set of subcommands that deal with manipulating projects",
Long: `Project is a set of subcommands that deal with manipulating projects. The
'add' function creates a n... |
7aa453eff445eff94b7755a9c2a44f1140802e65 | ea03f3192bc1dc2daa0ef7014ef2c2330719cc57 | rubik-ai/benthos | /lib/processor/decompress.go | Go | go | 5,104 | permissive | package processor
import (
"bytes"
"compress/bzip2"
"compress/flate"
"compress/gzip"
"compress/zlib"
"fmt"
"io"
"time"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/response"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/Jef... |
9242313914f7664e9bbfdc2fe308892106c6a39c | b6004c2662b458277c44a54a67124894b40c3e2e | tmax-cloud/l2c-operator | /pkg/apis/tmax/v1/tupdb_types.go | Go | go | 2,970 | permissive | package v1
import (
"github.com/operator-framework/operator-sdk/pkg/status"
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.
// TupDBSpec defines the ... |
d584a91b6aa391c98c33c65e1d3e31f85ce8159d | 10efda29245a42cd8459b34465bb3cc9e50792e5 | JacobJohansen/chezmoi | /internal/cmd/dataformat.go | Go | go | 1,641 | permissive | package cmd
import (
"errors"
"strings"
)
// A readDataFormat is a format that chezmoi uses for reading (JSON, TOML, or
// YAML) and implements the github.com/spf13/pflag.Value interface.
type readDataFormat string
// A writeDataFormat is format that chezmoi uses for writing (JSON or YAML) and
// implements the gi... |
f9450648d735f1553df3a7be55375e49eecaac91 | f844356e19faa2740473e1fdbec1f3b9b785ca5d | dalmarcogd/twitter-reporter | /twitter-reporter-processor/services/twitter/tweets.go | Go | go | 1,141 | permissive | package twitter
import (
"context"
"fmt"
"github.com/dalmarcogd/twitter-reporter/twitter-reporter-processor/utils"
"go.elastic.co/apm/module/apmhttp"
"io/ioutil"
"net/http"
"strings"
)
func GetTweetsByHashtag(ctx context.Context, hashtag string) ([]interface{}, error) {
req, err := http.NewRequest(http.Method... |
c82b59799390ce588452e170febb62d93a5d3796 | 470096b13efe16e582d644cd1ee402e2a27f9c77 | leevydanomalik/server | /router/router.go | Go | go | 4,782 | permissive | package router
import (
"time"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/gotify/location"
"github.com/gotify/server/api"
"github.com/gotify/server/api/stream"
"github.com/gotify/server/auth"
"github.com/gotify/server/config"
"github.com/gotify/server/database"
"github.com/gotify/s... |
bd1a011b6c7c6b6dbdae5dc9f9e11fb7e6af1650 | 1b75f67c8b32879ccc44840e1564ed5070ffb4bb | CBurton90/delta | /tools/impact/blessed.go | Go | go | 1,114 | permissive | package main
// list sensors that can be used
var blessedSensorList = []string{
"FBA-ES-T",
"FBA-ES-T-ISO",
"FBA-ES-T-BASALT",
"FBA-ES-T-OBSIDIAN",
"FBA-ES-T-ETNA-2",
"CUSP3C",
"CUSP3D",
"CMG-3ESP",
"CMG-3ESPC",
"CMG-3TB",
"CMG-3TB-GN",
"STS-2",
"Trillium 120QA",
"Trillium Compact 120PH-2",
"L4C-3D",
"... |
a4f5d3c0a6d9594c94b64bebd857eda12afbae07 | dc42335a20fc2e1bfb66000ffab883364a8333ff | jpicht/metrics | /sink/influx/sink.go | Go | go | 1,713 | no_license | package influx
import (
"bytes"
"net/http"
"net/url"
"os"
"time"
"github.com/jpicht/metrics"
"github.com/jpicht/metrics/types"
)
var (
// HTTPClient is the http.Client instance used to post the data to the influx server
HTTPClient = &http.Client{
Timeout: 5 * time.Second,
}
)
type (
// Sink implements ... |
8a50ea5f34e628499e279bbee013c7429ed30c16 | 6f0f46831dc614efec9f912b293aeb6c65b0e67c | alasher/d2reel | /parser/parser.go | Go | go | 1,312 | no_license | package parser
import (
"fmt"
"time"
"github.com/dotabuff/yasha"
)
const DEMO_PATH string = "/Users/austin/Developer/Go/src/github.com/alasher/d2reel/replays"
func Parse(ids []string) {
fmt.Printf("Match ids are: %v\n", ids)
for _, id := range ids {
path := DEMO_PATH + "/" + id + ".dem"
fmt.Printf("p... |
4d295caf12ab971ddddb34d8b75d977b6da89b59 | 0d24813c42119b1b5e2544f0b60aef088f25f59a | cstewart-pivotal/gcp-service-broker | /vendor/cloud.google.com/go/bigquery/integration_test.go | Go | go | 21,656 | permissive | // Copyright 2015 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 applicabl... |
c211c8a70b320490628837f61bd7727ef18ce385 | 2e72e7348564b283e47d12b69c85bff04cec5a99 | jayvansantos/chihaya | /server/query.go | Go | go | 1,973 | permissive | // Copyright 2013 The Chihaya Authors. All rights reserved.
// Use of this source code is governed by the BSD 2-Clause license,
// which can be found in the LICENSE file.
package server
import (
"errors"
"net/url"
"strconv"
)
// parsedQuery represents a parsed URL.Query.
type parsedQuery struct {
Infohashes []st... |
2948fad93d4487d7308979b0f7a6b681703431f6 | 2f0b9497cc48f0fdc0a9da6cd6158eb7d16f02bd | yext/vitess | /go/vt/vttablet/tabletserver/query_engine_test.go | Go | go | 10,755 | 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... |
a87793826dd73c97e9a89b618831285ef59c6cc7 | 0d561bd166b96a251805d68ba1130a524dbf9d48 | lyft/tilt | /internal/build/docker_benchmark_test.go | Go | go | 1,988 | permissive | //+build !skipcontainertests
package build
import (
"fmt"
"strings"
"testing"
"github.com/windmilleng/tilt/internal/model"
)
func BenchmarkBuildTenRuns(b *testing.B) {
run := func() {
f := newDockerBuildFixture(b)
defer f.teardown()
cmds := []model.Cmd{}
for i := 0; i < 10; i++ {
cmds = append(cmds... |
c6ab56bf2519aa5875db2bbe3774815fb307c537 | c842552d3c58733bdd551a083408fe0157fdde60 | gattie/sensu-go | /agent/check_handler_env_test_windows.go | Go | go | 852 | permissive | // +build windows
package agent
import (
"encoding/json"
"testing"
"time"
"github.com/sensu/sensu-go/transport"
"github.com/sensu/sensu-go/types"
"github.com/stretchr/testify/assert"
)
func TestEnvVars(t *testing.T) {
checkConfig := types.FixtureCheckConfig("check")
checkConfig.EnvVars = []string{"FOO=BAR"}... |
c110ba53184457f258bbac26bf867b88cf340443 | c61456f86b78729680a3f49f73d7fb86d056a868 | mna/exp | /juggler/server_test.go | Go | go | 3,461 | no_license | package juggler_test
import (
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"golang.org/x/net/context"
"github.com/PuerkitoBio/exp/juggler"
"github.com/PuerkitoBio/exp/juggler/broker/redisbroker"
"github.com/PuerkitoBio/exp/juggler/client"
"github.com/PuerkitoBio/exp/juggler/intern... |
c40f7699661585e18bd8545e73b3c7165397d4fd | 7a34d7a53d9c70a08b04034ca63e65e02ba6d43b | openshift/assisted-service | /vendor/github.com/openshift-online/ocm-sdk-go/retry/transport_wrapper.go | Go | go | 9,072 | permissive | /*
Copyright (c) 2021 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... |
64d641ecfe8f3565e7df8ddf5589bf904653efdf | 825a132c4b7095340d5651a3257d622a61916314 | yanghongkjxy/tsuru | /vendor/github.com/docker/machine/drivers/azure/util.go | Go | go | 7,371 | permissive | package azure
import (
"fmt"
"io/ioutil"
"net"
"net/url"
"strings"
"github.com/Azure/azure-sdk-for-go/arm/network"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/to"
"github.com/docker/machine/drivers/azure/azureutil"
"github.com/docker/machine/drivers/azure/logutil"
"... |
e9c2caaa7fad217ef5564b5b392e1e5874dcec78 | 8b43902353c02a7c88fa68542a26f885eef14d91 | agonzalezro/kubernetes | /pkg/kubectl/cmd/set/set_image.go | Go | go | 9,177 | 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, ... |
e9e49edc74a7a00e3ec404eb0968cfcb387631f9 | 079eea7f98da2068eb279ddb36868a56c11d3a9f | tilalis/foney.go | /interpreter/tokens.go | Go | go | 895 | no_license | package interpreter
import "fmt"
// TokenType type
type TokenType int
// Token Types
const (
NUMBER TokenType = iota
MONEY TokenType = iota
PLUS TokenType = iota
MINUS TokenType = iota
MUL TokenType = iota
DIV TokenType = iota
LPAREN TokenType = iota
RPAREN TokenType = iota
SYMBOL TokenType = iota
... |
1973923cd39b7ee79d916635bc25ceecfdc00272 | 7f6309bc75a57264a925da646ae4c93805e65593 | d4rkdu0/owlcache | /job/job.go | Go | go | 844 | permissive | package job
import (
"fmt"
"time"
owlnetwork "github.com/xssed/owlcache/network"
owllog "github.com/xssed/owlcache/log"
)
func JobInit() {
fmt.Println("owlcache Job running...")
//数据备份
DataBackup()
//清理过期的数据
ClearExpireData()
}
//数据备份
func DataBackup() {
ticker := time.NewTicker(time.Minute * 1)
go fu... |
6fa9f74ce58b4140f9775d9552f8edf68650402b | b61ac12eaba3d099e9d9f2f958ff887989d04a87 | eliben/gocdkx | /pubsub/awssnssqs/awssnssqs.go | Go | go | 20,895 | permissive | // Copyright 2018 The Go Cloud Development Kit 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appli... |
f8cec59f5225f0fae06fa1a8052e56778ac54ce7 | bd62e1c3efc306b53a47ca6c3c155fa7b0d14914 | imdar1/draw | /docs/package.go | Go | go | 5,615 | permissive | package docs
import (
"bufio"
"bytes"
"os"
"github.com/gregoryv/draw/design"
"github.com/gregoryv/draw/shape"
. "github.com/gregoryv/web"
"github.com/gregoryv/web/toc"
)
func NewProjectsPage() *Page {
page := NewPage(Html(
Head(
Meta(Charset("utf-8")),
Meta(Name("viewport"), Content("width=device-wid... |
26eceb83cc766387e959c63349fcb380f7e45096 | bed601977c42febd1ca00b574f7f2c73a1d887b5 | beatlabs/patron | /vendor/github.com/elastic/go-elasticsearch/v8/typedapi/security/getrole/response.go | Go | go | 1,431 | permissive | // Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
3c3ba1854eeb40ab7d65db25a4b659521df09c09 | 53a31be65ffd40e779abfb1bf0f1db975f261991 | githomework/snippets-techniques | /postgres-copy.go | Go | go | 822 | permissive | import (
"database/sql"
"github.com/lib/pq"
)
_, err := db.Exec("set search_path to xxxx")
if err != nil {
log.Panicln(err)
}
txn, err := db.Begin()
if err != nil {
log.Panicln(err)
}
defer txn.Commit()
statement, err := txn.Prepare(pq.CopyIn("products", "product", "uuid", "product_long", "descr... |
0c1a15c99a8cb3eec3fc426f2892bf082f9107a5 | 7e3e4119ed9371e1449e7d5b2c73f2bfebf1b1e6 | dbrain/soggy | /htmltemplateengine.go | Go | go | 329 | no_license | package soggy
import (
"html/template"
"io"
)
type HTMLTemplateEngine struct {
}
func (engine *HTMLTemplateEngine) SoggyEngine(writer io.Writer, filename string, options interface{}) error {
template, err := template.ParseFiles(filename)
if err != nil {
return err
}
return template.Execute(writer, op... |
3f0c438673cf052fe65e393d61f11868c64892da | 85b8087fef5ad1eb7cc131b3f8ae98c1eb413865 | getgauge/gauge | /reporter/simpleConsole_test.go | Go | go | 14,207 | permissive | /*----------------------------------------------------------------
* Copyright (c) ThoughtWorks, Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE in the project root for license information.
*----------------------------------------------------------------*/
package reporter
import (
"fmt"
... |
cd94267f01970548c4fd7fd4abbc6f39ded7d163 | e895b0b4681a1a2a5b8378386d55c8f627da1c01 | MakeLove69/emoji-compress | /dictionary/decompress.go | Go | go | 804 | permissive | package dictionary
//DecompressString is an overload for Decompress.
func DecompressString(dict map[string]string, archive string) (string, error) {
return Decompress(&Result{
Words: dict,
Archive: archive,
})
}
//Decompress reverse an encoded/compressed emoji text to the original form,
//using the provided d... |
61c9492ab75d3d00bf0d1ae7962aa72f7ae41eca | 98fcb9bb9e4e660fad4243c3711da51faf7e258e | todbachman-wf/frugal | /examples/go/gen-go/v1/music/f_albumwinners_scope.go | Go | go | 12,157 | permissive | // Autogenerated by Frugal Compiler (3.4.12)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
package music
import (
"fmt"
"git.apache.org/thrift.git/lib/go/thrift"
"github.com/Workiva/frugal/lib/go"
)
const delimiter = "."
// Scopes are a Frugal extension to the IDL for declaring PubSub
// s... |
e359e59742c5f0aa98782996ee85ffcd6a4b3788 | 853abef6c36f8d210c0528461d620cd1905bd21e | andrei-x1/elastic-indexer-go | /workItems/workItemRemoveBlock_test.go | Go | go | 1,764 | no_license | package workItems_test
import (
"errors"
"testing"
"github.com/ElrondNetwork/elastic-indexer-go/mock"
"github.com/ElrondNetwork/elastic-indexer-go/workItems"
"github.com/ElrondNetwork/elrond-go-core/data"
dataBlock "github.com/ElrondNetwork/elrond-go-core/data/block"
"github.com/stretchr/testify/require"
)
fu... |
0714c397795626093baff0aaf2d40e93d26f2212 | d78b0b2d39b26150f96658311a14ceb2ab786f20 | cloudflare/go | /src/runtime/align_runtime_test.go | Go | go | 1,867 | permissive | // Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file lives in the runtime package
// so we can get access to the runtime guts.
// The rest of the implementation of this test is in align_test.go.
pack... |
5068967b4aee268ca0682d9a004528e3625132cc | dd8b8e815b8d43e56c7a9df8e1260f623bf6af71 | wuyazero/Elastos.ELA | /bloom/merklebranch_test.go | Go | go | 2,420 | permissive | package bloom
import (
"crypto/rand"
"fmt"
"os"
"testing"
"github.com/wuyazero/Elastos.ELA.Utility/common"
"github.com/wuyazero/Elastos.ELA.Utility/p2p/msg"
"github.com/wuyazero/Elastos.ELA/auxpow"
"github.com/wuyazero/Elastos.ELA/core"
)
func TestMerkleBlock_GetTxMerkleBranch(t *testing.T) {
for txs := uin... |
cc5b2a6bd01071f580eccdca025dc90e3f3c324c | bb423c75207d62a1597cf71155b76c572f0530f4 | agoric-labs/cosmos-sdk | /x/staking/legacy/v036/types.go | Go | go | 5,888 | permissive | // Package v036 is used for legacy migration scripts. Actual migration scripts
// for v036 have been removed, but the v039->v042 migration script still
// references types from this file, so we're keeping it for now.
// DONTCOVER
package v036
import (
"time"
"github.com/cosmos/cosmos-sdk/codec/legacy"
cryptotypes ... |
35cf0f3331b898b87473722de5dbdce29e9dc39e | 2ba681770b1390fc96af1646649fcd18103936bd | wblakecaldwell/hardware-projects | /garage-door/raspberry-pi/monitoring-service/main.go | Go | go | 3,091 | no_license | package main
import (
"flag"
"fmt"
"net/http"
"os"
"time"
)
var (
flagUpdateURL string // url to send status to
flagListenHostPort string // host:port to listen on
)
func init() {
flag.StringVar(&flagUpdateURL, "update-url", "", "Url to upload status to")
flag.StringVar(&flagListenHostPort, "listen", "... |
1bd231a74a0ac9e02912539c3b2767176cb4586d | edea232275295a6cc53368750a8e24c5737da046 | stuartherbert/go_modlog | /defaultlogger.go | Go | go | 5,165 | permissive | // Copyright (c) 2014-present Stuart Herbert
// Released under the 3-clause BSD license
package modlog
import (
"fmt"
"io"
"log"
"os"
"github.com/stuartherbert/go_extras/extrafmt"
)
// if the user just wants to use us as a drop-in replacement for the stdlib's
// log package, everything will go through our defau... |
2644a26f410b9ca2135ed87fcbe88c973ff8d85b | c2f9c52e141f3c1e6e8889cd93c7a0835b70591d | jesusreal/test-infra | /development/tools/jobs/kyma/api_controller_acceptance_tests_test.go | Go | go | 4,521 | permissive | package kyma_test
import (
"testing"
"github.com/kyma-project/test-infra/development/tools/jobs/tester"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestApiControllerAcceptanceTestsReleases(t *testing.T) {
// WHEN
for _, currentRelease := range tester.GetAllKymaReleaseBranc... |
13bd9e4a4b67c27a1ce95e5283842ab113b55262 | 1312e1a942ee43ba73e82c1aea2d2ef35debe83e | lvxin0315/beegoDemo | /controllers/chatroom.go | Go | go | 3,079 | no_license | // Copyright 2013 Beego Samples 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 agr... |
8254bc3e87c2c6076014ac03da0cd63cf8bc37e7 | bff0ec963a9bcf77ce737b58a51bc31219fe237c | netgene/gobase | /src/log/log.go | Go | go | 1,717 | no_license | package log
import (
"os"
"github.com/op/go-logging"
)
var log = logging.MustGetLogger("example")
// Example format string. Everything except the message has a custom color
// which is dependent on the log level. Many fields have a custom output
// formatting too, eg. the time returns the hour d... |
661bc957e0c80eb4a6a2b36c5e4a5385f1d8a437 | 9ad7a8bf30f2be96134e854f26b8a07d08334ca0 | getsentry/opentelemetry-collector-contrib | /exporter/carbonexporter/config.go | Go | go | 1,381 | 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... |
80902e184ca8811af1f3975350de99374012febe | 149b017143098c9d6ca2698b9c130e6cbde7f83c | jvortega/cyclonus | /pkg/matcher/ippeermatcher.go | Go | go | 1,323 | permissive | package matcher
import (
"encoding/json"
"fmt"
"github.com/mattfenwick/cyclonus/pkg/kube"
v1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
"sort"
"strings"
)
// IPPeerMatcher models the case where IPBlock is not nil, and both
// PodSelector and NamespaceSelector are nil
type IPPeerMatcher struct... |
95e7309b3314ba63ccef344139b945fe36aa4ce5 | 6d74d2417bc84b5b6b6f238fabbf2761cb7caa50 | bik1203/k3s | /vendor/github.com/containerd/cri/pkg/store/image/fake_image.go | Go | go | 1,012 | permissive | /*
Copyright 2018 The Containerd 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, ... |
8f241aa75fa8b4151ee5acd78fa773b38132e3dc | cf213a797c21ab11308f1c2aeb34cefb36adc430 | woyorus/remark | /backend/app/rest/auth/jwt.go | Go | go | 4,600 | permissive | package auth
import (
"net/http"
"time"
jwt "github.com/dgrijalva/jwt-go"
"github.com/pkg/errors"
"github.com/umputun/remark/backend/app/store"
)
// JWT wraps jwt operations
// supports both header and cookie jwt
type JWT struct {
secret string
secureCookies bool
tokenDuration time.Duration
cooki... |
3ba8728bdcb3e962dc87a2fda749ee354effe784 | f925e9eed232edbcc71bb4d71eaada405b19a501 | phpyandong/opentaobao | /model/servicecenter/CsSchedulingWrapper.go | Go | go | 358 | permissive | package servicecenter
// CsSchedulingWrapper
type CsSchedulingWrapper struct {
// 排班记录条数(按天计算)
TotalCount int64 `json:"total_count,omitempty" xml:"total_count,omitempty"`
// 按天排班信息
CsSchedulings []CsScheduling `json:"cs_schedulings,omitempty" xml:"cs_schedulings,omitempty"`
... |
3e3bf1282f4db51cf18439a1b9dda04d705e26ef | 19683a724f0fcdb972eaf420f9144026c977a74b | mrtomeq/leafbus | /pkg/playback/images.go | Go | go | 5,577 | permissive | package playback
import (
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"mime/multipart"
"net/http"
"net/textproto"
"net/url"
"time"
"github.com/grafana/loki/pkg/loghttp"
)
type imageServer struct {
sc *synchronizer
}
func NewImageServer(s *synchronizer) *imageServer {
return &imageServer{
... |
62864f4c7f06d2c9c2ad5bf73d5cccbde2259879 | 6f5f0ad1a308b658552ee14f901468ea8b7ea331 | openshift/installer | /terraform/providers/ironic/vendor/k8s.io/api/authentication/v1/types.go | Go | go | 8,234 | 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, ... |
53a1bd7357823795b7bebb166f6745f2886d28f2 | 3317f0f017cff9459424d787256dc4fae0127449 | cjim8889/torrent | /metainfo.go | Go | go | 4,792 | no_license | package main
import (
"fmt"
"github.com/cjim8889/bencode"
"os"
)
type MetaInfo struct {
announce string
announceList []string
info *Info
}
type Info struct {
files []File
name string
length int
pieceLength int
pieces [][]byte
private int
}
type File struct {
length int
path string
}
type MetaInfoErro... |
5ca1ca04dd2739d440610d94d82fddbe393ad5d4 | 285c0dba322039c3bd7b97855ecdcf200361f5cb | ziguicxd/ceph-csi | /pkg/csi-common/utils.go | Go | go | 4,301 | 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, ... |
80635866764fdaefc3ffbd25eaa4c54ebe52351c | 65dd575a7b2826ec3473be76bf3fbc344a15cb6a | zzy404/LeetCode-Go | /leetcode/0071.Simplify-Path/71. Simplify Path_test.go | Go | go | 1,060 | permissive | package leetcode
import (
"fmt"
"testing"
)
type question71 struct {
para71
ans71
}
// para 是参数
// one 代表第一个参数
type para71 struct {
s string
}
// ans 是答案
// one 代表第一个答案
type ans71 struct {
one string
}
func Test_Problem71(t *testing.T) {
qs := []question71{
question71{
para71{"/.hidden"},
ans71{"/... |
63b6e3ebe6d644eb890b0d9032efa5cdc435b43e | 6f3a30d781befb24d155e946c5865548b39b3573 | viniciusCSreis/poc-operator-sdk | /poc-operator-sdk/main.go | Go | go | 3,359 | no_license | /*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed un... |
31a6c97ebdbd03bd22009327c3426da7ff5f8980 | b15549801e4ad653dd52f20fb2dfa1f169f0ca40 | cctip/bchd | /wire/msgnotfound_test.go | Go | go | 9,062 | permissive | // Copyright (c) 2013-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package wire
import (
"bytes"
"io"
"reflect"
"testing"
"github.com/cctip/bchd/chaincfg/chainhash"
"github.com/davecgh/go-spew/spew"
)
// TestNotFound tests the ... |
08fa93972a4380b160aa1c7a1a9fd0adf4f01d64 | f68ff152663ed076f1adc7a192fac5c6c24db0c0 | minwhoo/dyrest-sim | /main.go | Go | go | 2,164 | no_license | package main
import (
"log"
"math"
"sync"
)
var nodeIdx = 0
type simulationManager struct {
running bool
initialized bool
supervisor supervisor
waitgroup sync.WaitGroup
segfileInfo segfileInfo
}
func newSimulationManager() *simulationManager {
var wg sync.WaitGroup
sv := supervisor{
poolLock: ... |
010efdd7fa2f07c26a9cee4c08ced6b9cff5a9e2 | 1a6e5937997c681546d08300a812d9d500ad323a | mdb/concourse | /worker/workercmd/containerd.go | Go | go | 5,114 | permissive | // +build linux
package workercmd
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"syscall"
"code.cloudfoundry.org/garden/server"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/localip"
concourseCmd "github.com/concourse/concourse/cmd"
"github.com/concourse/concourse/worker/runtime"
"gith... |
7278b848504d5048ae11c684394f26cb00ebdc35 | e32ca9ffe776cc72e04995ee4edb8adde25dc30c | Ryuta339/minigo | /t/pointer/pointer.go | Go | go | 541 | permissive | package main
import "fmt"
func testint() {
var i int = 1
var j *int = &i
fmt.Printf("%d\n", *j)
i = 2
fmt.Printf("%d\n", *j)
}
func testbyte() {
var a byte = '3'
var pa *byte = &a
fmt.Printf("%c\n", a)
a = '4'
fmt.Printf("%c\n", *pa)
}
func testmixed() {
var a byte = '5'
var pa *byte = &a
fmt.Printf... |
53925b2ddf97ff1b44c6a2993d605fa80afb9115 | 7a58c9ed4ce49362754c0d094d9dbe1ead75508f | mingkaic/themis | /vendor/github.com/infobloxopen/go-trees/uintX/iptree16/node64s.go | Go | go | 6,695 | permissive | package iptree16
// !!!DON'T EDIT!!! Generated by infobloxopen/go-trees/etc from <name>tree{{.bits}} with etc -s uint16 -d uintX.yaml -t ./<name>tree\{\{.bits\}\}
import "fmt"
// node64s is an element of radix tree with 64-bit unsigned integer as a key.
type node64s struct {
// key stores key for current node.
key... |
bc4490b78c1275bae2e3a777672822a6a44fa5f6 | d211db40dda0b9e011a1d8dd734a7413eca020e0 | arturo-source/backup-system | /server/token.go | Go | go | 1,829 | no_license | package main
import "time"
//Token is the struct to control when a user can access it's data
type Token struct {
value string
finishDate time.Time
userName string
}
//Tokens implements the functions to control the tokens in the server
type Tokens struct {
tokens []Token
}
//Exists returns true and the po... |
c8bd7305bf6aed7895d65c7ff9323f99be09756d | 85ca6721b37a4fd62d5821006ce9e9626310221b | erda-project/erda | /internal/core/openapi/legacy/api/apis/testplatform/testplan/generate_report.go | Go | go | 1,184 | permissive | // Copyright (c) 2021 Terminus, 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 agree... |
bc53980450af98633b8d4be46be37b22deea7500 | 0cb9202fbf19a23dc5549ad31b42e5414a3ee3b4 | shashanktopallesonos/skaffold | /pkg/skaffold/build/cache/lookup_test.go | Go | go | 5,641 | permissive | /*
Copyright 2019 The Skaffold Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... |
6e556036408649d318c4c996881751274b03cbb1 | e1859fd9d34aa5eb34b1bfadaa458344d36c33e2 | little-bit-shy/go-xgz | /pkg/elastic/xpack_security_enable_user.go | Go | go | 4,849 | permissive | // Copyright 2012-2019 Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"strings"
"github.com/little-bit-shy/go-xgz/pkg/elas... |
0bfa15f6ba0d29cf959914050e8bf851de9b3ef1 | 907b08ed60ab28cae51dcb7f239de8600a51a9d8 | cbush06/kosher | /config/settings.go | Go | go | 3,952 | permissive | package config
import (
"bytes"
"log"
"os"
"github.com/cbush06/kosher/common"
"github.com/cbush06/kosher/fs"
"github.com/spf13/afero"
"github.com/spf13/viper"
)
// Settings wraps references to all setting providers required by Kosher
type Settings struct {
Environments Provider
Pages Provider
Select... |
941e46bc3608d6f571ced6557d5e0f2911fbf1dd | aba7dcf767cc5d351dbf7256f060298e1f7b661c | adamwg/elastiquery | /vendor/gopkg.in/olivere/elastic.v3/backoff_test.go | Go | go | 2,607 | permissive | package elastic
import (
"math/rand"
"testing"
"time"
)
func TestZeroBackoff(t *testing.T) {
b := ZeroBackoff{}
_, ok := b.Next(0)
if !ok {
t.Fatalf("expected %v, got %v", true, ok)
}
}
func TestStopBackoff(t *testing.T) {
b := StopBackoff{}
_, ok := b.Next(0)
if ok {
t.Fatalf("expected %v, got %v", fa... |
030a926829e23cf2764f8ed2a84c52405bf080f5 | 795bd35d40f9708a77e9b089c8b80f6003fa7d35 | pete965/goLearningProject | /main/url-parsing.go | Go | go | 547 | no_license | package main
import (
"fmt"
"net/url"
"strings"
)
func main() {
s := "postgres://user:pass@host.com:5432/path?k=v#f"
u, err := url.Parse(s)
if err != nil {
panic(err)
}
fmt.Println(u.Scheme)
fmt.Println(u.User)
fmt.Println(u.User.Username())
p, _ := u.User.Password()
fmt.Println(p)
fmt.Println(u.H... |
7b9658148ceb1ac67d97ec35a7912faaeb187edf | 8a5539e20472d539ad76410130acd51bede06c05 | masterDev1985/obc-peer | /openchain/ledger/statemgmt/trie/snapshot_iterator.go | Go | go | 2,521 | permissive | /*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.