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 |
|---|---|---|---|---|---|---|---|---|
10cd88a4ef2af83154456ba325cad66cee3ff735 | c409fba4a6f9874f9f40c896fd527df0ed3dc23d | lsankar4033/rumor | /control/actor/peer/metadata/pong.go | Go | go | 4,038 | permissive | package metadata
import (
"context"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/protolambda/rumor/control/actor/base"
"github.com/protolambda/rumor/control/actor/flags"
"github.com/protolambda/rumor/p2p/rpc/methods"
"github.com/protolambda/rumor/p2p/rpc/reqres... |
e955e03f2696bdc7ddd79c19cc8d9a775c17dab7 | 06e99efd07eab4d5606219c45ed6262a18e54852 | ochanje210/OHLC-chart | /server/main.go | Go | go | 2,470 | no_license | package main
import (
"io"
"io/ioutil"
"log"
"net/http"
"time"
"github.com/gorilla/websocket"
)
var historicCandlestick []byte
var last1MinTransaction []byte
var upgrader = websocket.Upgrader{}
var allowedOrigins = [2]string{"http://localhost:3000", "http://13.125.151.218:3000"}
func keepFetchingHistoricCan... |
9c447ed0a8d6878317f5b04d4974be0d12146103 | 750e13d9f5651b0de27ad09cef3ac24e7b16591b | hidehalo/leetcodes | /number_of_lines.go | Go | go | 605 | no_license | package main
import (
"fmt"
)
func numberOfLines(widths []int, S string) []int {
if len(S) <= 0 {
return []int{0, 0}
}
units := 0
lines := 1
for _, alpha := range S {
step := widths[alpha-97]
units += step
flag := units / 100
next := units % 100
if flag > 0 && next > 0 {
lines++
units = step
... |
e077543248757e667445664f357b7ad093d5df5f | cd608943583b060b0b8951162f660a0806262e0f | marun/origin | /vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion/securitycontextconstraints.go | Go | go | 5,539 | 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, ... |
b4e103d7c8c3556768c114dcd5b3340a68472aa2 | 7c99a9cd7cb5cd8802c6ed9a960546b158f65420 | apiheat/akamai-cli-cpcodes | /main.go | Go | go | 2,479 | permissive | package main
import (
"os"
common "github.com/apiheat/akamai-cli-common"
edgegrid "github.com/apiheat/go-edgegrid"
log "github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
var (
apiClient *edgegrid.Client
appName, appVer string
)
func main() {
app := common.CreateNewApp(appName, "A CLI to manage Ak... |
1e9f43fc35d5adf502e134c8fb449aaefe76c9d0 | 0f65d0375ba3c837f943fe937479017b7ebd99d8 | cosmos-cg-key-management/cosmos-sdk | /store/queue/queue.go | Go | go | 2,161 | permissive | package store
// TODO: make it independent from list
/*
import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/store/list"
)
// Key for the top element position in the queue
func TopKey() []byte {
return []byte{0x02}
}
// Queue is a List wrapper that... |
a3a336d2bbf8a71268c5caf41716f52cdf427a3c | af8951704255cac3aa00ace879bbf5478951e236 | yeshsurya/runtime | /virtcontainers/sandbox_test.go | Go | go | 41,129 | permissive | // Copyright (c) 2016 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package virtcontainers
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"reflect"
"sync"
"syscall"
"testing"
"github.com/stretchr/testify/assert"
"github.com/kata-containers/runtime/v... |
eca153f34a0b5e9aada9d558bee364fe2ef72d67 | 09bddfb9779f4c41f2867ec87ab223d4c45d5826 | StirlingMarketingGroup/go-helpscout | /conversations.go | Go | go | 9,443 | no_license | package helpscout
import (
"errors"
"fmt"
"net/url"
"strconv"
"time"
)
const (
reqPhotoUnknown = "unknown"
reqPhotoGravatar = "gravatar"
reqPhotoTwitter = "twitter"
reqPhotoFacebook = "facebook"
reqPhotoGoogleProfile = "googleprofile"
reqPhotoGooglePlus = "googleplu... |
528e58ec8dc87dff58f9f9bba94189c1360f3615 | 05680ca1ba25fa4ffc67d69bb611c4b05ed2c148 | fengpf/goro | /core/outputfunc.go | Go | go | 528 | permissive | package core
import "github.com/MagicalTux/goro/core/phpv"
//> func void echo ( string $arg1 [, string $... ] )
func stdFuncEcho(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {
for _, z := range args {
ctx.Write([]byte(z.String()))
}
return nil, nil
}
//> func int print ( string $arg )
func fncPrint(... |
03a9501eeeccff49a3bff63470bd27597592ddb8 | 56347411b3cda52c700aadf13d211a7b9d65f8b4 | sgtest/monorepo-test-3 | /kubernetes-14/pkg/registry/apps/petset/storage/storage_test.go | Go | go | 5,684 | 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, ... |
d18a8ad7eba95e7faa09ca156f05948fe999cf61 | 0836411900303db4f71ac3a206e5f618edd2b9cc | CodeLingoBot/smart-relayer | /vendor/github.com/gallir/shortlivedpool/lfstack.go | Go | go | 912 | permissive | package shortlivedpool
import (
"runtime"
"sync/atomic"
"unsafe"
)
type Element struct {
value interface{}
next unsafe.Pointer
}
type LFStack struct {
head unsafe.Pointer
len int64
}
func NewStack() *LFStack {
return &LFStack{}
}
func (s *LFStack) Push(value interface{}) {
nElem := &Element{}
nElem.val... |
6f162bd875d4939ea4c237af776d57d02e6703f2 | 50d3a2a646174a1e6726f410dc67f2f3bd9a8ed9 | jackypan1989/esbuild | /internal/bundler/bundler_test.go | Go | go | 6,414 | permissive | package bundler
// Bundling test results are stored in snapshot files, located in the
// "snapshots" directory. This allows test results to be updated easily without
// manually rewriting all of the expected values. To update the tests run
// "UPDATE_SNAPSHOTS=1 make test" and commit the updated values. Make sure to
/... |
a0541de258a1523df6ee76932e6b391f502187cb | 3278ca1151c4ab0a6f02ac0a0d6dc30cd18f28dc | sgtest/monorepo-test-3 | /kubernetes-11/pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion/thirdpartyresource.go | Go | go | 5,498 | 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, ... |
4ba9364342e7ba0eb92d983301550097296ae572 | 619d9dca2160477f3985a06653deef3f57b1631b | SharperShape/mapbox-go | /client.go | Go | go | 1,870 | permissive | package mapbox
import (
"encoding/json"
"io"
"net/http"
"net/url"
"regexp"
"strings"
"time"
"github.com/pkg/errors"
)
type SortBy string
const (
SortByCreated SortBy = "created"
SortByModified SortBy = "modified"
)
type HTTPClient interface {
Do(req *http.Request) (*http.Response, error)
}
type Client... |
1107eeb9c5c01159ad505d06e976562f10bec091 | dc89271c01d5d32623ba37bae53b9344eadd3b3a | Houwenda/goids | /config/configParser.go | Go | go | 3,913 | no_license | package config
import (
"errors"
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
"regexp"
)
type Ui struct {
Enable bool `yaml:"enable"`
Ip string `yaml:"ip"`
Port int32 `yaml:"port"`
Location string `yaml:"location"`
DbPath string `yaml:"db_path"`
}
type Rules struct {
PktRules []string `yaml:"pk... |
5cb06c24e9e4c60d01b68a8a997206d1a090fbde | 77b7737628b237788805597b79a2faccecf7c53e | int128/kubelogin | /pkg/testing/httpserver/httpserver.go | Go | go | 664 | permissive | package main
import (
"log"
"net/http"
"github.com/int128/kubelogin/pkg/usecases/authentication/authcode"
)
func main() {
http.HandleFunc("/BrowserSuccessHTML", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("content-type", "text/html")
_, _ = w.Write([]byte(authcode.BrowserSuccessHTML))
})
... |
48b241d9f4cd2aadf1499d54beb3fbb4617ecdb0 | ed3d12303ba5f932119d306e5aed5c5703ffe075 | SmartPool/smartpool-client | /cmd/experiments/optimized_epoch.go | Go | go | 3,578 | permissive | package main
import (
"bufio"
"encoding/hex"
"fmt"
"github.com/SmartPool/smartpool-client"
"github.com/SmartPool/smartpool-client/ethereum/ethash"
"github.com/SmartPool/smartpool-client/ethereum/geth"
"github.com/SmartPool/smartpool-client/mtree"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com... |
e92b1474af1342e404f7d532cfe3427f740275e5 | c779a6f587858afe08347bc01c1f7353b89d0994 | grabnerandi/keptn | /distributor/cmd/main_test.go | Go | go | 6,063 | permissive | package main
import (
"fmt"
"github.com/cloudevents/sdk-go/pkg/cloudevents"
"github.com/cloudevents/sdk-go/pkg/cloudevents/types"
"github.com/nats-io/nats-server/v2/server"
natsserver "github.com/nats-io/nats-server/v2/test"
"github.com/nats-io/nats.go"
"net/http"
"net/http/httptest"
"net/url"
"os"
"reflect... |
53e3dc20b79c9bb7a744df36379367c63fe08909 | 31760ee40e83ea71c903b148674964a3677221ec | cbrulak/Freyr | /oauth/google_oauth.go | Go | go | 1,963 | permissive | package oauth
import (
"encoding/json"
"github.com/serdmanczyk/freyr/models"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"net/http"
)
const (
profileInfoURL = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json"
userInfoScope = "https://www.googleapis.com/auth/userinfo.email"
)
// GoogleOauth defi... |
b415a0429b384b69f8ac63cde5d543993da2fd6d | e41b420c987faae098f7671cb4981cef5d8b4178 | grtl/mysql-operator | /vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go | Go | go | 9,841 | permissive | /*
Copyright 2015 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, ... |
5aedfece5bdfa241f73f8832bc280929f89d5d77 | e1f6adda87ef568a6b9372a72890729106782a22 | jayay/bio-rd | /protocols/isis/packet/tlv_ip_interface_addresses.go | Go | go | 1,813 | permissive | package packet
import (
"bytes"
"fmt"
"github.com/bio-routing/bio-rd/util/decode"
"github.com/bio-routing/tflow2/convert"
)
// IPInterfaceAddressesTLVType is the type value of an IP interface address TLV
const IPInterfaceAddressesTLVType = 132
// IPInterfaceAddressesTLV represents an IP interface TLV
type IPInt... |
342d082781e1b2d0d06d823adf397ffffdae7f9a | 1872c93471a0c2bfa0a16339eadda84a5d8dc80a | orbs-network/scribe | /log/filters_test.go | Go | go | 3,093 | no_license | // Copyright 2019 the orbs-network-go authors
// This file is part of the orbs-network-go library in the Orbs project.
//
// This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
// The above notice should be included in all copies or substantial portion... |
805037f06de361e3876dd9fdd1b0f026ea61b9d8 | 0e6b16b3878d594a27764c8e42d6de773154e14e | ssuh0o0/GoLang | /ch24/ex24.4/ex24.4.go | Go | go | 711 | no_license | //ch24/ex24.4/ex24.4.go
package main
import (
"fmt"
"sync"
"time"
)
var mutex sync.Mutex // ❶ 패키지 전역 변수 뮤텍스
type Account struct {
Balance int
}
func DepositAndWithdraw(account *Account) {
mutex.Lock() // ❷ 뮤텍스 획득
defer mutex.Unlock() // ❸ defer를 사용한 Unlock()
if account.Balance < 0 {
panic(fmt.Sprin... |
dc5b54ea761a9a210dc03fc61351f5795fb40ce2 | a1611bdc3ecdafbba8e54faae69bd0bf43693de6 | decentralized-identity/kerigo | /pkg/direct/connection.go | Go | go | 1,042 | permissive | package direct
import (
"encoding/json"
"log"
"net"
"github.com/pkg/errors"
"github.com/decentralized-identity/kerigo/pkg/encoding"
"github.com/decentralized-identity/kerigo/pkg/event"
"github.com/decentralized-identity/kerigo/pkg/keri"
)
type conn struct {
reader encoding.Reader
conn net.Conn
writer en... |
20241e1ffa8fb08329f65cee9b83bc7e9e07b678 | b1199b7368168bf6d51602af52c25ab2e606e497 | rohan-prasad/magma | /feg/gateway/services/session_proxy/credit_control/gy/gy_client.go | Go | go | 17,157 | permissive | /*
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
*/
// GyClient is a client to send Credit Control Request messages over diameter
// And receive Credit Control Answer m... |
ed34113ebc0a216d84480ba9f75d4fe2ae1bbc8e | a05617fa92e7b1467b6873e82a0da5cb2de5fae7 | sapcc/kubernetes-operators | /openstack-seeder/vendor/k8s.io/client-go/pkg/apis/certificates/v1beta1/zz_generated.deepcopy.go | Go | go | 5,281 | permissive | // +build !ignore_autogenerated
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... |
bd5b17a324ace88e2b652a650a4d2c5ead28c055 | 11d56eb7e59c3a24ff08428bc62a4e542a39a10f | chrisbenson/epic | /pkg/epic/handlers.go | Go | go | 18,606 | permissive | package epic
import (
"context"
"encoding/json"
//"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
//"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
//"github.com/gorilla/context"
"github... |
26f4ff98407aca76a0c591db9f290a45c9ab091d | 28a44c38da777e82780dc109bafba03d2a62e81e | gitter-badger/gopa | /core/util/idutil_test.go | Go | go | 1,277 | permissive | /*
Copyright 2016 Medcl (m AT medcl.net)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
efb0f6efc2d3bd1e7755c7235518eec6c5c4dd4d | 1ace60d024055403735747c2bcd8eda60f9cc78c | moisespsena-go/xssh | /common/upgrade.go | Go | go | 4,516 | permissive | package common
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"gopkg.in/yaml.v2"
"github.com/go-errors/errors"
)
type UpgradePayload struct {
Ok bool
Changed bool
Stream bool
StreamSize int64
URL string
Err error
}
func (up *UpgradePayload) Read(in io.Reader) (r io.Reader, e... |
c33c5ea4d268819d9f7f046a4c98118e29e90222 | 66de5795a88db27dceb38f50d5b02ab0d5815325 | turboceo/189Cloud-Downloader | /main.go | Go | go | 3,576 | permissive | package main
import (
"os"
"sort"
"github.com/urfave/cli/v2"
)
var version string
func main() {
var app = &cli.App{
Name: "189Cloud-Downloader",
Usage: "一个189云盘的下载器。(支持分享链接)",
EnableBashCompletion: true,
Commands: cli.Commands{
{
Name: "login",
Usage: "... |
b9981f9b3b355eca484395b52a7a6633432f1eba | 4eb3c81648af9f5f7091ce330b7ee81af0e26efe | reud/agouti | /api/internal/bus/client_test.go | Go | go | 10,121 | permissive | package bus_test
import (
"errors"
"io/ioutil"
"net/http"
"net/http/httptest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/reud/agouti/api/internal/bus"
)
var _ = Describe("Session", func() {
var (
requestPath string
requestMethod string
requestBody string
re... |
766f364c623e4e0287cea79c49f88bc2f912d2a6 | a1003b4c4da382f4fa1d97232692c7720deec992 | ThePaw/chroma | /i16/rgb16/_tst/01_test.go | Go | go | 3,107 | permissive | // Copyright 2012 The Chroma Authors. All rights reserved. See the LICENSE file.
// With step = 32 it will run about 3 days. Be careful when adjusting step: step /=2 --> time *=8
// You will have to run 'go test -test.timeout 120h'.
package rgb16
import (
"fmt"
"math"
"testing"
)
func check_diff(x, y, acc uint16)... |
d25fea646902f7a42959ee73c1296a2100f06a7d | 849313862a79ce62710c0b35dfbad9f9cb666280 | juicemix/golang_api_training | /entities/auth/auth.go | Go | go | 1,841 | no_license | package auth
import (
"net/http"
"strings"
"time"
"golang_api/common"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"github.com/dgrijalva/jwt-go"
"github.com/labstack/echo"
)
type login struct {
Userid string `bson:"id" json:"id"`
Password string `bson:"password" json:"password"`
}
type Handler struct{}
f... |
7e1b3c17ada63c810321cb9d49ceaefb7f8578ee | 57eb8c6c4ddd183fd1a9b17312ab47f5a4c63679 | andrideng/inventory-system | /apis/importCsv.go | Go | go | 1,126 | no_license | package apis
import (
"github.com/andrideng/inventory-system/app"
"github.com/andrideng/inventory-system/models"
"github.com/go-ozzo/ozzo-routing"
)
type (
importCsvService interface {
ImportProducts(rs app.RequestScope) ([]models.Product, error)
ImportIncomingGoods(rs app.RequestScope) ([]models.IncomingGood... |
97fdb8935d9e01c5df295d8151a588d7161354b8 | 8af5698d7709b310a9e665e24854e6ffa5ccbf5f | sshagy/ocp-offer-api | /internal/repo/repo.go | Go | go | 4,644 | no_license | package repo
import (
"context"
"fmt"
"unsafe"
sq "github.com/Masterminds/squirrel"
"github.com/jmoiron/sqlx"
"github.com/opentracing/opentracing-go"
"github.com/ozoncp/ocp-offer-api/internal/models"
utils "github.com/ozoncp/ocp-offer-api/internal/utils/models"
)
type IRepository interface {
MultiCreateOff... |
0fe8a6776146f9303f05f852a657e06f403a6b26 | 4a6818d90e28677efc08e804e5ed585dee6695a5 | alastria/monitor | /vendor/github.com/ory-am/hydra/sdk/client_opts.go | Go | go | 1,950 | permissive | package sdk
import (
"io/ioutil"
"net/url"
"gopkg.in/yaml.v2"
)
type hydraConfig struct {
ClusterURL string `yaml:"cluster_url"`
ClientID string `yaml:"client_id"`
ClientSecret string `yaml:"client_secret"`
}
// FromYAML loads configurations from a YAML file
func FromYAML(file string) option {
return f... |
3070945d746ab900b82015f3693d080b569952e6 | 3601aa511c5fdc0bd287c647318954b8c45acb6a | Ryan--Yang/fabric | /core/container/ccintf/ccintf.go | Go | go | 2,167 | permissive | /*
Copyright IBM Corp. 2016 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 wri... |
44c0471d8fb715b71552afa4d1c368d657713a81 | cf5995771fbced07b086acd5865e4e146b59e4c8 | ccDev-Labs/go-elasticsearch | /.doc/examples/src/search-search_614a5520d02b015e33b86f85e38a5342_test.go | Go | go | 1,401 | permissive | // Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// Code generated, DO NOT EDIT
package elasticsearch_test
import (
"fmt"
"os"
"strings"
"testing"
"git... |
aa0a1ee2f998d8e8d68ecc2c520534e7eef3c2bf | 20f5f83c58e9f5da259ced91ba1f0980ff257d44 | atkins126/go-codes | /go-lang-test/chan/main.go | Go | go | 786 | permissive | package main
import (
"fmt"
"time"
)
func main() {
//chan1()
//chan2()
//chan3()
chan4()
}
func chan1() {
ch := make(chan int, 1)
ch <- 2
close(ch)
if v, ok := <-ch; ok {
fmt.Println(v)
}
}
func chan2() {
ch := make(chan int, 1)
go func() {
for i := 0; i < 3; i++ {
v, _ := <-ch
fmt.Println(... |
88850c3aa4956f8cddcf0b56ff0b4ceca36ceb2d | 4ba17e77e1b1045f02a3d84282f52419ee7c0c5f | egorikas/insolar | /network/gateway/gateway_test.go | Go | go | 6,215 | permissive | //
// Modified BSD 3-Clause Clear License
//
// Copyright (c) 2019 Insolar Technologies GmbH
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted (subject to the limitations in the disclaimer below) provided that
// the following conditions a... |
73cbe7a63277027f0608d5a208606ebbe52a4be4 | 0cb1c1520941e3d0e1337bbf47934698d2b41a73 | webitel/cdr_metrics | /app/app.go | Go | go | 1,303 | no_license | package app
import (
"github.com/webitel/cdr_metrics/gateway"
"github.com/webitel/cdr_metrics/model"
"github.com/webitel/cdr_metrics/mq"
"github.com/webitel/cdr_metrics/mq/rabbit"
"github.com/webitel/cdr_metrics/utils"
"github.com/webitel/wlog"
"sync"
)
type App struct {
Log *wlog.Logger
config mode... |
1dd38259f779bbe4198738685446b98eb6eaa577 | fae2481eef416199bb408ad19d122548213de204 | sgtest/monorepo-test-3 | /kubernetes-8/pkg/volume/configmap/doc.go | Go | go | 754 | permissive | /*
Copyright 2015 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, ... |
166229cdef6bc994812df3402234d3caed0dcbac | 7fea76fb5ddd9c9d3b8685667aaadf8f86687241 | mittpatel/go-smpp | /vendor/github.com/linxGnu/gosmpp/PDU/Outbind.go | Go | go | 2,127 | permissive | package PDU
import (
"fmt"
"github.com/linxGnu/gosmpp/Data"
"github.com/linxGnu/gosmpp/Exception"
"github.com/linxGnu/gosmpp/Utils"
)
type Outbind struct {
Request
systemId string
password string
}
func NewOutbind() *Outbind {
a := &Outbind{}
a.Construct()
return a
}
func (c *Outbind) Construct() {
def... |
c1428db6aa0e67d4d9ca3535a05b9fcef5327418 | 765545e5d802f12f84c7205967fc164494a7ad7d | Mxxim/go-ycsb | /db/badger/db.go | Go | go | 7,135 | permissive | // Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
5fde173c2f37a3b10d87a73abee97c0098d333a7 | 857681fceda706623a6933fa4f08d8bd99382034 | cristian-sima/Wisply | /controllers/admin/harvest.go | Go | go | 6,458 | no_license | package admin
import (
"fmt"
"strconv"
harvest "github.com/cristian-sima/Wisply/models/harvest"
repository "github.com/cristian-sima/Wisply/models/repository"
ws "github.com/cristian-sima/Wisply/models/ws"
)
var (
hub *ws.Hub
conduit = make(chan harvest.ProcessMessager, 100)
)
// CurrentSessions contains... |
e702a2f5fcfa70fdcd1c964a270c10df931f89b7 | ba95403385742c9647e3cbcee871bbff9e4e6285 | matthewlujp/audiube | /src/youtube_data_v3/video_client_test.go | Go | go | 7,996 | no_license | package youtube
import (
"fmt"
"net/http"
"os"
"reflect"
"testing"
"time"
"github.com/golang/mock/gomock"
mock "github.com/matthewlujp/audiube/src/youtube_data_v3/mocks"
)
const (
searchResultJSONPath = "./mocks/data/search_result.json"
searchDetailsJSONPath = "./mocks/data/search_details.json"
related... |
ae8187ac99000162145154586f3cc92b852b9683 | 0b27bd2f0a35bab97948bb94d57d5b67ca3b0c1b | Youngju-Heo/gomedia | /sdl2/ttf/sdl_ttf_test.go | Go | go | 1,183 | permissive | package ttf
import (
"math/rand"
"testing"
"github.com/Youngju-Heo/gomedia/sdl2/sdl"
)
var characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ `!@#$%^&*()-=~_+[]\\{}|;':\",./<>?"
func randomString(t *testing.T) string {
s := ""
length := 16 + rand.Int()%16
for i := 0; i < length; i++ {
s += ... |
1de0bcf57a68db42c55e26bc6a9fad99586dcefe | 316f508e68a3ddcf52f66842b4b89d9f38334718 | Tryweirder/gvisor | /pkg/tcpip/link/muxed/injectable.go | Go | go | 4,778 | permissive | // Copyright 2019 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
c1f15b64040d4769a664b61ae66f81ddf7b741e5 | e4dd4bca6d87aca534eca95d49223c8b9d9e1dd5 | lovelly/gleam | /sql/ast/ast.go | Go | go | 6,149 | permissive | // Copyright 2015 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
deb4dc216be8458f1acc9900cbad6c20972c6a9e | bbfb17bf68b5135c93fa69b5ee5cd0e92a5a1d99 | adrianwit/golang-data-testing | /ab_testing_use_case/helper.go | Go | go | 282 | no_license | package viant
import (
"math/rand"
"math"
)
func randInt(min, max int) int {
return min + int( math.Round(float64(max - min) * float64(rand.Intn(10000)) / 10000.0))
}
func randFloat(min, max float64) float64 {
return min + (max - min) * float64(rand.Intn(10000)) / 10000.0
}
|
c15f85519373263e27f5a706465dac2f35867d9a | e05609f30ae4861e66ecdacf436cad4d1e6ddd48 | sitedata/kato | /api/handler/LicenseHandler_test.go | Go | go | 1,895 | permissive | // Copyright (C) 2021 Gridworkz Co., Ltd.
// KATO, Application Management Platform
// 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 r... |
0c4d5fc0732b917076442c25453ed1c9a50bff2f | dfad9431c25a6b572c18e6a76524bbd2191b7472 | adamturn/go-microservice | /handlers/hello.go | Go | go | 414 | no_license | package handlers
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
type Hello struct {
l *log.Logger
}
func NewHello(l *log.Logger) *Hello {
return &Hello{l}
}
func (h *Hello) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
h.l.Println("Hello, World!")
d, err := ioutil.ReadAll(r.Body)
if err != nil {
h... |
91ff91e04943a320686ba53902df8d8798473e94 | f021fbb66b87a0472a6c2fbc2fb876c6427e7372 | me2140733/datasets | /pkgs/ncbi-datasets-cli/src/datasets/dataformat/Reports.go | Go | go | 14,763 | permissive | package dataformat
import (
"bytes"
"errors"
"fmt"
"sort"
"strings"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
pb_options "ncbi/datasets/options"
pb_reports "ncbi/datasets/v1/reports"
)
type FieldDesc struct {
name string
fieldNumber protoreflect.F... |
b6e0f66aea37bc5cc373684065b248a27c14e6c6 | e01762e9d78c46e4204bde3ed37e1d08f750fd6f | eldarion-gondor/cli | /vendor/github.com/flynn/flynn/Godeps/_workspace/src/github.com/docker/docker/pkg/ioutils/temp_windows.go | Go | go | 426 | permissive | // +build windows
package ioutils
import (
"io/ioutil"
"github.com/flynn/flynn/Godeps/_workspace/src/github.com/docker/docker/pkg/longpath"
)
// TempDir is the equivalent of ioutil.TempDir, except that the result is in Windows longpath format.
func TempDir(dir, prefix string) (string, error) {
tempDir, err := io... |
47359e01375edf63ff305139151c976f37a3a161 | 36f8a8dd60ae6827bb9c0b2bd363e65559b2f612 | determined-ai/determined | /master/pkg/union/unmarshal.go | Go | go | 2,194 | permissive | package union
import (
"encoding/json"
"reflect"
"strings"
"github.com/pkg/errors"
)
// Unmarshal unmarshals the provided union type from a JSON byte array.
func Unmarshal(data []byte, v interface{}) error {
value := reflect.ValueOf(v)
expectedFields := make(map[string]bool)
unionTypes, err := parseUnionTypes... |
a827429c39bbe4b354f944bafde67c8cb09dc98b | c63d63fa13b8e803fdd3fbeb8316676c9eedf120 | makhmudislamov/coinbase | /main.go | Go | go | 940 | no_license | package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
response, err := http.Get("https://api.coinbase.com/v2/prices/spot?currency=USD")
if err != nil {
fmt.Printf("The HTTP request failed with error %s\n", err)
} else {
data, _ := ioutil.ReadAll(response.Body)
fmt.Pr... |
605f2bc9df3223f9aa1fd78696711f601acfc986 | b417dc8fef86cd904d627bba40af2fc324c27b07 | alecdwm-forks/matterircd | /config/config.go | Go | go | 705 | permissive | package config
import (
"github.com/BurntSushi/toml"
"github.com/Sirupsen/logrus"
)
var Logger *logrus.Entry
type Config struct {
Debug bool
Bind string
BindInterface string
BindPort int
TLSBind string
TLSDir string
Insecure bool
SkipTLSVerify bool
DefaultServer str... |
977b25a66a155e92650577c81e865593c053b2c3 | fd39db7941a01268b375b9a6cba5636894acb688 | fightingfish008/GoApiserver | /pkg/mod/github.com/go-playground/locales@v0.12.1/en_MP/en_MP_test.go | Go | go | 19,303 | permissive | package en_MP
import (
"testing"
"time"
"github.com/go-playground/locales"
"github.com/go-playground/locales/currency"
)
func TestLocale(t *testing.T) {
trans := New()
expected := "en_MP"
if trans.Locale() != expected {
t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale())
}
}
func TestPluralsRan... |
4e78b21557d7158eeabacfde37f3412e761796cd | 483d6d03b61ce3b98cf943899af873ff34e9cc9e | C-Pro/wallet-test | /models/payment_test.go | Go | go | 7,065 | no_license | package models
import (
"database/sql"
"fmt"
"math/rand"
"sync"
"testing"
"time"
"github.com/shopspring/decimal"
)
func makeAccount(tx *sql.Tx, currencyID int64, amount string) Account {
amountD, _ := decimal.NewFromString(amount)
a := Account{CurrencyID: currencyID, Amount: amountD, Name: randomName()}
if... |
2d54ca42a4370af0db76cdf6d1210d6ea8747d78 | 58b8266dedd12cc7aab45d04948fbd8788f5795e | psasidhar/athenz | /libs/go/sia/aws/options/options.go | Go | go | 31,633 | permissive | //
// Copyright The Athenz 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... |
a8d9e480843298d67a08ff90d715fa6bfcfe2214 | b7ff688094004669477d82bad68ff354e5fa8e39 | radanalyticsio/kubespark-operator | /vendor/k8s.io/client-go/rest/config.go | Go | go | 13,911 | 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, ... |
60b8db7ed2045b48c14faeb367d088d438028015 | c3b01084041cb9989277e2df4d37cf4d4abafa9f | chanwit/ignite | /vendor/github.com/weaveworks/gitops-toolkit/pkg/git/errors/errors.go | Go | go | 2,222 | permissive | package errors
import (
"encoding/json"
"errors"
)
// Representation of errors in the API. These are divided into a small
// number of categories, essentially distinguished by whose fault the
// error is; i.e., is this error:
// - a transient problem with the service, so worth trying again?
// - not going to work... |
8946e3bd555218433dfa0bc832966f723c669778 | 9d13bc9ed59ab159167a672e053c347fc2e2ca7c | basa-casa/gitea | /routers/init.go | Go | go | 5,949 | permissive | // Copyright 2016 The Gitea 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 routers
import (
"context"
"fmt"
"strings"
"time"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/migrations"
"code.gitea.io/gitea/... |
d05573e1a917a2a1146badcbddce2b9fd09b2a31 | df54cd6971aea7f54d635c298c79e2c61ae2ad70 | openark/cockroach | /pkg/storage/store_test.go | Go | go | 87,650 | permissive | // Copyright 2014 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
599f1da432852154e431747a398315674c7d205a | 16d4ba2a17374aef5b52116e11760bba778a967a | soywod/archive | /helpers_test.go | Go | go | 513 | no_license | package archive
import (
"testing"
)
func TestHelper(t *testing.T) {
var tests = []struct {
path string
ok bool
}{
{"tests/data/fileA.txt", true},
{"tests/data/folder", true},
{"tests/data/empty.txt", false},
{"tests/data/noexists.txt", false},
}
for _, test := range tests {
err := fileExistsAnd... |
7d9990d723e877ca86097f00a916e4abac788871 | 7bdc3c8698939b5368e9a258b2765f151d3822fd | sguiheux/cds | /engine/worker/init.go | Go | go | 8,252 | permissive | package main
import (
"crypto/tls"
"fmt"
"net/http"
"os"
"strconv"
"strings"
"time"
"github.com/spf13/cobra"
"github.com/facebookgo/httpcontrol"
"golang.org/x/net/context"
"google.golang.org/grpc"
"github.com/ovh/cds/sdk"
"github.com/ovh/cds/sdk/cdsclient"
"github.com/ovh/cds/sdk/log"
)
const (
envF... |
3c17d5f8b74fdbb06e48f022385bc4c972a3d293 | d3ddd16115597fbb1d967beb3ddc2c159df2007a | esboych/microservices-book | /bookstore_oauth-api/app/application.go | Go | go | 508 | no_license | package app
import (
"github.com/esboych/microservices-book/bookstore_oauth-api/http"
"github.com/esboych/microservices-book/bookstore_oauth-api/reposiroty/db"
"github.com/esboych/microservices-book/bookstore_oauth-api/src/domain/access_token"
"github.com/gin-gonic/gin"
)
var (
router = gin.Default()
)
func Sta... |
03a3f30b0132e10ff1466c7932bf1cbf7da37f0b | c40bd189d2519dd65bd912a877f0e068d73254bd | zyxpaomian/go-http-framev2 | /http/server.go | Go | go | 1,583 | no_license | package http
import (
"github.com/gorilla/mux"
log "go-http-frame/common/formatlog"
"net/http"
"reflect"
"runtime"
"go-http-frame/common"
"go-http-frame/controller"
)
type WWWMux struct {
r *mux.Router
}
func New() *WWWMux {
return &WWWMux{r: mux.NewRouter()}
}
func (m *WWWMux) GetRouter() *mux.Router {
r... |
770756c0f15f37da14fa898edd93215e2cd841c2 | 4bc30d42aa3759925546db99954a72d4e1ad8dac | TylerTang06/Go-000 | /Week06/rolling_counter.go | Go | go | 3,469 | no_license | package week06
import (
"math"
"sync"
"time"
)
// RollingCounter contains some common aggregation function.
// Each RollingCounter can compute summary statistics of window.
type RollingCounter interface {
// Min finds the min value within the window.
Min() float64
// Max finds the max value within the window.
... |
fccb90ae4e0ccd186ff3403481701a28455e7335 | 2c53cbb22554557862925f9f7b5625943a068f4b | timob/gospark | /org_apache_spark_storage_DiskBlockManager.go | Go | go | 2,868 | permissive | package gospark
import "github.com/timob/javabind"
type StorageDiskBlockManagerInterface interface {
JavaLangObjectInterface
// public java.lang.String logName()
LogName() string
// public boolean isTraceEnabled()
IsTraceEnabled() bool
// public int subDirsPerLocalDir()
SubDirsPerLocalDir() int
// public ... |
158ae5e627b27924411207571d13bbd8205108b5 | d3af0497066a6d4fca33e7628221a07a8f268a4c | gdzy1987/micro-mesh | /examples/common/plugin_istio.go | Go | go | 1,452 | permissive | // +build istio
package common
import (
"time"
"github.com/grpc-ecosystem/go-grpc-middleware/recovery"
"github.com/grpc-ecosystem/go-grpc-middleware/retry"
"github.com/hb-go/grpc-contrib/metadata"
_ "github.com/hb-go/grpc-contrib/registry/istio"
"google.golang.org/grpc"
)
var (
metadataOptions = []metadata.O... |
034e2c38402b2da8da4ad358d453c6e105894658 | 196cf36986c717c457b309f7578019d4006b85c5 | coontash/Fabric-Chinese | /common/grpclogging/fakes/echo_service.go | Go | go | 5,711 | permissive |
//此源码被清华学神尹成大魔王专业翻译分析并修改
//尹成QQ77025077
//尹成微信18510341407
//尹成所在QQ群721929980
//尹成邮箱 yinc13@mails.tsinghua.edu.cn
//尹成毕业于清华大学,微软区块链领域全球最有价值专家
//https://mvp.microsoft.com/zh-cn/PublicProfile/4033620
//伪造者生成的代码。不要编辑。
package fakes
import (
context "context"
sync "sync"
testpb "github.com/hyperledger/fabric/common/gr... |
147627ac68bd595a41280b6ffb9faed56fd0f5fb | d50488ead3ea9d442fad7429d5e6c6606841dab4 | tanema/amore-examples | /platformer/game/game_object.go | Go | go | 702 | permissive | package game
import (
"sort"
"github.com/tanema/ump"
)
type (
gameObject interface {
update(dt float32)
tag() string
destroy()
push(strength float32)
damage(intensity float32)
draw(bool)
updateOrder() int
}
By func(b1, b2 *ump.Body) bool
bodySorter struct {
bodies []*ump.Body
by f... |
b0f68e3cb5565827f154145750851e2a0537b0d1 | 623d72ccffa78262e3ff1c08c6ff52de978db924 | danielbh/beego | /adapter/session/redis_cluster/redis_cluster.go | Go | go | 4,097 | permissive | // Copyright 2014 beego Author. 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... |
760ab8749235f254c54e5cd9228d369ffb140c76 | dd2f45db8a0eb264563599291549496808a5ed82 | real420og/pgo | /str.go | Go | go | 3,052 | permissive | package pgo
import (
"errors"
"net/url"
"strings"
)
type replaceParams struct {
search interface{}
replace interface{}
subject string
count int
countSlices int
}
// StrIReplace replaces all occurrences of the search case-insensitive string|slice with the replacement string
// If search and... |
01c41d9662bb72f7f1f2dba8a63fdee391463689 | 7e0b54a087ee220f7025c1e73e2b515b6b730311 | Monet-Network/monetd | /poa/bytecode.go | Go | go | 49,837 | permissive | package genesis
// This code is generated externally as part of each release.
// The exact toolset is specified to allow the compilation environment to be recreated to
// verify this build
const (
// SolcCompilerVersion is the solc version used to compile this bytecode
SolcCompilerVersion = "Version: 0.5.11+c... |
f84a14b012581292f208ff57f4f2ac3aa060e378 | 5de2247010ef8fbc60b66b04f850b4be01ffa36e | Pchelolo/ratelimit | /test/service/ratelimit_legacy_test.go | Go | go | 13,048 | permissive | package ratelimit_test
import (
"testing"
pb_struct_legacy "github.com/envoyproxy/go-control-plane/envoy/api/v2/ratelimit"
pb_struct "github.com/envoyproxy/go-control-plane/envoy/extensions/common/ratelimit/v3"
pb_legacy "github.com/envoyproxy/go-control-plane/envoy/service/ratelimit/v2"
pb "github.com/envoyprox... |
f9a54abb77a3e74d310cb35a341d439aae3e9344 | 2aa20902547a0c06631c075b6d0e64f637f5973c | sapcc/kubernetes-operators | /prometheus-fusion/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go | Go | go | 24,957 | permissive | // +build !ignore_autogenerated
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... |
92f7f5673d321971155aca33d4aed9c3ce263ddc | dc53c67ef652e40463109edfbd01d8f08c77322b | andrewmelchor/fission | /pkg/fission-cli/cmd/environment/delete.go | Go | go | 1,913 | permissive | /*
Copyright 2019 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... |
3cadd1226fedf42a1f8eae72ccef291e7e488a36 | c8015b47199c23458d4d86beab219443cd551f4b | stackpath/kubevirt | /tests/access_test.go | Go | go | 16,294 | 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... |
e7ca200550cb560bfd6bccf418a7c3cc5f0073ee | b9f52aef5ec197b7ff99dcd7f22d2bdf2a2658f8 | estromenko/ChatAPI | /server/userRouting.go | Go | go | 747 | no_license | package server
import (
"api/entities"
"api/utils"
routing "github.com/qiangxue/fasthttp-routing"
)
// GetCurrentUser ...
func (s *Server) GetCurrentUser() routing.Handler {
return func(c *routing.Context) error {
user, ok := c.Get("user").(*entities.User)
if !ok {
return utils.Respond(c, 401, map[string]... |
b9ae185a8073b38a20544fb1b8d88676fabab4e7 | 00d5ea0f0645b43d670b884c3a72bccd850bb10a | buntafujikawa/go-tour | /structs.go | Go | go | 323 | no_license | package main
import "fmt"
type Vertex struct {
X, Y int
}
var (
v1 = Vertex{1, 2}
v2 = Vertex{X: 1} // xのみ1で初期化、yは0
v3 = Vertex{}
p = &Vertex{1, 2}
)
func main() {
v := Vertex{1, 2}
v.X = 4
fmt.Println(v.X)
z := Vertex{1, 2}
p := &z
p.X = 1e9
fmt.Println(z)
fmt.Println(v1, p, v2, v3)
}
|
870c6d07b8eee76259a507570e8b04afba582737 | 6898c2e448ff2e87c095f130cffe853926459bb9 | JFixby/pfcd | /blockchain/compress.go | Go | go | 21,852 | permissive | // Copyright (c) 2015-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package blockchain
import (
"github.com/picfight/pfcd/pfcec"
"github.com/picfight/pfcd/txscript"
)
// ---------------------------------------------------------------... |
9b4747fd33c888637e95c9212dafb07dba55b759 | 9aeb5d14508c5333366be7846ba53c5309bb5f10 | alexunit42TF/gojay | /decode_stream_test.go | Go | go | 13,867 | permissive | package gojay
import (
"context"
"errors"
"io"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
// Basic Behaviour Tests
//
func TestDecoderImplementsContext(t *testing.T) {
var dec interface{} = &StreamDecoder{}
_ = dec.(context.Context)
}
func TestDecodeStreamNoReader(t *testing.T) {
dec := Stream... |
fde9af10a7bdc3eea031a94d7d4d3341904f6612 | f6c5cb90c08441531d8eb9d03bcb840f0d41f757 | kayasmith106/simple-go-microservices | /api/book_test.go | Go | go | 1,778 | no_license | package api
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBookToJSON(t *testing.T) {
book := Book{Title: "Cloud Native Go", Author: "M.-L. Reimer", ISBN: "0123456789"}
json := book.ToJSON()
assert.Equal(t, `{"title":"Cloud Native Go","author":"M.-L. Reimer","isbn":"0123456789"}`, string(jso... |
68e0ab8e784d8d68a57c401a9055dfcfc5cef513 | 4fff9c3b9e9a8d396659d85b4ec409b9735747ab | benhe119/singularity | /e2e/pull/pull.go | Go | go | 13,049 | permissive | // Copyright (c) 2019, 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.
// This file has been migrated from cmd/singularity/pull_tes... |
4034a98613266b758eb065ac6792bb792fc385cb | e9278a20429c8ac614373f1cbdf290aeeb888b31 | amitizle/atlantis | /server/events/project_command_builder_test.go | Go | go | 11,342 | permissive | package events_test
import (
"io/ioutil"
"path/filepath"
"testing"
. "github.com/petergtz/pegomock"
"github.com/runatlantis/atlantis/server/events"
"github.com/runatlantis/atlantis/server/events/mocks"
"github.com/runatlantis/atlantis/server/events/models"
vcsmocks "github.com/runatlantis/atlantis/server/even... |
a2a41c89bd6f87e5e64bbeeea693b3a9e2887e4d | 879c6420f66003fa76c236d87409a0a6b0c016c2 | wangkui0508/tendermint | /consensus/common_test.go | Go | go | 26,610 | permissive | package consensus
import (
"bytes"
"context"
"fmt"
"os"
"path/filepath"
"sort"
"sync"
"testing"
"time"
"github.com/go-kit/log/term"
"github.com/stretchr/testify/require"
"path"
dbm "github.com/tendermint/tm-db"
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/... |
d7d85e13648e1ae4bd68bee5a04996d9acce541c | 0d4d24736e4c38098afb2edb83f398e4477eff99 | ofauchon/tinygo | /src/reflect/type.go | Go | go | 22,313 | permissive | // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package reflect
import (
"unsafe"
)
// The compiler uses a compact encoding to store type information. Unlike the
// main Go compiler, most of the types are ... |
616d8728bfa76191619e7e0d31f98ed9f44b9373 | 8d0216fd6ce75076d36aed7ee9a46984f20884db | ricelang/kocircuit | /lang/go/sys/compile-play.go | Go | go | 1,646 | permissive | package sys
import (
. "github.com/kocircuit/kocircuit/lang/circuit/eval"
. "github.com/kocircuit/kocircuit/lang/circuit/ir"
. "github.com/kocircuit/kocircuit/lang/circuit/model"
. "github.com/kocircuit/kocircuit/lang/go/eval/macros"
. "github.com/kocircuit/kocircuit/lang/go/eval/symbol"
"github.com/kocircuit/ko... |
e254540237801bb63d57aeaca8691b2c40ba98ff | 80a8a3836f7dba7b0768e88f10dfac0f1dabb58c | erwinloar92/client | /go/engine/common_test.go | Go | go | 13,555 | permissive | // Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package engine
import (
"crypto/rand"
"encoding/hex"
"errors"
"fmt"
"github.com/keybase/client/go/externalstest"
"github.com/keybase/client/go/libkb"
"github.com/keybase/client/go/protocol/k... |
acd8986a93388fff58f58465bc7d1fa3d0771e29 | fe529f492468f8f370df9f1f316d222f9edf002f | z505/goDomainSpecificLanguage | /dsl.go | Go | go | 14,451 | no_license | // Embed a toy language (jokeLang) DSL inside go code, however the DSL has some
// disadvantages like having to use quotes around certain syntax, and commas.
// However a text editor could easily convert snippets of text to the correct
// syntax if programmer got tired of comma/quote syntax for the DSL.
// How it w... |
3df41dbae1fdc9d6bf6ffc474d53290dad9d998f | 518db1b695e774daa0d74ffbe52a7f58bf7c4057 | clearcodecn/free | /pkg/ext/domain.go | Go | go | 687 | no_license | package ext
import (
"errors"
"free/config"
"net"
"strings"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
)
func WithDomainConfig() gin.HandlerFunc {
return func(ctx *gin.Context) {
host := ctx.Request.Host
if strings.Contains(host, ":") {
host, _, _ = net.SplitHostPort(host)
}
if domain ... |
959d502f4a80767e83c953300ae87fede96235b4 | db448cc4b9871764bda4baaf9238a0556de655a1 | allofthesepeople/plugins | /goakit/examples/fetcher/archiver/cmd/archiver/main.go | Go | go | 3,099 | permissive | package main
import (
"context"
"flag"
"fmt"
"net/url"
"os"
"os/signal"
"strings"
"sync"
"github.com/go-kit/kit/log"
archiver "goa.design/plugins/goakit/examples/fetcher/archiver"
archiversvc "goa.design/plugins/goakit/examples/fetcher/archiver/gen/archiver"
health "goa.design/plugins/goakit/examples/fetc... |
5d65e475b88bc29684c8edce6c683a7125fb46ad | a1213dd8530203a8b6036ac685b929f8982ddff7 | genius52/leetcode | /src/golang/number/2240. Number of Ways to Buy Pens and Pencils.go | Go | go | 314 | no_license | package number
func waysToBuyPensPencils(total int, cost1 int, cost2 int) int64 {
var res int64 = 0
for i := 0;cost1 * i <= total;i++{
rest := total - cost1 * i
if rest == 0{
res++
}else if rest > 0{
if rest /cost2 > 0{
res += int64(rest /cost2) + 1
}else{
res++
}
}
}
return res
} |
ff78ddd311d40eb40fd616fddadcddaaa59bff36 | e1ba37d5ecc456b92169f743579d57c15732d0ed | bradylove/inigo | /volman/volman_suite_test.go | Go | go | 4,552 | permissive | package volman_test
import (
"encoding/json"
"os"
"testing"
"fmt"
"path"
"path/filepath"
"code.cloudfoundry.org/garden"
"code.cloudfoundry.org/inigo/helpers"
"code.cloudfoundry.org/inigo/world"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/ginkgoreporter"
"code.cloudfoundry.org/lager/lagerte... |
202f1d82e9242c2faed01eb5b3d6f4f58940da26 | a9aace0d10a58533a22ffb4ed66300bb23bd2ef4 | whatisfaker/nacos-client | /cmdable.go | Go | go | 999 | no_license | package nacos
type ServiceCmdable interface {
//RegisterInstance 注册实例
RegisterInstance(ip string, port uint, serviceName string, params ...Param) error
//DeregisterInstance 销毁实例
DeregisterInstance(ip string, port uint, serviceName string, params ...Param) error
//GetService 获取服务
GetService(serviceName string, la... |
d7417b6e5ca35e6b2116d4b569b29e301eb90450 | 7da055c9bd60cb55aef2a23323a36f4da80a4cf3 | dylanpeng/iris-api-server | /src/common/service/gateway_service.go | Go | go | 916 | no_license | package service
import (
"juggernaut/common"
"juggernaut/common/consts"
"juggernaut/common/exception"
"juggernaut/common/method"
jGateway "juggernaut/lib/proto/juggernaut/service/gateway"
)
var GatewayGrpc = &gatewayGrpcSrv{}
type gatewayGrpcSrv struct{}
func (s *gatewayGrpcSrv) Push(id int64, name string) (rs... |
72471666b62f3d899e7e301707fdcd86f7c56e4c | 4d644de9b9832db03688a40e117574eb97bbf684 | aristanetworks/openconfigbeat | /vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/error.go | Go | go | 2,762 | 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 ... |
446478ecfd9aa4487281e5e3105803d6dd415d33 | 64d95709cf6baddfec1e7b0eb02cf3644fa1cae1 | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/apimanagement/v20200601preview/tag.go | Go | go | 4,027 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20200601preview
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Tag Contract details.
type Tag struct {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.