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 |
|---|---|---|---|---|---|---|---|---|
085ec97f7a4ccb2991054c003f54eed78cb11f78 | 3036f16da719272d1b011a13b54636c75999e219 | mfateev/cadence | /service/history/handler.go | Go | go | 54,387 | 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... |
755e279d13ead042a612873edf691e53c1f181f1 | e870805e66ed3ecece89992c677059f0352a7afd | amitech/linkerd2 | /test/integration/localhost/localhost_test.go | Go | go | 3,249 | permissive | package localhost
import (
"context"
"encoding/json"
"fmt"
"os"
"testing"
"time"
"github.com/linkerd/linkerd2/testutil"
)
type jsonStats struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
Success *float64 `json:"success"`
Rps *float6... |
a4830f03297f361f045525daaf100085b7819f41 | cd3f19142e242a1b0a0dded282244c7128f8d238 | microsoftgraph/msgraph-beta-sdk-go | /users/item_planner_plans_planner_plan_item_request_builder.go | Go | go | 11,468 | permissive | package users
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
i20a3050780ee0b0cde0a884a4f35429a20d60... |
27023c0d6a17d7bc218521235969c92e3ed40758 | 0c42ba504584e805f64383bfb7c270279e358d5c | yandex-cloud/ydb-go-sdk | /meta_test.go | Go | go | 1,038 | permissive | package ydb
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/metadata"
)
func TestMetaRequiredHeaders(t *testing.T) {
m := &meta{
database: "database",
requestsType: "requestType",
credentials: CredentialsFunc(func(context.Context) (string, error) {
return ... |
07f04493991a2668c9e75bd98977d7d884c568b8 | 7397d2012a8e794a1cf6a6c0746fc7650f4abd8f | lesroad/crontab | /worker/JobMgr.go | Go | go | 4,468 | no_license | package worker
import (
"context"
"crontab/common"
"fmt"
"time"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/mvcc/mvccpb"
)
// 任务管理器
type JobMgr struct {
client *clientv3.Client
kv clientv3.KV
lease clientv3.Lease
watcher clientv3.Watcher
}
var (
// 单例
G_jobMgr *JobMgr
)
// 监听任务变化
func (jobMgr *... |
06879b5bca2db4b466e9931f06f45bff2c60d005 | 5116399c3263aec5e829fe46f9ece1929418ecde | noseka1/kubernetes | /pkg/registry/core/podtemplate/storage/storage_test.go | Go | go | 3,952 | permissive | /*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
ae25f33a81c6a78acaea42df8e70575f5e5ef4e1 | ac3a83eac4746ba1b8f4e5d2b268cd6ca8353815 | Cosydays/goLearn | /src/day02/01for/main.go | Go | go | 404 | no_license | package main
import "fmt"
//流程控制之跳出for循环
func main() {
//当i=5时就跳出for循环
for i := 0; i < 10; i++ {
if i == 5 {
break //跳出for循环
}
fmt.Println(i)
}
fmt.Println("over")
//当i=5时,跳过此次for循环(不执行for循环内部的打印语句)
for i := 0; i < 10; i++ {
if i == 5 {
continue
}
fmt.Println(i)
}
fmt.Println("over")
}
|
b5ed06af1e15aaea3ed19e442d6341966c7fdcc8 | fc1edca699b6d66e586b2b5941f15a6b93cf3570 | lwandoIntern/obas | /src/io/address/addressType_io.go | Go | go | 1,499 | no_license | package io
import (
"errors"
"obas/src/api"
domain "obas/src/domain/address"
)
const addressTypeUrl = api.BASE_URL + "/address"
type addressType domain.AddressType
func GetAddresses() ([]addressType, error) {
entites := []addressType{}
resp, _ := api.Rest().Get(addressTypeUrl + "/all")
if resp.IsError() {
r... |
4cb8c60da2f891dfc4ed9d2de4b89ac9141bad5c | 494ef1c8e9ce63bad195f86707c4b4dcb6b634c3 | hongping1224/lidario | /lidarpal/reader.go | Go | go | 922 | permissive | package lidarpal
import (
"math"
"github.com/hongping1224/lidario"
)
//Reader read Pointcloud
type Reader struct {
las *lidario.LasFile
}
//NewReader Create a new Reader
func NewReader(las *lidario.LasFile) *Reader {
return &Reader{las: las}
}
//Read point into channel
func (read *Reader) Read(input chan<- lid... |
3b98df37dc8c2605ebeae92a47802ffc19e8c9e5 | 9890c3dc6aef60ee356a2b11029a98a71364a4a2 | gavinzhou/hello-gin | /routers/routers.go | Go | go | 892 | no_license | package routers
import (
"github.com/gavinzhou/hello-gin/pkg/setting"
"github.com/gavinzhou/hello-gin/routers/api/v1"
"github.com/gin-gonic/gin"
"github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/swaggerFiles"
_ "github.com/gavinzhou/hello-gin/docs"
)
func InitRouter() *gin.Engine {
r := gin.New... |
e0fe2458c26ed75133ec2be35fca0e20e0218aff | 81906b32626b3b01eda0863fb4a0c51848cfeae5 | jz4o/codingames | /go/practice/classic_puzzle/medium/dwarfs-standing-on-the-shoulders-of-giants.go | Go | go | 1,303 | no_license | package main
import "fmt"
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
func main() {
// n: the number of relationships of influence
var n int
fmt.Scan(&n)
relationMap := map[int][]int{}
for i := 0; i < n; i++ {
... |
392bad6db0b2430cbf118898b6cf4082b52b7612 | 8eec5c9a743e33e3f9294b84458674b5822b4690 | falconandy/k8s-cracker | /frontend/service.go | Go | go | 424 | permissive | package main
import (
"context"
"performance-metrics/rpc"
)
type service struct {
cracks chan<- CrackerID
}
func NewService(cracks chan<- CrackerID) rpc.FrontendServiceServer {
return &service{
cracks: cracks,
}
}
func (s *service) NotifyCracked(_ context.Context, r *rpc.NotifyCrackedRequest) (*rpc.NotifyCr... |
225e1af7bde85f41c96c4eaa9c6ddbac8757381a | b5f8709d85054d811f9ea7bf528117bc6c55c6e9 | alibaba/terraform-provider | /vendor/github.com/gogo/protobuf/proto/all_test.go | Go | go | 67,391 | permissive | // Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2010 The Go Authors. All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met... |
4ec7bf5c690b1b66ebb4ce0b21fc3b1c2d519572 | 917d01a37be213669f8b03a27a897e13e68fb359 | roidelapluie/mtail | /vm/bytecode.go | Go | go | 5,357 | permissive | // Copyright 2011 Google Inc. All Rights Reserved.
// This file is available under the Apache license.
// Package vm provides a compiler and virtual machine environment for executing
// mtail programs.
package vm
import "fmt"
type opcode int
const (
bad opcode = iota // Invalid instruction, indicates a bug ... |
401086634ea4fd82a3dbbb54fbd2524aa964ad3f | e234bd46c344321914e7d2fff42ab98298e3d46a | buf1024/go-micro | /client/pool/default.go | Go | go | 2,247 | permissive | package pool
import (
"sync"
"time"
"github.com/google/uuid"
"github.com/micro/go-micro/transport"
)
type pool struct {
size int
ttl time.Duration
tr transport.Transport
sync.Mutex
conns map[string][]*poolConn
}
type poolConn struct {
transport.Client
id string
created time.Time
}
func newPool... |
dd9d6deb6a9123a85d47c5587b6f10024be5fc48 | d54f0d7700a224f3985cb538352bad2d3e2c9f34 | joshuathompson/baton | /api/account.go | Go | go | 3,194 | permissive | package api
import (
"encoding/json"
"io/ioutil"
"log"
"net/url"
"time"
"github.com/spf13/viper"
)
const (
accountsURLBase = "accounts.spotify.com/"
)
// The Tokens struct describes a combination of the items returned from Spotify's API Authorization process as well as Baton-created fields to store in your c... |
cbb11c0854229d400593cc2b06416bad212e873b | 8bc5cead452d824bb931be5a9d76de544dd595a2 | ecnuvj/vhoj_problem | /pkg/service/service_test.go | Go | go | 745 | no_license | package service
import (
"encoding/json"
"fmt"
"github.com/ecnuvj/vhoj_problem/pkg/bootstrap/database"
"github.com/ecnuvj/vhoj_problem/pkg/bootstrap/rpc_client"
"testing"
)
func TestProblemService_GetContest(t *testing.T) {
database.Init()
service := &ProblemService{}
contest, err := service.GetContest(4)
if... |
9cf8ac8bd9196bba111450d73febc5904f4e9932 | dddf72f08675b1fc33c2f3ffa0bb5037a8a32c23 | taemon1337/mantle | /kola/harness.go | Go | go | 15,790 | permissive | // Copyright 2015 CoreOS, 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... |
f7d190cf13f12e7004df641d492ea4c1553031aa | f8e4ed15723d306d31486f3c9a364d9229f7ec24 | dssysolyatin/ssecret | /utils/contextu/ctrlcctx.go | Go | go | 312 | permissive | package contextu
import (
"context"
"os"
"os/signal"
)
func WithCancelCtrlC(ctx context.Context) context.Context {
ctx, cancel := context.WithCancel(ctx)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func() {
select {
case <-c:
}
cancel()
signal.Stop(c)
}()
return ctx
}
|
1b42ddb7da72be96ed60840e8d6258a9b2b38463 | 63e54bce5c1dd32f339ef922ee46928b9b2056ee | NoPlasticWaste/Go | /Values.go | Go | go | 211 | no_license | package main
import "fmt"
func main() {
fmt.Println("go" + "lang")
fmt.Println("1+1=", 1+1)
fmt.Println("7.0/3.0= ", 7.0/3.0)
fmt.Println(true && false)
fmt.Println(true || false)
fmt.Println(!true)
}
|
f8a869d405df9d93f95f5fd11cc0cd8b5bcc0803 | 586d4595390b0941a45fa91d9efe510208eec47d | schrodit/gardener-extension-provider-openstack | /pkg/openstack/types.go | Go | go | 9,268 | permissive | // Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lice... |
dc58616d1aea27e784c300ca2755ad164bbce2c6 | d253eaa213ff363979ff1e7a93644fcb6677e2bd | JonathanMace/user | /api/service_test.go | Go | go | 905 | permissive | package api
import (
"testing"
"github.com/JonathanMace/user/users"
)
var (
TestService Service
TestCustomer = users.User{Username: "testuser", Password: ""}
)
func init() {
TestService = NewFixedService()
}
func TestLogin(t *testing.T) {
}
func TestRegister(t *testing.T) {
}
func TestCalculatePassHash(t... |
62d5246ca5111cc6e0509c09078933d28dfed541 | 023a806657677b6eb390a261e3cb4029d1e6758f | bells17/unsealer | /pkg/kv/aws_kms/options_test.go | Go | go | 2,140 | permissive | /*
Copyright The KubeVault 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, softwa... |
abf5684dca23f1cacdca678c47c85f473a456154 | f9d3d4901fe1b8201ad13c7cb32b52984761966d | feitianlove/multiplePracticeTaking | /leetcode/0121_best-time-to-buy-and-sell-stock/0121_best-time-to-buy-and-sell-stock.go | Go | go | 1,140 | no_license | package main
import "fmt"
/*
给定一个数组 prices ,它的第 i 个元素 prices[i] 表示一支给定股票第 i 天的价格。
你只能选择 某一天 买入这只股票,并选择在 未来的某一个不同的日子 卖出该股票。设计一个算法来计算你所能获取的最大利润。
返回你可以从这笔交易中获取的最大利润。如果你不能获取任何利润,返回 0 。
链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock
*/
func main() {
var arr = []int{7, 1, 5, 3, 6, 4}
fmt.Print... |
fef5f163871a6169c48f5cbeb750d7608b9b4296 | 32a49c524d5453d5ddb29dc8ad05ff9f2024ce28 | thijsheijden/Advent-of-code-in-Go | /Day 11/main.go | Go | go | 5,986 | no_license | package main
import (
"fmt"
"time"
"github.com/thijsheijden/advent_of_code/cmd/reader"
"github.com/thijsheijden/advent_of_code/cmd/timetrack"
"github.com/thijsheijden/advent_of_code/utils/slice"
)
func main() {
lines := reader.ReadInput()
part1(lines)
part2(lines)
}
func part1(l []string) {
defer timetrack... |
777503bc49a08f72f724a2a5b1867404aac64aba | 098797996748714a4e19c8311f053a0ddd81498e | valerian-sky/mssh | /mssh.go | Go | go | 991 | no_license | package main
import (
"flag"
"fmt"
"sync"
//"log"
"os"
log "github.com/sirupsen/logrus"
)
var (
// VERSION 版本信息
VERSION string
// BUILD 构建时间
BUILD string
// COMMITSHA1 git commit ID
COMMITSHA1 string
)
//命令行选项
var (
h = flag.Bool("h", false, "Show this help")
v = flag.Bool("v", false, "Show version")... |
acc9aebebcd2a803d88fd96d4a1277ae7e82a310 | c6a38d1197f4094c687c8a53908c4199a0839766 | ernado-legacy/poputchiki | /database/users_test.go | Go | go | 7,947 | no_license | package database
import (
"log"
"testing"
"time"
"github.com/ernado/poputchiki/models"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
)
func TestUsers(t *testing.T) {
db := TestDatabase()
Convey("Users", t, func() {
Reset(db.Drop)
id := bson.NewObjectId()
birthday := time.Date(1994... |
3dab409f68ae8d5626dca7fda31b875658bb66e6 | b50f93b1310d53a2c9cdcfbd41872e17f447c4b6 | AlexanderSenf/ga4gh_compute_trial | /tes/cmd/task/task.go | Go | go | 4,241 | permissive | package task
import (
"fmt"
"io"
"os"
"strings"
"github.com/ohsu-comp-bio/funnel/cmd/util"
"github.com/ohsu-comp-bio/funnel/tes"
"github.com/spf13/cobra"
)
// NewCommand returns the "task" subcommands.
func NewCommand() *cobra.Command {
cmd, _ := newCommandHooks()
return cmd
}
func newCommandHooks() (*cobr... |
bafb1e1350a3c57a4334e4978c1e7d5d6df52d0c | 127a074614229182fafd42bcacc9210872bf6c85 | esselius/scrap | /exercism/go/error-handling/error_handling.go | Go | go | 500 | no_license | package erratum
func Use(ro ResourceOpener, input string) (err error) {
result, err := ro()
if err != nil {
switch err.(type) {
case TransientError:
return Use(ro, input)
default:
return err
}
}
defer func() {
if r := recover(); r != nil {
switch r.(type) {
case FrobError:
err = r.(FrobE... |
8ded61d9b643bd5d033b9a6fa269529ec4504fff | 651ac55554aae0ac84f238cb58ba9cc5b7fce660 | wp-jackliu/opentaobao | /model/alihealthoutflow/AlibabaAlihealthShortUrlGetAPIResponse.go | Go | go | 906 | permissive | package alihealthoutflow
import (
"encoding/xml"
"github.com/bububa/opentaobao/model"
)
// AlibabaAlihealthShortUrlGetAPIResponse 支付宝短链跳转三方h5通用接口 API返回值
// alibaba.alihealth.short.url.get
//
// 支付宝短链跳转三方h5通用接口
type AlibabaAlihealthShortUrlGetAPIResponse struct {
model.CommonResponse
AlibabaAlihealthShortUrlGetAP... |
1c838bd971402195681fcba179de2998617d7d88 | bb36053360283f20ff08969f8882b295504be9d6 | uditgaurav/litmus | /litmus-portal/graphql-server/pkg/handlers/file_handler.go | Go | go | 4,763 | permissive | package handlers
import (
"errors"
"net/http"
"os"
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
"github.com/litmuschaos/litmus/litmus-portal/graphql-server/pkg/cluster"
dbOperationsCluster "github.com/litmuschaos/litmus/litmus-portal/graphql-server/pkg/database/mongodb/cluster"
"github.com/litmuscha... |
5b957df88c3b3efbeb7217b44b900e71577d7b98 | 50e9e5a1c19747ef8aa70acdf20a2156196a065d | jamiehannaford/kubernetes | /pkg/kubelet/kubelet.go | Go | go | 83,137 | 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, ... |
2dbee73bbe46cd9d578812cd664a64e1e5624914 | d98ab484cafab8386a9c4c637fcc2ac1fb407080 | bbdLe/iGame | /comm/peer/tcp/connector.go | Go | go | 2,817 | no_license | package tcp
import (
"github.com/bbdLe/iGame/comm"
"github.com/bbdLe/iGame/comm/event"
"github.com/bbdLe/iGame/comm/peer"
"github.com/bbdLe/iGame/comm/sysmsg"
"log"
"net"
"sync"
"time"
)
type tcpConnector struct {
peer.SessionManager
peer.CorePeerProperty
peer.CoreContextSet
peer.CoreRunningTag
peer.Cor... |
e0c14a1fb5d1f7cdaae3a7396a488681dcbe588b | 765901f95994b249e036bc68ea848d247a269463 | dolanor-galaxy/youtube | /downloader/downloader_test.go | Go | go | 1,845 | permissive | package downloader
import (
"context"
"log"
"os"
"testing"
"time"
"github.com/kkdai/youtube"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
var testDownloader = func() (dl Downloader) {
dl.OutputDir = "download_test"
dl.Debug = true
return
}()
func TestMain(m *testing.M) {
... |
3006aaadb224de1c9364b7ed1d5f82eeaa6f05f6 | 4814c7c2c26b511af60e9cf031bb9eb2200c0a62 | ncl-tempus/s3s2 | /cmd/share.go | Go | go | 4,910 | permissive | // Copyright © 2019 Matt Konda <mkonda@jemurai.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicabl... |
b313f7f0398c084a2da4729c43be9b3e612551bf | 34c84e8b275ae82297161cf6ed9578ff83ebde26 | animenotifier/notify.moe | /jobs/soundtrack-download/soundtrack-download.go | Go | go | 622 | permissive | package main
import (
"fmt"
"github.com/akyoto/color"
"github.com/animenotifier/notify.moe/arn"
)
func main() {
color.Yellow("Downloading soundtracks")
defer color.Green("Finished.")
defer arn.Node.Close()
for track := range arn.StreamSoundTracks() {
if track.IsDraft {
continue
}
fmt.Println("----... |
78ea7c62d284ef14f28ae90b86e8ccc40c169647 | 595bf69f98220559932cfb75087b57a2275b7f69 | rockyr8/gopl-topics | /7接口/10surface.go | Go | go | 2,797 | no_license | // Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
// See page 203.
// The surface program plots the 3-D surface of a user-provided function.
package main
import (
"fmt"
"io"
"log"
"math"
"net/http"
)
//!+parseAndCheck
import "gopl/7接口/ev... |
3ba7f61c0ff01c0179d6c2c75c754370f20b411e | 5462aa28ac7ba821300c5aedd00c1fea9b8c272b | marcellinamichie291/bitflyergo | /tools.go | Go | go | 2,952 | permissive | package bitflyergo
import (
"fmt"
"sort"
"strconv"
"time"
)
func (bf *Bitflyer) GetChildOrdersByDate(productCode string, from time.Time, to time.Time) ([]ChildOrder, error) {
params := map[string]string{}
params["product_code"] = productCode
params["count"] = "500"
var after int64 = 0
var tmp []ChildOrder
... |
5a548d10b5fa85ca7266e9fbc4c5d822cd54df76 | 5497f5012b1538f533c7eea4c246320c67d5bd41 | opencars/wanted | /pkg/store/teststore/vehicle_repository.go | Go | go | 1,484 | permissive | package teststore
import (
"context"
"github.com/opencars/wanted/pkg/domain/model"
"github.com/opencars/wanted/pkg/domain/query"
)
type VehicleRepository struct {
store *Store
vehicles map[string]*model.Vehicle
}
func (r *VehicleRepository) Create(revision *model.Revision, added []model.Vehicle, removed []s... |
e432785d5c983ff0daaaa434033e8b4b77b3c451 | cb69bcaede3ff546f90b1198384e03ac40acf344 | xia-wu/amazon-ecs-shim-loggers-for-containerd | /logger/buffered_logger_test.go | Go | go | 2,194 | permissive | // Copyright 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 in the "license" file acc... |
e8db5cddb4a3d09014c683fb21951c45d84d37f2 | 6e7a8c822acd68a9ba3d7073a820eb33bdae8f4c | cc322/xuperunion | /vendor/github.com/libp2p/go-buffer-pool/pool.go | Go | go | 2,618 | permissive | // Package pool provides a sync.Pool equivalent that buckets incoming
// requests to one of 32 sub-pools, one for each power of 2, 0-32.
//
// import (pool "github.com/libp2p/go-buffer-pool")
// var p pool.BufferPool
//
// small := make([]byte, 1024)
// large := make([]byte, 4194304)
// p.Put(small)
// p.Put(large)
//
... |
a9feca2671b4dab88c8d1fa76c6a231c5316f5bc | 030a393a942529fecdafcb5c7a9bf722704d247f | caiyesd/tcpstun | /tcpstun/main.go | Go | go | 6,967 | no_license | package main
import (
"fmt"
"io"
"log"
"net"
"os"
"sync"
stun "github.com/caiyesd/tcpstun"
mux "github.com/hashicorp/yamux"
cli "gopkg.in/urfave/cli.v1"
)
const default_stun_port = "27310"
func main() {
log.SetFlags(log.LstdFlags /* | log.Lshortfile*/)
app := cli.NewApp()
app.EnableBashCompletion = tru... |
6fdb70edadb50d0eade95d4184a36750aab8c991 | c4651eee781242889ffeb17cb7138527d1080fe1 | aalekseev-ru/insolar | /ledger/storage/doc.go | Go | go | 723 | permissive | /*
* Copyright 2018 Insolar
*
* 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... |
2ff31c802e71c05f245d71d104d26930200f28f2 | 1995ad7fd7643def76a05a7929143baa00db9efd | AEPi-AK/character-server | /router.go | Go | go | 894 | no_license | package main
import (
"net/http"
"github.com/gorilla/mux"
)
type Route struct {
Name string
Method string
Pattern string
HandlerFunc http.HandlerFunc
}
type Routes []Route
func NewRouter() *mux.Router {
var routes = Routes{
Route{
"CharacterCreate",
"POST",
"/characters/create",
... |
a21463d2358e90d88a35854aaa950f24320dc953 | 1607966f3b478607a24456350729c22f2615d432 | yudaprama/iso20022 | /model/FinancialInstrument23.go | Go | go | 2,215 | permissive | package model
// Security that is a sub-set of an investment fund, and is governed by the same investment fund policy, eg, dividend option or valuation currency.
type FinancialInstrument23 struct {
// Unique and unambiguous identifier of a security, assigned under a formal or proprietary identification scheme.
Iden... |
bf36d882f3c74dd71e394a28315ec2da92c3e5a7 | 2450bae0172a42fb7de06091271131f64250923e | simonfl3tcher/advent-of-code-go | /2015/day-06/day-06-part-2.go | Go | go | 1,115 | permissive | package main
import (
"bufio"
"os"
"regexp"
"strconv"
"strings"
)
func main() {
file, err := os.Open("./day-06-input.txt")
if err != nil {
panic(err)
}
defer file.Close()
scanner := bufio.NewScanner(file)
var grid [1000][1000]int
fromRegex := regexp.MustCompile("\\d+,\\d+")
toRegex := regexp.MustCom... |
99cad2c44aea636ddab73dda5f5d17d43147276c | f24db16f591ef3dd7ba6e931a86939c5a460cf17 | hayabusa-cloud/hybs-server | /application/middleware/admin/auth_root.go | Go | go | 1,290 | permissive | package admin
import (
"bytes"
hybs "github.com/hayabusa-cloud/hayabusa"
"github.com/hayabusa-cloud/hybs-server/application/common"
)
// authRoot is middleware for basic auth
func authRoot() hybs.Middleware {
return func(h hybs.ServiceHandler) hybs.ServiceHandler {
var basicAuthPrefix = []byte("Bearer ")
retu... |
10ec95b3a7b8390eeca6fef9ebd9661b67c716f4 | cfec456b7b1c50939fbdfc09a62a51481cf8036a | dolefir/chatbot-reminder | /models/reminder.go | Go | go | 2,529 | permissive | package models
import (
"encoding/json"
"strings"
"time"
"github.com/dolefir/chatbot-reminder/db"
"github.com/dolefir/chatbot-reminder/dialogflowmap"
)
// Reminder ...
type Reminder struct {
ID uint `gorm:"primary_key"`
Text string `gorm:"NOT NULL"`
Time string
User User `gorm:"associati... |
232ea7b7abcefde694abee50e20b1a4ef0419763 | 9f00887518b7e1c8f564fd0e6e614f5535e0c606 | giantliao/beatles-master | /app/cmd/bpptstrapdel.go | Go | go | 1,834 | permissive | /*
Copyright © 2020 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... |
b57faade651bcad68f189911af8fbcf248d2c7ed | 99c4e377ca99cc3029ce6bc362835736677e85ed | sapcc/kubernetes-operators | /vice-president/cmd/main.go | Go | go | 4,430 | permissive | /*******************************************************************************
*
* Copyright 2019 SAP SE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You should have received a copy of the License along with this
* program. If... |
5ce0f1ffee8d528086814700d2440542e42ec0a5 | db5f3381babc8bddc13212d1acbe0edb101fae75 | go-numb/go-kabusapi | /examples/positions/positions.go | Go | go | 557 | permissive | package main
import (
"log"
"os"
"gitlab.com/tsuchinaga/go-kabusapi/kabus"
)
func main() {
password := os.Getenv("API_PASSWORD")
isProd := false
if os.Getenv("IS_PROD") != "" {
isProd = true
}
var token string
{
req, err := kabus.NewTokenRequester(isProd).Exec(kabus.TokenRequest{APIPassword: password})... |
5f5b8b0e6cfe1231fe4440ff1513d8f68a739251 | 3fdcaec0d46128c43df3cf33c8985c97881517f7 | cgorenflo/fabric | /gossip/service/join_test.go | Go | go | 6,296 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package service
import (
"sync"
"testing"
"time"
"github.com/hyperledger/fabric/common/channelconfig"
"github.com/hyperledger/fabric/gossip/api"
"github.com/hyperledger/fabric/gossip/comm"
"github.com/hyperledger/fabric/gossip... |
af135bc7f5870c9f04969425305816f128a32b85 | 949ea33abb82e00b37c00fd0d6bd2621574f08b2 | udhayprakash/GoLangMaterial | /10_Packages/09_sort/d_reverseSort.go | Go | go | 391 | permissive | package main
import (
"fmt"
"sort"
)
func main() {
fmt.Println("Example For Integer Reverse Sort")
num := []int{70, 80, 20, 50, 10}
sort.Sort(sort.Reverse(sort.IntSlice(num)))
fmt.Println("\t", num)
fmt.Println("Example For String Reverse Sort")
str := []string{"GFG", "Rank", "India", "Amid", "Covid19"}
so... |
905612ee1ab91ffb54c1f1ba36318860af3f5e17 | 1ef781de2cb95b40ed0d46f9c0382d6e5e9497a1 | little-bit-shy/go-xgz | /pkg/elastic/validate.go | Go | go | 9,502 | permissive | // Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"context"
"fmt"
"net/http"
"net/url"
"strings"
"github.com/little-bit-shy/go-xgz/pkg/elastic/uritemplat... |
e0e6db1e057d3c519994022955131db85afbcc24 | c4d01fb9071d359a3ee4aedabdda9f17af42c0bf | lewiskyo/shiva | /net/datapack.go | Go | go | 1,780 | no_license | package net
import (
"bytes"
"encoding/binary"
"errors"
"shiva/iface"
"shiva/utils"
)
// 封包,拆包的具体模块
type DataPack struct {
}
// 拆包封包实例的一个初始化方法
func NewDataPack() *DataPack {
return &DataPack{}
}
// 获取包的头的长度方法
func (db *DataPack) GetHeadLen() uint32 {
// Len(uint32) + id(uint32)
return 8
}
// 封包方法
func (db *Da... |
5ec66aed831ea43bcbc2b4e84aa961d25ce166b7 | 35fc81575855fad9c5060d3a6d807a295d90b0f4 | NeoTim/skia-buildbot | /task_scheduler/go/isolate_cache/isolate_cache.go | Go | go | 4,353 | permissive | package isolate_cache
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"cloud.google.com/go/bigtable"
"go.chromium.org/luci/common/isolated"
"go.skia.org/infra/go/atomic_miss_cache"
"go.skia.org/infra/go/isolate"
"go.skia.org/infra/task_scheduler/go/types"
"golang.org/x/oauth2"
"google.golang.org... |
c716fe180bcf53dc1382542071a4e39ad12c2f94 | ccf0d0fd6bfaed7a3bfbd03feff78dfa7802c45a | ssp4599815/monitors | /libmonitor/logp/file_rotator.go | Go | go | 4,525 | no_license | package logp
import (
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
)
const (
RotatorMaxFiles = 1024 // 最多保存1024个文件
DefaultKeepFiles = 7 // 默认保存7个文件
DefaultRotateEveryBytes = 10 * 1024 * 1024 // 默认最大保存 10M 的文件
)
type FileRotator struct {
Path string // ... |
ea402a0b45b2e650284b070069ab05227bcc7240 | 771f4e1983ba8cb569d898efe612f5951884b4df | tengrommel/GO_Cloud_Computing | /Leetcode/zigzag_conversion/zigzag-conversion_test.go | Go | go | 1,184 | no_license | package zigzag_conversion
import (
"testing"
"github.com/stretchr/testify/assert"
)
type para struct {
one string
two int
}
type ans struct {
one string
}
type question struct {
p para
a ans
}
func Test_OK(t *testing.T) {
ast := assert.New(t)
qs := []question{
question{
p: para{
one: "ABCDEFGH... |
7ab094585bc03d03a3cc6a453736e42d1b8d6234 | 4e6ea15084c4b93d04cf0cc41c7b994837cc3eac | ShaneIsley/shiori | /internal/cmd/update.go | Go | go | 8,121 | permissive | package cmd
import (
"fmt"
"sort"
"strings"
"sync"
"github.com/go-shiori/shiori/internal/core"
"github.com/go-shiori/shiori/internal/database"
"github.com/go-shiori/shiori/internal/model"
"github.com/spf13/cobra"
)
func updateCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update [indices]",
Short... |
e858161b8727765a9f88a3e680eef30c2ee526f8 | 67f5319b65d4255ecfcd074744d13f1134911da7 | blindjustis/proglog | /internal/log/log_test.go | Go | go | 2,630 | no_license | package log
import (
"io/ioutil"
"os"
"testing"
api "github.com/blindjustis/proglog/api/log_v1"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
)
func TestLog(t *testing.T) {
for scenario, fn := range map[string]func(
t *testing.T,
log *Log,
){
"append and read a record succe... |
450a0f4cd82d1b5d41fb4068ba0469e118c1a6bb | 3f83c86a6b5c44caa0488022cc002576cb3d692d | aitorfernandez/roshambo | /gateway/loader/profile.go | Go | go | 1,366 | no_license | package loader
import (
"context"
"fmt"
"sync"
"github.com/aitorfernandez/roshambo/gateway/client"
pb "github.com/aitorfernandez/roshambo/proto"
"github.com/graph-gophers/dataloader"
)
// LoadProfileByAccount loads profile via data loader for the given accountID.
func LoadProfileByAccount(ctx context.Context, ... |
4e4cf5bb629e1b965c5f56defc1d0f436b65ab6c | ba16541976840126b4985bce7eefcaa7d534a587 | pion/mediadevices | /pkg/prop/duration.go | Go | go | 3,283 | permissive | package prop
import (
"fmt"
"math"
"strings"
"time"
)
// DurationConstraint is an interface to represent time.Duration constraint.
type DurationConstraint interface {
Compare(time.Duration) (float64, bool)
Value() (time.Duration, bool)
}
// Duration specifies ideal duration value.
// Any value may be selected,... |
99fc4cae568117bc4a009c1936656773e4aefa54 | 899b7f6ddb1e092ec2e3d3cf3ec52ae796738381 | vanadium/core | /v23/vom/fuzzdump_test.go | Go | go | 872 | permissive | // Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build fuzzdump
package vom_test
import (
"crypto/sha1"
"fmt"
"os"
"testing"
"v.io/v23/vom/vomtest"
)
// Add the vom tests as binary examples... |
18c8a42007700c1dc33ef34152970eec00975c82 | 6756ea87b1796aaa23ca9547d8e5bf62ca0c6e46 | leolongpy/movie_gozero | /rpc/cms/internal/db/actor.go | Go | go | 569 | no_license | package db
import (
"database/sql"
"movie_gozero/rpc/cms/internal/entity"
)
func InsertActor(actor *entity.Actor, actorType int64) (error, int64) {
var id int64
_, err := db.Exec("INSERT INTO `actor`(`name_cn`,`actor_photo`,`actor_type`) VALUES(?,?,?)",
actor.NameCN, actor.ActorPhoto, actorType)
if err == sq... |
971964a065ed4f5b2523bdc372b1270fc4eba87d | 9b90b2e1267a0a40a361e9583a62f4cd87b8f3e8 | bfenetworks/bfe | /bfe_basic/request_stat.go | Go | go | 1,900 | permissive | // Copyright (c) 2019 The BFE 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 agre... |
37882755a69f10e4807f3d29cf22c26a52946276 | af40f059684a1d08ed529c4cd9a0c2db1ca9f7eb | yxh1990/harvester | /pkg/api/vm/schema.go | Go | go | 3,066 | permissive | package vm
import (
"net/http"
"github.com/rancher/apiserver/pkg/types"
"github.com/rancher/steve/pkg/schema"
"github.com/rancher/steve/pkg/server"
"github.com/rancher/steve/pkg/stores/proxy"
"github.com/rancher/wrangler/pkg/schemas"
k8sschema "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest"
... |
c69da8a85e0553d02cbfe769c45664396a32b3b7 | 7cff07d1f14d984dae9db8e0b0ab21344b42a7ea | stefan06ro/prometheus-meta-operator | /service/controller/resource/alerting/alertmanagerconfig/client.go | Go | go | 929 | permissive | package alertmanagerconfig
import (
"context"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
)
type wrappedClient struct {
client clientcorev1.SecretInterface
}
func (c wrappedClient) Create(ctx context.Context, o metav1.Object... |
59b11336c0b9e07fe6231332696319e5061ea823 | f785d0a1e689179c62ac2ddab4378b04f78b1370 | TheThingsNetwork/lorawan-stack | /pkg/cluster/auth_test.go | Go | go | 2,570 | permissive | // Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// 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
//
// Un... |
e0e94a2ecad8f8759c9e886705b0e9840443fbf9 | 7400235dfd0ef60ecf8d1a97a935aaacbce182e4 | BTBurke/vulcand | /backend/backend.go | Go | go | 17,690 | permissive | // Package backend defines interfaces and structures controlling the proxy configuration and changes.
package backend
import (
"crypto/subtle"
"crypto/tls"
"fmt"
"net/http"
"regexp"
"strings"
"time"
"github.com/BTBurke/vulcand/Godeps/_workspace/src/github.com/mailgun/vulcan/location/httploc"
"github.com/BTBu... |
8d26995b82d6d0084fc09ac7df18e94f6d8d54e7 | 946adadc911d03026a9ef1cb15daaaa4a4485699 | cruisechang/dealerConnector | /command/rerollDice.go | Go | go | 2,422 | permissive | package command
import (
"github.com/cruisechang/nex"
nxLog "github.com/cruisechang/nex/log"
"github.com/cruisechang/dealerConnector/config"
pb "github.com/cruisechang/liveServer/protobuf"
"fmt"
"encoding/base64"
"encoding/json"
"errors"
)
type rerollDiceProcessor struct {
BasicProcessor
}
func NewRerollDic... |
d402379cb205c4000cd9ed0d1eb34cb3869927af | 2e74fbdce61985e93791fc1c93ab4863f3783e12 | wangyi1310/kubeadm | /k8s.io/kubeadm/pkg/apis/apps/fuzzer/fuzzer.go | Go | go | 1,818 | no_license | /*
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, ... |
79641f4194333ea334447079d8165ba18c28e2ba | ef5dfe118a471b1330adddada1536f7a5f5fe795 | xy720/ticdc | /pkg/actor/system.go | Go | go | 12,216 | permissive | // Copyright 2021 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... |
647779383c1d1d3d9e014efbddb10046a6dff1a3 | 3258693308ad5e64417317c92fac8f8dde4f7d34 | linexjlin/alitts | /alitts/tts.go | Go | go | 2,242 | no_license | /*
#
# @Time : 2019/4/22 13:52
# @Author : Qian Lu
*/
package alitts
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
)
func ProcessPOSTRequest(
token string,
text string,
audioSaveFile string,
format string,
sampleRate int,
speechRate int,
voice string) {
/**
* 设置HTTPS POST请求
* ... |
0e9871d7de7676276652a8d12a50ea25299cb830 | 291be3d291dddaee1021dbf2572c27caac3cce42 | doytsujin/go-llsn | /llsn.go | Go | go | 4,036 | permissive | // Golang support for LLSN - Allyst's data interchange format.
// LLSN specification http://allyst.org/opensource/llsn/
// 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... |
ccc16ae328c6f48a341d18fe56c7dbb29440f941 | 3b4b94887245119d5d71334f42a874fb4a48e248 | dewey/dep_radar | /src/http/client.go | Go | go | 2,079 | no_license | package http
import (
"fmt"
"io/ioutil"
"log"
stdhttp "net/http"
"strings"
"time"
i "github.com/stamm/dep_radar/interfaces"
)
var (
_ i.IWebClient = &Client{}
defaultHTTPClient *stdhttp.Client
)
func init() {
defaultHTTPClient = &stdhttp.Client{
Timeout: 30 * time.Second,
Transport: &s... |
ae68833ab321081b96a70f40c711fc5c0937dd95 | a46d209f47370a41c8c88853705f813bfc2a63ab | CodeCmn/xupercore | /bcs/ledger/xledger/state/xmodel/xmodel_snapshot_test.go | Go | go | 3,084 | permissive | package xmodel
import (
"encoding/hex"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/xuperchain/xupercore/bcs/ledger/xledger/def"
ledger_pkg "github.com/xuperchain/xupercore/bcs/ledger/xledger/ledger"
"github.com/xuperchain/xupercore/bcs/ledger/xledger/state/context"
"github.com/xuperchain/xu... |
3c59f4fc07f22efc1d7400367d390e304f7fc897 | f592a2e32fc3c46d6d8d78b9aba7902534d39fea | michdol/go | /src/data-structures/doubly_linked_list/doubly_linked_list_test.go | Go | go | 13,797 | no_license | package main
import (
"testing"
)
func TestPushFront(t *testing.T) {
l := DoublyLinkedList{}
l.PushFront(1)
if l.Size() != 1 {
t.Fatal("Size() should return 1")
}
if l.front == nil || l.front.data != 1 {
t.Fatal("Front should be 1")
}
if l.back == nil || l.front != l.back {
t.Fatal("... |
439a43d0f8f38c5f287d5514a0fb68c6098c3cc3 | 8f814dc9ff62e171a3c7bc7a36727210a0c1c274 | tkmagesh/Salesforce-AdvGo-Aug-2021 | /01-concurrency/08-demo.go | Go | go | 760 | no_license | /* divide & conquer using go routines*/
package main
import (
"fmt"
)
func main() {
resultCh1 := make(chan int)
resultCh2 := make(chan int)
data := []int{4, 1, 7, 3, 8, 5, 9, 3, 11, 15, 63, 87, 29, 40, 50, 55, 4, 1, 7, 3, 8, 5, 9, 3, 11, 15, 63, 87, 29, 40, 50, 55, 4, 1, 7, 3, 8, 5, 9, 3, 11, 15, 63, 87, 29, 40, ... |
604b1c88d5ac3052e2e3fe5f3f6f03dc123e38c4 | 78772685ade33a23b5ec37216110e2d274814a79 | cassiobotaro/demoprest | /ping.go | Go | go | 350 | permissive | package main
var (
// HTTPVars route variables for the current request
HTTPVars map[string]string
// URLQuery parses RawQuery and returns the corresponding values
URLQuery map[string][]string
)
// GETPingHandler plugin
//
// BUILD:
// go build -o plugins/ping.so -buildmode=plugin ping.go
func GETPingHandler() (re... |
4c25563b4dde104cce90326d1a0c6030999799eb | bcc616eb1ad44f2d9e554aa06bd42696883dcc20 | ivansukach/bets | /internal/tools/tools.go | Go | go | 1,153 | no_license | package tools
import (
"github.com/go-chi/render"
"net/http"
)
func ErrInvalidRequest(err error) render.Renderer {
return &ErrResponse{
Err: err,
HTTPStatusCode: 400,
StatusText: "Invalid request.",
ErrorText: err.Error(),
}
}
func InternalServerError(err error) render.Renderer {
retu... |
430dd01cf47948945bbd80ea73ba112ab505a464 | 0f2b1ba6a223403ca444ffe62000be3291386101 | wanwenli/aws-node-termination-handler | /pkg/webhook/webhook.go | Go | go | 4,272 | permissive | // Copyright 2016-2017 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 in the "lic... |
6e6b9d398fa5d3179bc83bae958866a0a718f494 | 576f3b0ae269280a57eb24e7a25927a39469862e | Qovery/qovery-cli | /pkg/version.go | Go | go | 1,252 | permissive | package pkg
import (
"errors"
"fmt"
"net/http"
"os"
"strings"
"github.com/qovery/qovery-cli/utils"
)
func GetCurrentVersion() string {
return "0.65.1" // ci-version-check
}
func GetLatestOnlineVersionUrl() (string, error) {
url := "https://github.com/Qovery/qovery-cli/releases/latest"
resp, err := http.Get... |
d356c36b3155e4ef040b4ffb05025fc3ae2ec6c4 | 0185c60769af20c1572de8bf46dc7ad6da6bf610 | shurcooL/play | /139/main.go | Go | go | 2,777 | permissive | // Display a code diff with single-line JSON diffs expanded/indented for easier readability.
package main
import (
"bytes"
"encoding/json"
"io/ioutil"
"os"
"os/exec"
"strings"
"github.com/shurcooL/go/openutil"
"sourcegraph.com/sourcegraph/go-diff/diff"
)
func main() {
allJSON := false
var b string
/*all... |
02632a9ee02c0d5c175a991f31ed1a49176bc986 | a6aa7740e827d4bc8b0b9e6832c38873764713ac | the-sportsq/go-sport-data | /client.go | Go | go | 1,016 | no_license | package gsd
import (
"fmt"
"io"
"net/http"
"net/url"
)
type Client struct {
ApiKey string
}
type Query map[string]interface{}
const BaseApiUrl string = "https://app.sportdataapi.com/api/v1"
func NewClient(apiKey string) *Client {
return &Client{
ApiKey: apiKey,
}
}
// getPath formats a path and query par... |
a841971dd020b30241a236d927db79b5b1e8e836 | c6b86d5ae49425aedf895877a5e3085456a7caa5 | perfect-network/go-get | /test/821.go | Go | go | 463 | no_license | package main
import (
"io"
"log"
"net"
"time"
)
func main() {
listener, err := net.Listen("tcp", "localhost:8100")
if err != nil {
log.Fatal(err)
}
for {
conn, err := listener.Accept()
if err != nil {
log.Print(err)
continue
}
go handleConn(conn)
}
}
func handleConn(c net.Conn) {
defer c.Cl... |
a0147e852fbfb3ff8c00441d5d033813e4da79e4 | add3ce253e9640e3cfd6e13180cd98fc2b45b8a3 | bububa/opentaobao | /model/alicom/AlibabaAlicomWttOpentradeCreateorderAPIRequest.go | Go | go | 1,665 | permissive | package alicom
import (
"net/url"
"github.com/bububa/opentaobao/model"
)
// AlibabaAlicomWttOpentradeCreateorderAPIRequest 充值送活动下单接口 API请求
// alibaba.alicom.wtt.opentrade.createorder
//
// 提供给话费宝创建淘宝订单
type AlibabaAlicomWttOpentradeCreateorderAPIRequest struct {
model.Params
// 入参请求说明
_param0 *OpentradCreateOrd... |
0f5a13b29644ba9d4e24dd16b8b6548d7372e2c3 | 4e9d4ced22b33ab4d9ab8a9e0168414ee208de2a | ahaly92/golang-reorder | /drivers/sql/sql.go | Go | go | 31,858 | no_license | package sql
import (
"context"
"errors"
"fmt"
"math"
reflect "reflect"
"strconv"
"strings"
"time"
"github.com/jackc/pgx"
"github.com/jackc/pgx/pgtype"
)
const (
// Boolean is a logical Boolean (true/false)
Boolean Datatype = "boolean"
// Text is a variable length character string
Text Datatype = "text"... |
8922f9e5619ff6df8c08e4e347296279553d7345 | 81df33ac3ed70be97216c3fabeb2b73d0e2d8d93 | carolinasolfernandez/go-xml | /xsdgen/xsdgen.go | Go | go | 30,827 | permissive | package xsdgen // import "aqwari.net/xml/xsdgen"
import (
"bytes"
"encoding/xml"
"fmt"
"go/ast"
"go/token"
"io"
"sort"
"strconv"
"strings"
"aqwari.net/xml/internal/dependency"
"aqwari.net/xml/internal/gen"
"aqwari.net/xml/xmltree"
"aqwari.net/xml/xsd"
)
type orderedStringMap interface {
keys() []string... |
80485ce195da52e0a0c674a9a8b1c0c3c67a32bc | f23d12f84a19627a5c40b9642fe018f644ad4b9e | 18301662572/DistributedSystem | /07distributedcrawler/collysub/colly-sub.go | Go | go | 1,487 | no_license | package collysub
import (
"net/url"
"github.com/gocolly/colly"
"github.com/nats-io/nats.go"
"time"
"os"
)
//nats结合 colly 的消息消费
var domain2Collector = map[string]*colly.Collector{}
var nc *nats.Conn
var maxDepth = 10
var natsURL = "nats://localhost:4222"
func factory(urlStr string) *colly.Collector {
u, _ :=... |
1935fef007c87630df9b26b07a93ba9cbc464e1e | 48cd2024c6fe06af9c5beb90d0250f33fa556dd6 | zhangbo0528/yjgov2 | /app/controller/system/dict_type/dict_type_controller.go | Go | go | 5,916 | permissive | package dict_type
import (
"github.com/gin-gonic/gin"
"net/http"
"yj-app/app/model"
dictTypeModel "yj-app/app/model/system/dict_type"
dictTypeService "yj-app/app/service/system/dict_type"
"yj-app/app/yjgframe/response"
"yj-app/app/yjgframe/utils/gconv"
)
//列表页
func List(c *gin.Context) {
response.BuildTpl(c, ... |
d16d2e6670fb740b98d04b90ffece201021831a9 | a97a7aef1bc905497b67c8471c7811a256a1d980 | leobcn/emgo | /tools/stm32xgen/peripherals.go | Go | go | 6,347 | permissive | package main
import (
"fmt"
"io"
"strconv"
"strings"
"text/tabwriter"
"unicode"
)
type Bits struct {
Name string
Mask uint32
LSL uint
Descr string
Val bool
}
type Register struct {
Offset int
BitSiz int
Name string
Len int
Descr string
Bits []*Bits
SubRegs []*Register
}
type In... |
4af7656e40f84638464dc2de03518370ff353bfe | c9d25976d36ceb971d328724fd5776b73aa9cea0 | iliefa/golangbasic | /structs.go | Go | go | 873 | no_license | package main
import "fmt"
//user defined data
//named structure
type Employee struct {
firstName, lastName string
age, salary int
}
//anonymous structure
var employee struct {
firstName string
age int
}
func main() {
emp1 := Employee{
firstName: "george",
age: 24,
salary: 1500,
... |
29012552f203ba4068bc119de83af5b5fbad91a0 | 18c69da5baddb2cfa9955bed5124699cd035aecf | loga4/lnd | /discovery/gossiper_test.go | Go | go | 57,478 | permissive | package discovery
import (
"encoding/hex"
"fmt"
"net"
"reflect"
"sync"
prand "math/rand"
"testing"
"math/big"
"time"
"io/ioutil"
"os"
"github.com/davecgh/go-spew/spew"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.co... |
e7841efbd4e41c9dcc77c6b2d8e5002a81bf7ebe | 643a5d170adc5af759273149fb58f802ab4bc765 | raphael-rabadan/udemy-golang-by-leonardo-leitao | /fundamentos/relacionais/relacionais.go | Go | go | 477 | no_license | package main
import (
"fmt"
"time"
)
func main() {
fmt.Println("Strings:", "Banana" == "Banana")
fmt.Println("!=", 3 != 2)
fmt.Println("<", 3 > 2)
fmt.Println(">", 3 < 2)
fmt.Println("<=", 3 <= 2)
fmt.Println(">=", 3 >= 2)
d1 := time.Unix(0, 0)
d2 := time.Unix(0, 0)
fmt.Println("Datas:", d1 == d2)
fmt.P... |
4aca5681e9522dffbaa27823f8d3eae1724a3067 | 9dbc2a6b805503db422c0172ba0a653b1d05e2cc | Peltoche/oaichecker | /specs_test.go | Go | go | 2,398 | permissive | package oaichecker
import (
"io/ioutil"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_NewSpecsFromFile_with_load_error(t *testing.T) {
specs, err := NewSpecsFromFile("some-unknown-path")
assert.Nil(t, specs)
assert.EqualError(t, err, "open some-unknown-path:... |
2ce87756a21c453d1025b32ce23b37ae0ee3209a | 039b392d7af8bf023e957780308d10f2911d1106 | pendo-io/aws-sdk-go | /aws/credentials/stscreds/web_identity_provider.go | Go | go | 3,265 | permissive | package stscreds
import (
"fmt"
"io/ioutil"
"strconv"
"time"
"github.com/pendo-io/aws-sdk-go/aws"
"github.com/pendo-io/aws-sdk-go/aws/awserr"
"github.com/pendo-io/aws-sdk-go/aws/client"
"github.com/pendo-io/aws-sdk-go/aws/credentials"
"github.com/pendo-io/aws-sdk-go/service/sts"
"github.com/pendo-io/aws-sdk... |
26857f8130e7ec704eb17f7533b569bbf2fbb1ed | e99c8bf02fbc5ece2922d42d104bba127f405f1e | ckatsak/merkle | /merkle_test.go | Go | go | 9,335 | permissive | // Copyright (c) 2018, Christos Katsakioris
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR ... |
7783ee4aa1ba9108d635685ed1cb0baa07910c78 | 04ee2704a852313dd329992d96222d03bfd5858e | otiai10/docker-sdk-sandbox | /machine/create-remove/main.go | Go | go | 3,922 | no_license | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"github.com/docker/machine/drivers/amazonec2"
"github.com/docker/machine/commands/mcndirs"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/auth"
"github.com/docker/machine/libmachine/drivers"
"github.... |
d66ec887a8e980f8b0de92ae90e49ade3b8da594 | 453fe0f74c6a3c11a136205c09fdafdf2eea3097 | mrbanzai/go-choria | /cmd/tool.go | Go | go | 436 | permissive | package cmd
import (
"sync"
)
type toolCommand struct {
command
}
func (t *toolCommand) Setup() (err error) {
t.cmd = cli.app.Command("tool", "Various utilities for debugging and verification of Choria Networks")
return nil
}
func (t *toolCommand) Configure() error {
return nil
}
func (t *toolCommand) Run(wg... |
18e20097e14cd11374570d2d5e600713a793d640 | b350eeb76706722634bef31682bb0bc11fea9bbe | xsddz/notes.goinaction | /chapter09/thetest/get_mocking_test.go | Go | go | 2,280 | no_license | // 这个示例程序展示如何内部模仿 HTTP GET 调用
package thetest
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
)
// feed 模仿了我们期望接收的 XML 文档
var feed = `<?xml version="1.0" encoding="UTF-8"?>
<rss>
<channel>
<title>Going Go Programming</title>
<description>Golang : https://github.com/goinggo</description>
<link>http://ww... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.