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 |
|---|---|---|---|---|---|---|---|---|
051f25c86af3d57d59cca35ff1bf37f06073b613 | 781abf5f939467e81db822ced695da8b1d9690f9 | lmika/deck | /file/types.go | Go | go | 617 | permissive | package file
import "github.com/hbagdi/go-kong/kong"
type service struct {
kong.Service `yaml:",inline"`
Routes []*route
Plugins []*plugin
}
type route struct {
kong.Route `yaml:",inline"`
Plugins []*plugin
}
type upstream struct {
kong.Upstream `yaml:",inline"`
Targets []*target
}
type ... |
3969ce6c2c3544e1f8cfa190c0554b6762455010 | 70792948e54cb0ad12b5cd4b4d2006010738b43c | xennygrimmato/sourcegraph | /services/backend/internal/localstore/build_logs_test.go | Go | go | 2,616 | no_license | package localstore
import (
"io/ioutil"
"strings"
"testing"
"time"
"golang.org/x/net/context"
"sourcegraph.com/sourcegraph/sourcegraph/api/sourcegraph"
"sourcegraph.com/sourcegraph/sourcegraph/pkg/conf"
)
func logStr(e *sourcegraph.LogEntries) string { return strings.Join(e.Entries, "\n") }
var task = source... |
67586cad32b0b5a0757d547a5ae400633ca960ff | 03b0700c9d9e9e24da30954a42d454552c2dc798 | davsk/davsknet | /goget/goget.go | Go | go | 695 | permissive | // goget.go
package goget
import (
"fmt"
"net/http"
"strings"
)
func Handler(w http.ResponseWriter, r *http.Request) {
resp := `
<html>
<head>
<meta name="go-import" content="davsk.net/%s git https://github.com/davsk/%s.git">
</head>
</html>
`
// Split the path to return a meta tag with only the first po... |
699852a2dc5a6af166d99254a6680f80a1f93230 | a5a26012cf962765b361771638d43b14a7c4bd88 | StupidTAO/apigateway | /common/hash.go | Go | go | 3,466 | permissive | // Copyright(c) 2018 DSiSc Group 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 applica... |
f7c18598016ddae991750ccaca19b63bb22b432d | 72ecbddd4afef29ca6f7f4d07aee4d2a6b22ccaa | jameshageman-stripe/stripe-go | /person.go | Go | go | 5,071 | permissive | package stripe
import "encoding/json"
// RelationshipParams is used to set the relationship between an account and a person.
type RelationshipParams struct {
AccountOpener *bool `form:"account_opener"`
Director *bool `form:"director"`
Executive *bool `form:"executive"`
Owner ... |
4ee84ddba2883fbd4cf13b5c0b28fff4d32e893b | 40fc710284156b3e465aa0103bca88146c5a9322 | rveen/golib | /parser/basic.go | Go | go | 4,198 | permissive | package parser
// String is a concatenation of characters that are > 0x20
func (p *Parser) String() string {
var buf []byte
for {
if p.Ix >= len(p.Buf) {
break
}
c := p.Buf[p.Ix]
if !isTextChar(c) {
break
}
p.Ix++
buf = append(buf, c)
}
return string(buf)
}
// Break (= newline) is NL, CR ... |
d11b899eb249b604df6b8645b898af65079cd13a | 38e405689d73701499f74e86b4c17f12c7c4477a | tojin12341za/jx | /pkg/kube/test_integration/activity_integration_test.go | Go | go | 8,773 | permissive | // +build integration
package test_integration_test
import (
"fmt"
"testing"
jenkinsio_v1 "github.com/jenkins-x/jx/pkg/apis/jenkins.io/v1"
"github.com/jenkins-x/jx/pkg/client/clientset/versioned"
v1 "github.com/jenkins-x/jx/pkg/client/clientset/versioned/typed/jenkins.io/v1"
"github.com/jenkins-x/jx/pkg/cmd/cl... |
fc6cb3aade5ecad718dbfc9550ff1a0ef569ef57 | 2ae4da0547103d5d103840566a9a23d187592cb7 | yadisnel/go-ms-plugins | /client/grpc/options.go | Go | go | 3,269 | permissive | // Package grpc provides a gRPC options
package grpc
import (
"context"
"crypto/tls"
"github.com/yadisnel/go-ms/v2/client"
"google.golang.org/grpc"
"google.golang.org/grpc/encoding"
)
var (
// DefaultPoolMaxStreams maximum streams on a connectioin
// (20)
DefaultPoolMaxStreams = 20
// DefaultPoolMaxIdle ma... |
255d816c6052194edbf9e78874a4720752c9cd69 | a5f10106bc07c54dfce5a5954c47158e0c89e95c | fengchenghu/rook | /tests/framework/installer/ceph_installer.go | Go | go | 36,923 | permissive | /*
Copyright 2016 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... |
4f5bed041e96056c843b94683bfaa967bb0cbc69 | 766e064b5e34d181215ed6c55ec21f3c820f2d57 | djfritz/hermes-bot | /src/driver/ncurses.go | Go | go | 3,006 | no_license | package main
// #cgo LDFLAGS: -lncurses
// #include <stdlib.h>
// #include <locale.h>
// #include <ncurses.h>
import "C"
import (
"unsafe"
)
var (
rows *int
cols *int
)
const (
LEGEND_WIDTH = 30
LOG_HEIGHT = 10
)
const (
ACS_DEGREE = iota + 4194406
ACS_PLMINUS
ACS_BOARD
ACS_LANTERN
ACS_LRCORNER
ACS_UR... |
b93698edfa40eb627bbe94308f849f8698f21c5b | ce269bc278923158784da87cb297835af7ac8951 | meika-sweet-factory/PRO-PLI2 | /internal/app/education/postgres/repository.go | Go | go | 3,482 | no_license | package postgres
import (
postgresDriver "github.com/jinzhu/gorm"
unicampus_api_education_v1alpha1 "gitlab.com/deva-hub/unicampus/api/v1alpha1"
"gitlab.com/deva-hub/unicampus/internal/pkg/services"
)
func New(conn *services.PostgreSQLService) *Repository {
return &Repository{
conn: conn.Driver(),
}
}
type Rep... |
f643ee2a524db83c704cf4cecdbc4f9db6a81a18 | 268b11dcf0149ca393cff54c45cd134cc9cd9ab2 | StalkR/hsts | /directives_test.go | Go | go | 1,935 | permissive | package hsts
import (
"testing"
"time"
)
func TestDirectives(t *testing.T) {
for _, tt := range []struct {
parse string
invalid bool
maxAge time.Duration
includeSubDomains bool
}{
// completely valid
{
parse: "max-age=0",
maxAge: 0,
},
{
parse: "max-age=... |
3fe91b9bc3530565bd982229407931b640450f11 | a43efdc2daeefdfa469050b5e03cdac6947462e8 | csyfek/ringcentral-go | /definitions/regionalsettingsinfo.go | Go | go | 367 | no_license | package definitions
// RegionalSettingsInfo Regional Settings Info
type RegionalSettingsInfo struct {
Timezone TimezoneResource `json:"timezone"`
HomeCountry CountryResource `json:"homeCountry"`
Language LanguageResource `json:"language"`
GreetingLanguage LanguageResource `json:"greetingLanguage"`
FormattingLocal... |
27149de7e430d898d2c548ad596ec9f49521dd68 | f1bec4e5f728e1f7ec0995f84b620b39405692d1 | cahyowhy/go-basic-rest-api-revisit | /cmd/seeder/main.go | Go | go | 1,803 | no_license | package main
import (
"fmt"
"log"
"os"
"github.com/cahyowhy/go-basit-restapi-revisit/config"
"github.com/cahyowhy/go-basit-restapi-revisit/database"
"github.com/cahyowhy/go-basit-restapi-revisit/fake"
"github.com/cahyowhy/go-basit-restapi-revisit/model"
"github.com/cahyowhy/go-basit-restapi-revisit/util"
"go... |
ca4e38dcaa249755ef55583866ddca4e797be8e0 | 4822ad988fe8a250a8bb185e4987d55f5fc92819 | shaileshpatel34/kala | /job/clock_test.go | Go | go | 1,092 | permissive | package job
import (
"sync"
"time"
"github.com/mixer/clock"
)
// Special hybrid clock that allows you to make time "play" in addition to moving it around manually.
type HybridClock struct {
*clock.MockClock
offset time.Duration
m sync.RWMutex
}
func NewHybridClock(start ...time.Time) *HybridClock {
retu... |
41b9ab9377343dceb1e3034393c8ea85acd5e9f2 | f8ec0189a0fc2c02f11516238086820fe87e9dd2 | sgtest/monorepo-test-3 | /kubernetes-9/pkg/client/metrics/prometheus/prometheus.go | Go | go | 2,125 | 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, ... |
322b3f87a03bb46bf059c74c5fc8e604a75d38e4 | b65c76623bcd5276d183450bfd38e326cf18745e | bpmcdevitt/terraform-provider-libvirt | /vendor/github.com/mitchellh/packer/packer/plugin/post_processor.go | Go | go | 680 | permissive | package plugin
import (
"log"
"github.com/hashicorp/packer/packer"
)
type cmdPostProcessor struct {
p packer.PostProcessor
client *Client
}
func (c *cmdPostProcessor) Configure(config ...interface{}) error {
defer func() {
r := recover()
c.checkExit(r, nil)
}()
return c.p.Configure(config...)
}
fu... |
b19b1fd3ac8a74111ae81dc242622b618ac3d3ef | 78335ed1196278bab29d2be3157129bcb30f981a | tttlkkkl/go-config | /backup.go | Go | go | 1,841 | permissive | package conf
import (
"encoding/json"
"errors"
"io/ioutil"
"os"
)
const (
backupsDir = "comm/___backups___/"
)
// 备份配置
func backups(fileName string, confMap map[string]interface{}) error {
fileName, err := getFullBackFileName(fileName)
if err != nil {
return err
}
jsonData, err := json.... |
6c0dc83c7b9cbcb95e6b2b15aaa20c829e561a85 | ccc508faba7d4bff1e40970edbd155741b704a67 | runzexia/jx | /pkg/jx/cmd/factory.go | Go | go | 17,627 | permissive | package cmd
import (
"flag"
"fmt"
"github.com/hashicorp/vault/api"
"github.com/jenkins-x/jx/pkg/vault"
"io"
"net/url"
"os"
"path/filepath"
"github.com/jenkins-x/jx/pkg/helm"
"github.com/jenkins-x/jx/pkg/kube/services"
"github.com/jenkins-x/jx/pkg/log"
"github.com/heptio/sonobuoy/pkg/client"
"github.com/... |
e566cc849f1bcc36e9fdb756d5ca808d770d463d | 53825ed2710d5ef2252452083db5d9cee3aa749b | k15r/kyma | /components/eventing-controller/pkg/backend/jetstreamv2/test_helpers.go | Go | go | 3,638 | permissive | package jetstreamv2
import (
"bytes"
"context"
"net/http"
"time"
"github.com/kyma-project/kyma/components/eventing-controller/logger"
backendnats "github.com/kyma-project/kyma/components/eventing-controller/pkg/backend/nats"
natstesting "github.com/kyma-project/kyma/components/eventing-controller/pkg/backend/n... |
d15d5480424405e044589b22bf863fe4c50d1e58 | 2ca654f59376ee24349d91cddfa424e078d8440f | christianpv/sourcegraph | /internal/campaigns/types.go | Go | go | 41,063 | permissive | package campaigns
import (
"fmt"
"io"
"reflect"
"strconv"
"strings"
"time"
"github.com/graph-gophers/graphql-go"
"github.com/graph-gophers/graphql-go/relay"
"github.com/inconshreveable/log15"
"github.com/pkg/errors"
"github.com/sourcegraph/go-diff/diff"
"github.com/sourcegraph/sourcegraph/internal/api"
"... |
a76a99155883e2f8d6b3f63280e314019c0584af | f0bc825eaab564b6800bb78b0116d07bb874cb7e | sbuadu/TTK4145 | /Exercise 3/UDPlisten.go | Go | go | 778 | no_license | package main
import (
"fmt"
"net"
)
func main() {
// udp ip addr
server, _ := net.ResolveUDPAddr("udp", "129.241.187.255:30000")
// server2, err := net.ResolveUDPAddr("udp", "129.241.187.255:20097")
// fmt.Println(err)
// create socket
conn, _ := net.ListenUDP("udp", server)
// create buffer to store msg
buf... |
9e181c1f8972aa0f03468121e6d3b066ad3c7fbc | c31d28134a34dbb94d2752e6158c1fbb0957b009 | httpcheck/tidb-tools | /vendor/github.com/pingcap/tidb/executor/distsql.go | Go | go | 31,721 | permissive | // Copyright 2017 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
3657652f4334b493a4b46003ced13522c8484ea9 | 24a1d53e9049b393cfc1ff50ef9a71b2ce625372 | watercolor/tidb-operator | /pkg/webhook/webhook.go | Go | go | 1,604 | permissive | // Copyright 2019 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
775c3873f6b2be7d4c3be3edaf562ae4c90c9729 | 3c8cd0817d72b55989ec4ef2ed01e8d039b213eb | r2d2-ai/aiflow | /service/flow-state/store/dynamodb/step.go | Go | go | 2,303 | permissive | package mem
import (
"sync"
"github.com/r2d2-ai/aiflow/action/flow/state"
"github.com/r2d2-ai/aiflow/service/flow-state/event"
"github.com/r2d2-ai/aiflow/service/flow-state/store"
)
func init() {
store.SetStepStore(&StepStore{stepContainers: make(map[string]*stepContainer)})
}
type StepStore struct {
sync.RWM... |
23f9113d867e09bfb51a0de9bfb425ec7ecddc3f | bf07247f24c424b6a2b70f7b681d1247610b23eb | Rheinwerk/yq | /pkg/yqlib/compare_operators_test.go | Go | go | 7,236 | permissive | package yqlib
import (
"testing"
)
var compareOperatorScenarios = []expressionScenario{
// ints, not equal
{
description: "Compare numbers (>)",
document: "a: 5\nb: 4",
expression: ".a > .b",
expected: []string{
"D0, P[a], (!!bool)::true\n",
},
},
{
skipDoc: true,
document: "a: 5\nb: 4"... |
c5ba7d7908e4fc5e5334b23966449b035c0fc991 | b66e0ce38a9cf74035149500cffc1367a7a7090d | talktanke/gobasic | /pubsub/options.go | Go | go | 357 | no_license | package pubsub
// subscriptionOptions can help subscriber do subscribe on more than one topic
// and use buffer size as a parameter
type SubscriptionOptions struct {
BufferSize int
Topics []string
}
func NewSubscriptionOptions(bufSize int, topics ...string) *SubscriptionOptions {
return &SubscriptionOptions{Bu... |
d8f0047e49f76fa251bee690afb52a34513d5446 | d8bf58f15115d22dcf7f65c0ee27e48a7f9aa72f | aliyun/aliyun_assist_client | /listcontainerscmd.go | Go | go | 4,928 | permissive | package main
import (
"encoding/json"
"fmt"
"os"
"time"
logrusr "github.com/aliyun/aliyun_assist_client/thirdparty/bombsimon/logrusr/v3"
"github.com/rodaine/table"
"k8s.io/klog/v2"
"github.com/aliyun/aliyun_assist_client/agent/container"
"github.com/aliyun/aliyun_assist_client/agent/container/model"
"githu... |
6ec5f07d044022b18884fecd13fe7312bd7d464d | 458146fd17655f1b5f8f5df7b21e647aa64e045f | skwair/harmony | /discord/audit/entry_guild.go | Go | go | 4,195 | permissive | package audit
import (
"fmt"
)
func guildUpdateFromEntry(e *rawEntry) (*GuildUpdate, error) {
guildUpdate := &GuildUpdate{
BaseEntry: baseEntryFromRaw(e),
}
for _, ch := range e.Changes {
switch changeKey(ch.Key) {
case changeKeyName:
oldValue, newValue, err := stringValues(ch.Old, ch.New)
if err != ... |
f5b056cff7f62204289e5256168fb5949b227b5e | fb93d2647592d1937f93f4357c56ead26b846d9e | tcfw/git-remote-ipfs | /push.go | Go | go | 3,586 | permissive | package main
import (
"bytes"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/pkg/errors"
"github.com/tcfw/git-remote-ipfs/internal/debug"
)
func push(src, dst string) error {
var force = strings.HasPrefix(src, "+")
if force {
src = src[1:]
}
var present []string
for _, h := range ref2hash ... |
05070171aaa91241e7fa4a2c457c34ad484406cf | 9fc7fab99b12564b12ce21be0864f591246dbbac | cghsystems/gosum | /api/controller_test.go | Go | go | 1,845 | no_license | package api_test
import (
"encoding/json"
"io/ioutil"
"net/http"
"github.com/cghsystems/gosum/api"
"github.com/cghsystems/gosum/metrics"
"github.com/cghsystems/gosum/query"
"github.com/cghsystems/gosum/record"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("HTTP API", func() {
con... |
41490bc92a339fd722b15eb74b284516371aebd0 | a7443ffdc94250e1ae9d0e1920af443b936fddca | txn2/dmk | /vendor/github.com/recursionpharma/go-csv-map/csvmap_test.go | Go | go | 5,296 | permissive | package csvmap
import (
"bytes"
"io"
"strings"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
// TODO test csv.Reader.Read() error
func TestReadHeader(t *testing.T) {
Convey("Given a reader", t, func() {
Convey("If there is no next row", func() {
buf := bytes.NewBuffer(nil)
columns, err := N... |
cf50a81a9c84029e7900c31634b7a3a8dbd5838e | 868d1ed42491df6a5974f93a8b1b5a0c999b869b | CriaHu/cli-utils | /pkg/kstatus/status/status_compute_test.go | Go | go | 26,024 | permissive | // Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package status
import (
"testing"
"github.com/ghodss/yaml"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
func y2u(t *testing.T, spec string) *unstructured.Un... |
3bd0ffe24ac31d98499e1f5f29507ce4f2c45755 | 1b3853e8e357d768debf3d527f423016793cfe3c | bdshadow/kubernetes-client-android | /kubernetes-model/vendor/k8s.io/kubernetes/staging/src/k8s.io/apiserver/plugin/pkg/audit/webhook/webhook_v1alpha1_test.go | Go | go | 8,780 | permissive | /**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... |
7dda05f6a0034a37a1154b8aa5748cfc1bab80c5 | c110d37119cedbffa4221eadee76b5f017d95765 | AnonymousCyberWarrior/zed | /zio/jsonio/reader.go | Go | go | 1,120 | permissive | package jsonio
import (
"bytes"
"encoding/json"
"io"
"github.com/brimdata/zed"
"github.com/brimdata/zed/zson"
)
type Reader struct {
zctx *zed.Context
decoder *json.Decoder
encoder *json.Encoder
encoderBuf *bytes.Buffer
}
func NewReader(r io.Reader, zctx *zed.Context) *Reader {
d := json.NewDe... |
c25ab0c71307abf3033977a5426cea055c5741a0 | c0435689827b1cafcc4384587a14a0e84c971a8e | kubedb/cli | /vendor/github.com/elastic/go-elasticsearch/v8/typedapi/security/putrole/put_role.go | Go | go | 5,180 | 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 ... |
03cb5d2a5bdd54c4e93b411a4cf3d441099d305e | 243aacea4c06cd55bf90db3b0412ab9482cd3861 | deepfabric/etcd | /etcdctl/ctlv3/command/make_mirror_command.go | Go | go | 4,990 | permissive | // Copyright 2016 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... |
046ef3399b7b41e4db322c6532b6dfbe955cbc04 | 053f23f2ed3ed5b975ddde230f39018e6c692874 | obukhov/football-players-info | /aggregator/processor_test.go | Go | go | 1,363 | no_license | package aggregator
import (
"github.com/obukhov/football-players-info/api"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"io"
"testing"
)
type PlayersCollectionMock struct {
mock.Mock
}
func (p *PlayersCollectionMock) Add(name string, age int, team string) {
p.Called(name, age, team)... |
c65b3c34d86076593ae897224bfa82913f4c9ed9 | a2b1ae3d6c091971ec6560fc33624b0bc917ad1c | jopicornell/jet | /internal/jet/alias.go | Go | go | 565 | permissive | package jet
type alias struct {
expression Expression
alias string
}
func newAlias(expression Expression, aliasName string) Projection {
return &alias{
expression: expression,
alias: aliasName,
}
}
func (a *alias) fromImpl(subQuery SelectTable) Projection {
column := newColumn(a.alias, "", nil)
c... |
54e9353beed1441329392f890fb264ccd30c371a | f2c478c61806bf4327ae06089e7cb6689bf4113d | elimaneg/aws-operator | /vendor/github.com/giantswarm/k8scloudconfig/v_3_6_4/types.go | Go | go | 3,497 | permissive | package v_3_6_4
import (
"github.com/giantswarm/apiextensions/pkg/apis/provider/v1alpha1"
)
type Params struct {
// APIServerEncryptionKey is AES-CBC with PKCS#7 padding key to encrypt API
// etcd data.
APIServerEncryptionKey string
BaseDomain string
Cluster v1alpha1.Cluster
// Disab... |
96d8ec739f1e86e3bfbbf4334439702e16b62ba0 | 793749e5220ac8e39d542f49e8efcbc3d221c996 | remcokranenburg/advent-of-go-2020 | /day05-binary-boarding/find-seat.go | Go | go | 1,222 | no_license | package main
import (
"bufio"
"fmt"
"math"
"os"
)
func findSeat(s []rune, start int) int {
if len(s) == 0 {
return start
} else {
newStart := start
if s[0] == 'B' || s[0] == 'R' {
newStart = start + int(math.Pow(2, float64(len(s) - 1)))
}
r... |
15ee7d058afae4222e4478bbbc09b7c3076a286a | 40f40a422ad5c898d1ad70b6f58ba028aff40b4b | sleeper/pravatar | /diskstore/diskstore.go | Go | go | 738 | no_license | package diskstore
import (
"io"
"log"
"os"
"path"
"strings"
)
type Storer interface {
Get(string) (io.Reader, error)
Put(string, []byte) (error)
}
type DiskStore struct {
Dir string
}
func NewStore(dir string) *DiskStore {
return &DiskStore{Dir: dir}
}
func (s *DiskStore) Get(hash string) (io.Reader, e... |
d80f22f48e09d3b7d2a815520070dcdc7bbcbce9 | 7db9dc9b7708a5ab496df2ce97997346e6b32f97 | adarqui/ekg-core-go | /timestamp.go | Go | go | 673 | no_license | package ekg_core
import (
"sync"
"time"
)
type Timestamp struct {
mtx *sync.Mutex
v time.Time
}
// Create a new, time initialized, timestamp.
func newTimestamp() *Timestamp {
timestamp := new(Timestamp)
timestamp.mtx = &sync.Mutex{}
timestamp.Stamp()
return timestamp
}
// Get the current value of the time... |
0d87ee0a784810430f3773bed0b2a4949d6ef9b2 | ed976b34656f55ac1347da7c8974250aa7d79223 | wavefrontHQ/wavefront-lambda-go | /handler.go | Go | go | 3,486 | permissive | package wflambda
import (
"context"
"fmt"
"reflect"
)
// validateLambdaHandler validates the lambdaHandler is a valid handler function. When the handler is a valid handler function,
// the function will check whether one of the arguments is a context. The function returns a non-nil error if lambdaHandler is
// not... |
8c066e5b15256febf2bb35807c7a3bdb1c50153d | 316f686eab2555aab91853a6b8f8a03f03f78458 | syvanpera/google-api-go-client | /area120tables/v1alpha1/area120tables-gen.go | Go | go | 90,062 | 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 area120tables provides access to the Area120 Tables API.
//
// For product documentation, see: https://tables.area120.google.com
//
// C... |
10cdff841a57cadb639f5747d30b4366936c9299 | 3a86a933909a4326fe90788298fcac4cec2b252d | masonhensley/comply | /internal/model/standard.go | Go | go | 1,284 | permissive | package model
type Control struct {
Family string `yaml:"family"`
Name string `yaml:"name"`
Description string `yaml:"description"`
}
type Standard struct {
Name string `yaml:"name"`
Controls map[string]Control `yaml:",inline"`
}
// ControlsSatisfied determines the unique controls cu... |
2ff12e21db154150dcd041404178577aa606c6b0 | 782fdce0bf892448aac36bff589864c73dc08fd5 | archilkarchava/adventofcode2019 | /pkg/day1/1.go | Go | go | 999 | no_license | package day1
import (
"github.com/archilkarchava/adventofcode2019/pkg/common"
"strconv"
)
// CountFuel1 counts fuel for a single module not recursively
func CountFuel1(module uint64) uint64 {
return module/3 - 2
}
// CountFuel2 counts fuel for a single module recursively
func CountFuel2(module uint64) uint64 {
i... |
9f74616eaeca63266d1bb219853accca97bf7c0f | 97fe93956a704401aa0bcb77d2e2d2040a04b318 | jverce/cadence | /service/history/historyReplicator.go | Go | go | 48,737 | permissive | // Copyright (c) 2017 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... |
d89fef14d80fe2a4afcd078d5b7e6878409340cf | d07c3d641595273cee9192326ec12406541e9ea2 | timreid/wabisabi | /wabisabi.go | Go | go | 2,820 | no_license | package wabisabi
import "math"
import "math/rand"
import "sort"
import "fmt"
//used to hold metadeta for individuals and the state of the simulation
type Meta map[string]interface{}
//an abstract representation of the genome of an individual
type Genotype interface{}
//an individual
type Individual struct {
Genome... |
d8b70d3a1258952537027b7851a3c59c79967b1b | cb14e9a16e07abdb0cb364a3c52549f265264ad1 | inhuman/go-notify | /mattermost/chat.go | Go | go | 2,315 | permissive | package mattermost
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"github.com/appscode/envconfig"
"github.com/golang/glog"
"github.com/inhuman/go-notify"
"net/http"
)
const UID = "mattermost"
type Options struct {
Url string `envconfig:"URL" required:"true"`
HookId string `envconfig:"HOOK_ID" req... |
e8fdf49a215eb9795dcfda0ab2bc9ec83ca31a20 | 81c95efce0f0b8f0e10bab52cce1564dcef1673a | juner417/cluster-api | /api/v1beta1/common_types.go | Go | go | 18,188 | permissive | /*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
d7f175a345fbc0e74588e7a4cb68546c181d69c8 | cf0764de35e1981beb13a3a47ac98b3c0c6043eb | pdxjohnny/docker | /api/client/build.go | Go | go | 13,083 | permissive | package client
import (
"archive/tar"
"bufio"
"bytes"
"fmt"
"io"
"os"
"path/filepath"
"regexp"
"runtime"
"golang.org/x/net/context"
"github.com/docker/docker/api"
"github.com/docker/docker/builder"
"github.com/docker/docker/builder/dockerignore"
Cli "github.com/docker/docker/cli"
"github.com/docker/do... |
d37d3174c1e2289a9a99c0f9a3015fbe91b6d60d | 084f8604afa556766765dfd87d5c5120e479c497 | nopost/portainer | /api/http/proxy/networks.go | Go | go | 5,768 | permissive | package proxy
import (
"net/http"
"github.com/portainer/portainer/api"
)
const (
// ErrDockerNetworkIdentifierNotFound defines an error raised when Portainer is unable to find a network identifier
ErrDockerNetworkIdentifierNotFound = portainer.Error("Docker network identifier not found")
networkIdentifier ... |
6e46ac1908266c430a7f464199e6a3aba8a5ed23 | 61561cd8bf347e8c5d9f8aafa161ab0cb89baae8 | jamebluntcc/shalog | /src/repository/types/link.go | Go | go | 562 | no_license | package types
import "time"
type Link struct {
Id int64 `gorm:"column:id;primary_key" json:"id"`
Name string `gorm:"column:name;unique;size:168" json:"name"`
Link string `gorm:"column:link;unique;size:168" json:"link"`
Icon string `gorm:"column:icon;size:500" json:"icon"`
State... |
ce40af52abe210a5d8f660cfbb5e037d2c410b53 | 9d3160a36b59fe061aa855fa22b15ba8f92d3ade | stevepartridge/mlb | /venues_test.go | Go | go | 714 | permissive | package mlb_test
import "testing"
func Test_GetVenues_Success(t *testing.T) {
venues, err := mlbApi.GetVenues()
if err != nil {
t.Error("Should not error when retrieving venues")
}
if len(venues) == 0 {
t.Error("Should be more than zero")
}
}
func Test_GetVenue_Success(t *testing.T) {
venue, err := mlbA... |
b895ac7c2f84fa35801c1252c2fd93ebaf3efe1a | c7abf337db84d8e6fc5987585dbf29dd377012d4 | Musketeer-Liu/Go_Mega_Project | /.history/main_20191108133646.go | Go | go | 458 | no_license | package main
import (
// "fmt"
// "io"
"html/template"
"net/http"
)
type User struct {
Username string
}
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
user := User{Username: "Musketeer"}
tpl, _ := template.ParseFiles("templates")
tpl.Execute(w, &user)
// w.Write([]b... |
4b233986123dbdb6f1546ecc2b63a50808ed5425 | 7722d3af835a0ab1326e3d981a1b415a9e8c1a12 | suneyz/amazon-ecs-agent | /agent/config/conditional_test.go | Go | go | 1,910 | permissive | // +build unit
// Copyright 2015-2018 Amazon.com, Inc. or its affiliates. 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. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or... |
77d9a007ab5d09b8cd3a271ed6b93ff10a2cd210 | 489172d3a0c3b9917713f318eae5e94f09ad0bc7 | morristech/cortex | /cli/cmd/lib_manager.go | Go | go | 6,777 | permissive | /*
Copyright 2020 Cortex Labs, 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, softwa... |
a2ccdfd9e16dffe5b4a6b8d169d37dd525d05fb8 | bf22333c5539fde37390bcc509e91486c57c944a | ws752499660/jvmgo | /ch02/classpath/entry_composite.go | Go | go | 800 | no_license | package classpath
import (
"errors"
"strings"
)
type CompositeEntry []Entry
func newCompositeEnrty(pathList string) CompositeEntry {
compositeEntry := []Entry{}
for _, path := range strings.Split(pathList, pathListSeparator) {
entry := newEntry(path)
compositeEntry = append(compositeEntry, entry)
}
return ... |
89c1d01e4f16a974f1cb311d4e5a6b63ab7760c8 | 59938f2f555c1cc6df544bbf85f6cf2ae6c12b55 | aaa123848/mongo-replica | /application/mongoQuery.go | Go | go | 853 | no_license | package application
import (
"context"
"encoding/json"
"fmt"
"log"
"reflect"
)
type ReadInter interface {
ReadOne(context.Context) interface{}
ReadAll(context.Context) interface{}
}
func GetOne(ctx context.Context, m ReadInter) (string, error) {
q := m.ReadOne(ctx)
res, err := json.Marshal(q)
if err != nil... |
156bda76b91eed7382617a871768998965c0dcf3 | 6d83862ac6f75c6f1341ce4e0baa85c28cdb544c | InstaGIS/godynamodb | /item_test.go | Go | go | 7,271 | no_license | package godynamodb
import (
"errors"
"strings"
"testing"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestItem_SAsString(t *testing.T) {
t.Parallel()
t.Ru... |
19e2d61096eeb6adb068615cd2d556aab9fb18bf | 474965bbf70d9eb9b3ae34407b17d05a1cae4976 | tharun-d/customer | /repository/maria_customer.go | Go | go | 1,090 | no_license | package repository
import (
"customer/common"
"customer/models"
"database/sql"
)
const (
selectUserByMobileNumber = `SELECT id, full_name, mobile, email, type, kyc_level, status, photo_url,verification_status FROM customer
FROM customerWHERE mobile = ?`
selectUserByCustomerID = `SELECT id, full_name, mobile, e... |
c33ce787262f422d01098e1e946828a29d69d473 | 0dce55e37f8b9bfcf7ba0a8c84c7ef200cc446a9 | thoughtworks/talisman | /scanner/scanner_test.go | Go | go | 886 | permissive | package scanner
import (
"io/ioutil"
"testing"
logr "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
func init() {
logr.SetOutput(ioutil.Discard)
}
func Test_getBlobsFromChannel(t *testing.T) {
ch := make(chan []string)
go func() {
ch <- []string{
"100644 blob 351324aa7b3c66043e484c2f... |
867d0bd3b5b1f3e2f81cb28aebf9f4fa64fcbc97 | 5379bbdb74c2f86e1f3bd0c0d498e8bcddbf2cac | wattli/istio | /vendor/github.com/open-policy-agent/opa/storage/path.go | Go | go | 3,279 | permissive | // Copyright 2016 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
package storage
import (
"fmt"
"net/url"
"strconv"
"strings"
"github.com/open-policy-agent/opa/ast"
)
// Path refers to a document in storage.
type Pat... |
b3c1f99a8123b9a0aa31d69e033070457219915d | 7b6d1e70bd2998c4a27614d689dcce96b952f9b0 | mmirecki/kubevirt | /pkg/virt-launcher/monitor_test.go | Go | go | 5,061 | permissive | /*
* This file is part of the KubeVirt project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
d788710a446fc0072de0a8a49ff5b89970135f2b | 3aacdc2ed8a64b4b16e010f284c1ba9625504aa2 | xu-cell/caskdb | /master/master.go | Go | go | 10,047 | no_license | package main
import (
. "caskdb/protocol"
"compress/gzip"
"flag"
"fmt"
"github.com/robfig/config"
"io"
"log"
"math"
"net"
"net/http"
_ "net/http/pprof"
"os"
"runtime"
"sort"
"strconv"
"strings"
"text/template"
"time"
)
var conf *string = flag.String("conf", "conf/example.ini", "config path")
var deb... |
fda1979a39a9fd2d1aa38d16ae02ba916ff72541 | bf48624b99813d8cdcb5b7f4d313c3a0e983cdfe | MadAppGang/go_logger_reference | /requestprocessor/report/report_service.go | Go | go | 931 | permissive | package report
import (
"fmt"
"net/http"
"strings"
"go_logger_reference/requestprocessor/db"
"go_logger_reference/requestprocessor/user"
"go.uber.org/zap"
)
func NewReportService(source *db.DBSource) *ReportService {
return &ReportService{dbSource: source}
}
type ReportService struct {
dbSource *db.DBSourc... |
8c5745e9539980f853ea6d65546987a83ba52f9b | ad6a99480a13b88afb8a08774919127659e37aee | alvaropinot/gitbase | /partition.go | Go | go | 6,241 | permissive | package gitbase
import (
"io"
"github.com/src-d/go-borges"
"github.com/src-d/go-mysql-server/sql"
errors "gopkg.in/src-d/go-errors.v1"
)
// partitioned is an embeddable helper that contains the methods for a table
// that is partitioned by repository.
type partitioned struct{}
func (partitioned) Partitions(ctx ... |
c02814500c69a46d55b41ec1e22cfbf633988123 | 284edfc1ddbf8cb955dd5407ebae311870213d13 | 1569501393/go-api | /artisan/cli/cli.go | Go | go | 679 | no_license | package cli
import (
"github.com/wuyan94zl/go-api/artisan/command"
"github.com/wuyan94zl/go-api/artisan/crud"
"github.com/wuyan94zl/go-api/artisan/model"
"github.com/wuyan94zl/go-api/artisan/queue"
)
type Command interface {
Run() error
GetDir() string
}
func NewArtisan(command []string) Command {
return getC... |
f02483fcbb1ff3c0ee6be999958430e1aca3dcef | 1220557b6963f36c65862a44e63523efe80d734c | peternga/metricproxy | /protocol/csv/csvforwarder.go | Go | go | 3,749 | permissive | package csv
import (
"os"
"sync"
"context"
"encoding/json"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/datapoint/dpsink"
"github.com/signalfx/golib/errors"
"github.com/signalfx/golib/event"
"github.com/signalfx/golib/pointer"
"github.com/signalfx/golib/trace"
"github.com/signalfx/metr... |
54ea5dedd929e5410f38a4247a27a16f719b3b65 | 0aaa7df02a1562ec805f583cc6211a6def9f2b58 | best-expendables-v2/router | /middleware/request_id_test.go | Go | go | 2,429 | no_license | package middleware
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/best-expendables-v2/trace"
)
func TestRequestID_FromHeaders(t *testing.T) {
next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if requestID := trace.RequestIDFromContext(r.Context()); requestID == ... |
86f3a9abf6c074490e329584b175f0f23b04c736 | 97b73e006e0c6b21aef5dc2344d8889a16c45e17 | winadiw/go-bookings | /internal/handlers/setup_test.go | Go | go | 3,706 | no_license | package handlers
import (
"encoding/gob"
"fmt"
"html/template"
"log"
"net/http"
"os"
"path/filepath"
"time"
"github.com/alexedwards/scs/v2"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"github.com/justinas/nosurf"
"github.com/winadiw/go-bookings/internal/config"
"github.com/winadiw/go-book... |
2224793ebccae7d45a940489e56b9ed9a95f0dfc | 855acfdccd73f03e97e1e53c09f677467ccec54f | paultcn/ProtocolStack | /src/time/time.go | Go | go | 363 | permissive | //go:generate mockgen -source=time.go -destination=time_mock.go -package=$GOPACKAGE -self_package=github.com/42milez/ProtocolStack/src/$GOPACKAGE
package time
import "time"
var Time ITime
type ITime interface {
Now() time.Time
}
type timeProvider struct{}
func (timeProvider) Now() time.Time {
return time.Now()
... |
87f5f08bf06983e2613e6e675d5154959661e5c4 | ec716d529be26d3b867593c7d10e840b288dfe0f | openshift/client-go | /vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/packages.go | Go | go | 9,693 | permissive | /*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
4c00f6b558e9f99427cecc6a05137ab7a9ae7d17 | 74c7281dc59236009fd325f649d7c2ebb308a18e | awsdocs/aws-doc-sdk-examples | /go/example_code/sqs/sqs_sendmessage.go | Go | go | 2,414 | permissive | // snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
// snippet-sourceauthor:[Doug-AWS]
// snippet-sourcedescription:[Sends a message to an SQS queue.]
// snippet-keyword:[Amazon Simple Queue Service]
// snippet-keyword:[Amazon SQS]
// snippet-keyword:[SendMessage function]
// snipp... |
0f4734b892a92020125d94e8625cc120a5a98989 | 934d1ea46d24609aa15b2303c53370f795193cb3 | inwinstack/pango | /netw/profile/mngtprof/fw.go | Go | go | 4,114 | permissive | package mngtprof
import (
"fmt"
"encoding/xml"
"github.com/inwinstack/pango/util"
)
// FwMngtProf is a namespace struct, included as part of pango.Client.
type FwMngtProf struct {
con util.XapiClient
}
// Initialize is invoked when Initialize on the pango.Client is called.
func (c *FwMngtProf) Init... |
76cd44a704ca203c971806e2624d7a7f46de4162 | 021da72c5542740d93a1ef215f6058ed8ddb792d | seqizz/restic | /internal/errors/errors.go | Go | go | 1,409 | permissive | package errors
import (
"net/url"
"github.com/cenkalti/backoff/v4"
"github.com/pkg/errors"
)
// New creates a new error based on message. Wrapped so that this package does
// not appear in the stack trace.
var New = errors.New
// Errorf creates an error based on a format string and values. Wrapped so that
// thi... |
36b821d4cb1c1e33e38120c0ae658aeaf7be6f47 | 710fd78b2bae39af886ccd4181071552afb50ccd | sagikazarmark/go-sundheit | /checks/ping.go | Go | go | 1,315 | permissive | package checks
import (
"context"
"net"
"github.com/pkg/errors"
gosundheit "github.com/AppsFlyer/go-sundheit"
)
// Pinger verifies a resource is still alive.
// This would normally be a TCP dial check, a db.PingContext() or something similar.
type Pinger interface {
PingContext(ctx context.Context) error
}
//... |
1f8cce5a5d192507e25a4ae8c363a825dfb748ed | e91b1a4209f338ff1c542ca4c3316382f6e76ebe | ninedraft/erratic | /pkg/gen/imports.go | Go | go | 396 | permissive | package gen
import "go/ast"
type Import struct {
Name string
Path string
}
func PlainImport(path string) Import {
return Import{Path: path}
}
func (pkg Import) S(name string) ast.Node {
return &ast.SelectorExpr{
X: Ident(pkg.Name),
Sel: Ident(name),
}
}
func (pkg Import) AST() *ast.ImportSpec {
return ... |
53d4c4eae3c61314d4b64c8bc2834cc0bd911983 | b606392f52166049913ad4249b536a4689743d9c | jpwhitemn/edgex-go | /internal/pkg/infrastructure/redis/provisionwatcher.go | Go | go | 9,308 | permissive | //
// Copyright (C) 2021 IOTech Ltd
//
// SPDX-License-Identifier: Apache-2.0
package redis
import (
"encoding/json"
"fmt"
pkgCommon "github.com/edgexfoundry/edgex-go/internal/pkg/common"
"github.com/edgexfoundry/go-mod-core-contracts/v2/common"
"github.com/edgexfoundry/go-mod-core-contracts/v2/errors"
"github... |
75aaabb13b083f2f5d83c8afe42e3764f20d2541 | 891e0193090708989bfa585e5ddf2dbb94907cf0 | mkleina/snap-plugin-collector-procstat | /procstat/pid.go | Go | go | 1,488 | permissive | package procstat
import (
"errors"
"fmt"
"io/ioutil"
"strconv"
"strings"
)
// Pid queries for the pids configured for metrics collection
type Pid interface {
GetPid() (int32, error)
MarkFailed()
GetName() string
}
type filePid struct {
filepath string
name string
pid int32
failed bool
}
// Ne... |
397ada4a496b0e821f2fa56b3401363f203d1afd | b7ac30273b434623a1a873a98df44c247cfe82a9 | Mohamedemad4/goroslib | /pkg/msgs/tf2_msgs/actionlookuptransform.go | Go | go | 645 | permissive | //nolint:golint
package tf2_msgs
import (
"time"
"github.com/aler9/goroslib/pkg/msg"
"github.com/aler9/goroslib/pkg/msgs/geometry_msgs"
)
type LookupTransformActionGoal struct {
TargetFrame string
SourceFrame string
SourceTime time.Time
Timeout time.Duration
TargetTime time.Time
FixedFrame string
Ad... |
f10679cd42982078fd746761fa5c8a82de4c546e | de8ec88e2f9c652df7e7c852fc980c3fd93a5833 | giovanialtelino/tutorialEdgeGoVideos | /advTestGo/main_test.go | Go | go | 1,048 | no_license | //+build unit
package main
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
)
type AddResult struct {
x int
y int
expected int
}
var addResults = []AddResult{
{1, 2, 3},
}
func TestAdd(t *testing.T) {
for _, test := range addResults {
result := Add(test.x, test.y)... |
a4c8548674522ee5d8a8d96a013537c5bbce6868 | b587668e5f885adc1ffacf00ebd5818edc964961 | lockcp/longurl | /utils/encode.go | Go | go | 408 | permissive | package utils
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
func Encode(num uint64) string {
var bytes []byte
for num > 0 {
bytes = append(bytes, chars[num%62])
num = num / 62
}
reverse(bytes)
return string(bytes)
}
func reverse(a []byte) {
for left, right := 0, len(a)-1; lef... |
d42aac20f51a2615fb80f5ca672d09c71469cfc0 | 34943f0a56fa2f8bf990bba3600fbd8226454187 | riagrawal/Cmpe273-Fall2015-Lab2 | /lab2.go | Go | go | 1,071 | no_license | package main
import (
"github.com/julienschmidt/httprouter"
"net/http"
"encoding/json"
"io/ioutil"
)
type req_struct struct{
Name string
}
func post(rw http.ResponseWriter, req *http.Request, p httprouter.Params) {
body, err := ioutil.ReadAll(req.Body)
if err != nil {
http.... |
61fa8d1d929d259c60ed2b7eaf7ad9c4d9571f29 | 4b4b0aca8080f88394d7a23159cd0e6d8d269c6b | Horneth/liftbridge | /server/partition.go | Go | go | 41,238 | permissive | package server
import (
"context"
"fmt"
"math/rand"
"path/filepath"
"strconv"
"sync"
"sync/atomic"
"time"
"github.com/Workiva/go-datastructures/queue"
"github.com/nats-io/nats.go"
"github.com/pkg/errors"
client "github.com/liftbridge-io/liftbridge-api/go"
"github.com/liftbridge-io/liftbridge/server/comm... |
5769c48e243c4f7171a65f957d3a8eb31fd4a198 | 0b717532796cd3e6d8e78083620a83e2b168a9a8 | pnegahdar/sporedock | /settings/paths.go | Go | go | 519 | no_license | package settings
import (
"github.com/mitchellh/go-homedir"
"os"
"path"
)
var ProjectBaseDir, _ = homedir.Expand(path.Join("~/.config/", AppName))
func GetProjectPath(addon_path string) string {
return path.Join(ProjectBaseDir, addon_path)
}
func GetInstanceIdConfPath() string {
return GetProjectPath("INSTNACE... |
4561b02efdd7ed00de90851921e927b75241a01d | 6c137c98cc8b81b0d42e0823fd8ee817ee3e1c34 | priteshtest/go-glide-example | /vendor/github.com/openshift/origin/Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/server_test.go | Go | go | 14,699 | 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 law or agreed to in ... |
8f6556a86ab2fc80720f36ab718b9d6d3a0efe0d | f48abe7f5ded262ec32ba2fc8320d6787043eecd | bcrochet/kni-installer | /pkg/types/baremetal/defaults/platform.go | Go | go | 401 | permissive | package defaults
import (
"github.com/openshift-metalkube/kni-installer/pkg/types/baremetal"
)
const (
LibvirtURI = "qemu:///system"
IronicURI = "http://localhost:6385/v1"
)
// SetPlatformDefaults sets the defaults for the platform.
func SetPlatformDefaults(p *baremetal.Platform) {
if p.LibvirtURI == "" {
p.Li... |
96e535ad16e63d540fe3f1e8c566b49a4b91d4de | b8fb8a1d957884f1064d280783c513f6245267fd | loocor/zdmin | /api/internal/handler/sys/user/userlisthandler.go | Go | go | 574 | no_license | package handler
import (
"net/http"
"zdmin/api/internal/logic/sys/user"
"zdmin/api/internal/svc"
"zdmin/api/internal/types"
"github.com/tal-tech/go-zero/rest/httpx"
)
func UserListHandler(ctx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserList... |
70ac3c40033c10d25b7fef356f279bf249f318c2 | e9b78ac76dc9a519272ae5ddfbfc9ab88657400b | kevin-brown/docker | /daemon/daemon_unix.go | Go | go | 40,262 | permissive | // +build linux freebsd
package daemon
import (
"fmt"
"io/ioutil"
"net"
"os"
"path/filepath"
"runtime"
"runtime/debug"
"strconv"
"strings"
"syscall"
"time"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/container"
"github.com/docker/docker/image"
"github.com/docker/docker/layer"
"github.com/d... |
5a14dc44b2abdab7b7eda923ce166dd45db44589 | 28e120d18b8fc4880b7fe7d62b16ca56b5496067 | f4814/piston | /protocol/connection.go | Go | go | 3,391 | permissive | package protocol
import (
"bytes"
"fmt"
"io"
"net"
"strconv"
log "github.com/sirupsen/logrus"
)
type State int
//go:generate stringer -type=State .
const (
Uninitialized State = iota
Handshaking
Play
Status
Login
)
type Direction int
//go:generate stringer -type=Direction .
const (
Clientbound Direc... |
6169a629878e5020f3d360ecc37aab77f7f9851d | e8416953395d10268e86ec4efb3a3a6fa47e555a | asu126/summary | /src/82_deleteDuplicates.go | Go | go | 729 | no_license | /**
* Definition for singly-linked list.
* type ListNode struct {
* Val int
* Next *ListNode
* }
*/
func deleteDuplicates(head *ListNode) *ListNode {
m := make(map[int]int)
var node *ListNode = head
for node != nil {
m[node.Val]++
node = node.Next
}
var root, ... |
d4d57b8f53b042ea68bdaba42c385b4f1ea0d92c | ca70b5c132717f93c727f0444e2844a9827c93f5 | jiamaozheng/postgres-operator | /cmd/pgo/api/test.go | Go | go | 1,733 | permissive | package api
/*
Copyright 2018 - 2020 Crunchy Data Solutions, 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... |
65b5304fcb9d39f532ce4dc2b83811c3efa804de | 02b579b2b817d5b0ed3e87551613b95edf6d3cf6 | drgarridus/gitlab-ci-validate | /gitlab-ci-validate.go | Go | go | 4,086 | permissive | package main
import (
"encoding/json"
"flag"
"fmt"
"github.com/ghodss/yaml"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"runtime"
"strings"
)
type lintResponse struct {
Status string `json:"status"`
Errors []string `json:"errors"`
}
type Validation int
const (
// file passed remote validation
PASS ... |
c757d2f7a897ba14506fd62c6ee83f472758ffe0 | 8436035ba2aa1dea6483ec5fb534c4fa55af0e1a | DeuroIO/blockchain_go | /blockchain.go | Go | go | 7,097 | permissive | package main
import (
"bytes"
"crypto/ecdsa"
"encoding/hex"
"errors"
"fmt"
"log"
"os"
"github.com/boltdb/bolt"
)
const dbFile = "blockchain_%s.db"
const blocksBucket = "blocks"
const genesisCoinbaseData = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"
// Blockchain implements intera... |
c568e9f4a449ec61846e2a6e294f5ba24bb7af1b | 73e7f51cb262c0bd8a34d995412dd0922f5e284c | xyproto/workingdir | /workingdir.go | Go | go | 2,195 | permissive | package workingdir
import (
"io/ioutil"
"os"
"os/exec"
"strings"
)
type Dir struct {
path string
}
// Create a new "working directory" struct
func New(path string) (*Dir, error) {
// Check if we can enter the given path
err := os.Chdir(path)
if err != nil {
return nil, err
}
// Get the full path
fullpat... |
8151f59ffe2beb6841186a1871f3052a7ffe563a | eaf76ea528faa223becaba7e2a1c38eb80c529bd | katzien/go-structure-examples | /modular/storage/storage.go | Go | go | 1,003 | permissive | package storage
import (
"github.com/katzien/go-structure-examples/modular/beers"
"github.com/katzien/go-structure-examples/modular/reviews"
)
// Type defines available storage types
type Type int
const (
// JSON will store data in JSON files saved on disk
JSON Type = iota
// Memory will store data in memory
M... |
402986f2fac0dd6f0acb81b152dc4ffd75e9464f | 93d35ca545144db17eb1f8838a1686614a1645c9 | wreese/valuestore | /Godeps/_workspace/src/github.com/gholt/ring/tcp_msg_ring.go | Go | go | 5,503 | permissive | package ring
import (
"errors"
"log"
"math"
"net"
"sync"
"time"
)
const _DEFAULT_CHUNK_SIZE int = 16 * 1024
const _DEFAULT_TIMEOUT time.Duration = 2 * time.Second
type ringConn struct {
Conn net.Conn
Writer *timeoutWriter
sync.Mutex
}
func newRingConn(conn net.Conn, chunkSize int, timeout time.Duration) ... |
8713e3ef612d1601964fb7fe7f869eb9c1ac618a | ff5c609889ab7b2fce26f82f518213fe51576116 | sahanabalappa/packer-builder-arm-image | /vendor/github.com/hashicorp/packer/template/parse.go | Go | go | 12,826 | permissive | package template
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
"sort"
"strings"
multierror "github.com/hashicorp/go-multierror"
"github.com/hashicorp/packer/packer/tmp"
"github.com/mitchellh/mapstructure"
)
// rawTemplate is the direct JSON document format of the template file.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.