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 |
|---|---|---|---|---|---|---|---|---|
70bbbf1af041969fbb0061568a798cc615ab1b3e | 5212b67df5e6c0ef4566415fdbb36cb50108f256 | katrybacka/contrail | /pkg/apisrv/useragent_kv.go | Go | go | 3,960 | permissive | package apisrv
import (
"net/http"
"github.com/labstack/echo"
"github.com/Juniper/contrail/pkg/common"
"github.com/Juniper/contrail/pkg/models"
)
// Useragent key value store operations.
const (
UseragentKVOperationStore = "STORE"
UseragentKVOperationRetrieve = "RETRIEVE"
UseragentKVOperationDelete = "D... |
05c3c31644beedc7f7de9930127eff83a624b547 | 9de9f77828767b1bc7d0571b9360ca6dac2652ee | pragadeeshdharsha/encoreUpdated | /Instruments/instrument.go | Go | go | 7,334 | no_license | package main
import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
type chainCode struct {
}
type instrumentInfo struct {
//Instrument ID for storing is auto generated
I... |
8583076e91f9843f3af281ed98ec6f17469c36a5 | 01b8467d9f4744249e91d69162feef49707763d5 | syukri21/bibit | /2/src/repositories/movie_log.go | Go | go | 753 | no_license | package repositories
import (
"bibit-test/src/models/model"
"github.com/sarulabs/di"
"gorm.io/gorm"
)
type MovieLog interface {
CreateSearchLog(data *model.MovieSearchLog) (err error)
CreateGetDetailLog(data *model.MovieGetDetailLog) (err error)
}
type MovieLogImpl struct {
db *gorm.DB
}
func (m MovieLogImpl)... |
ce549561719e1c41c98f76115c909527684a319b | 8099fa4f192a0b235ebc0d2bd2f3d6c965bf7a72 | WarpCloud/walm | /vendor/k8s.io/kubernetes/test/e2e/framework/networking_utils.go | Go | go | 37,387 | 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, ... |
9edd5e2a8ba8ba3ce3780ba15e2d2f5a5f0cd19c | 27abfb186bef74396c1f59cc383b89f70d530e65 | 360ied/rpdSeven | /keepalive/keepalive.go | Go | go | 315 | no_license | package keepalive
import (
"fmt"
"net/http"
"github.com/ztrue/tracerr"
)
func KeepAlive() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
var _, err = fmt.Fprintf(w, "I'm alive")
if err != nil {
tracerr.PrintSourceColor(err)
}
})
panic(http.ListenAndServe(":8080", nil))
}
|
a95f4dd1d67066305e8dc920767a01da402e721c | cd32e37eb3428588ed5262832e7188d71b5a29c9 | w1r2p1/ccexgo | /exchange/ftx/message_test.go | Go | go | 2,517 | permissive | package ftx
import (
"testing"
"github.com/NadiaSama/ccexgo/exchange"
"github.com/NadiaSama/ccexgo/internal/rpc"
"github.com/shopspring/decimal"
)
func TestMessageDecode(t *testing.T) {
cc := NewCodeC(map[string]exchange.Symbol{
"ADA-PERP": newSwapSymbol("ADA"),
})
e := []byte(`{"channel": "", "market": ""... |
dbb28caacd83792875f6807875b7748c5367650d | 325080852f4f92f2a8cc926623dd84247dfb1c2c | Vorringer/oci-go-sdk | /filestorage/list_exports_request_response.go | Go | go | 8,178 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
5abace12cd3ff772bd223b00d38d91c3257ac8ba | 15a4a8fff4b9586fd55527694e5ad0f04f6b104f | ARM-software/bob-build | /core/toolchain/armclang.go | Go | go | 2,657 | permissive | package toolchain
import (
"strings"
"github.com/ARM-software/bob-build/core/config"
)
type toolchainArmClang struct {
arBinary string
asBinary string
objcopyBinary string
objdumpBinary string
ccBinary string
cxxBinary string
linker Linker
prefix string
cflags []str... |
838c05cbc03cb8253e395e7e03ad315c2c5a7bc6 | 8a5835857f700648c4cbecc2cb3f682961369ba3 | guidoiaquinti/vitess | /go/vt/vtctl/grpcvtctldserver/server.go | Go | go | 64,894 | permissive | /*
Copyright 2020 The Vitess Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
ee4b7004b780c09e858a80606ce289406d6127b4 | 101338a473592a4320546b0e01b7a22de1ba1229 | ontio/ontology-test | /testcase/smartcontract/api/contract/create.go | Go | go | 1,440 | no_license | package contract
import (
"time"
"github.com/ontio/ontology-go-sdk/utils"
"github.com/ontio/ontology-test/testframework"
)
/*
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Services.Neo;
class A : SmartContract
{
public static string Main()
{
return "Hello World!";
}
}
... |
3c1b69dc91bc3103a3bb23c1e6b32d2b8ab32613 | 7245bbbda9385c68686478a920d39f05f5a62420 | METADIUM/go-delegator | /crypto/merkletree/content.go | Go | go | 479 | permissive | package merkletree
import (
"bytes"
"github.com/ethereum/go-ethereum/common/hexutil"
)
// HashContent Content For metaID
type HashContent struct {
H hexutil.Bytes
}
// CalculateHash function to calculate hash
func (t HashContent) CalculateHash() []byte {
return t.H
}
// Equals function to compare other Content... |
c43d3a3cc9e9c24656b0cc59fe72f8b215b549c8 | 89105a01d3a6e3ee05b99e7797441d6a71f0048e | rhinoman/wikifeat | /users/user_service/users_test.go | Go | go | 8,551 | permissive | /*
* Licensed to Wikifeat under one or more contributor license agreements.
* See the LICENSE.txt file distributed with this work for additional information
* regarding copyright ownership.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the ... |
a311f7ae9321ed330a8e77de7b060eaa324c3130 | 0b774e5b63e52afe3ce88d32916bacd89763aa9d | awshrb/govm-chungus | /main.go | Go | go | 11,455 | permissive | package main
import (
"encoding/hex"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"runtime/pprof"
"strconv"
"time"
"github.com/lengzhao/govm/wallet"
)
// Config config
type Config struct {
WalletFile string `json:"wallet_file,omitempty"`
Password string `json:"password,omitemp... |
eff9f10a598f534a53fac8cd214216fafa1563bc | 2170015777f8023b1cc753b5e64b389762b80090 | jhedlund79/benthos | /lib/output/cache.go | Go | go | 2,896 | permissive | // Copyright (c) 2018 Ashley Jeffs
//
// 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, publish, ... |
72647693fb78d1ba7217d10ed9176bf708909c90 | 6649f4bf97829a301b2caf76b12a2fb57eb22ae2 | BoYiZhang/minio | /cmd/config/scanner/scanner.go | Go | go | 3,076 | permissive | // Copyright (c) 2015-2021 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (... |
eb516596f9ac847f50ccd71799296d150a310785 | b880eca64fccf86ef7e035e10fecd2c7be1b32d0 | John-Smile/jvmgo | /ch09/interpreter.go | Go | go | 1,972 | no_license | package main
import "fmt"
import "jvmgo/ch09/instructions"
import "jvmgo/ch09/instructions/base"
import (
"jvmgo/ch09/rtda"
"jvmgo/ch09/rtda/heap"
)
func interpret(method *heap.Method, logInst bool, args [] string) {
thread := rtda.NewThread()
frame := thread.NewFrame(method)
thread.PushFrame(frame)
jArgs := c... |
afd143a2137a04a54bb7b1accbba042d8b74a172 | df689fba3badf5e38ac4c5c1965d6a8a3c49ea59 | bububa/opentaobao | /model/tmallsc/TmallWorkcardIdentifyAPIResponse.go | Go | go | 1,000 | permissive | package tmallsc
import (
"encoding/xml"
"github.com/bububa/opentaobao/model"
)
// TmallWorkcardIdentifyAPIResponse 工单核销 API返回值
// tmall.workcard.identify
//
// 工单核销,当工单完成以后,通过调用此接口核销
// 可以按照多维度核销工单,
// 电器预约安装按照工单维度核销,必选字段workcard_id,buyer_id,identify_code,可选字段attrs,通过扩展字段attrs回传机器码,格式{sn:'机器码'}
type TmallW... |
045468e5cd6325229cc8214dbb15de14d3af2693 | 4640e7a602371fbdea52fcdf4d745a4a00e046dd | classzz/classzz | /rpcclient/examples/bchdwebsockets/main.go | Go | go | 2,339 | permissive | // Copyright (c) 2014-2017 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"io/ioutil"
"log"
"path/filepath"
"time"
"github.com/classzz/classzz/rpcclient"
"github.com/classzz/classzz/wire"
"github.com/classzz/czzu... |
f70536df269af1a884929afe80b56d2ed5527202 | 0a8186adbf2dad25f3e9755442b050470513c82e | luci/luci-go | /config/validation/validation.go | Go | go | 6,228 | permissive | // Copyright 2017 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
9185ec4c3729ea9a91eb4d96879597f57fdccda4 | 034ae3a8aa819c1e224ac539277df97c77ba32a4 | sillyhatxu/remind-backend | /service/remindbirthday/birthday.go | Go | go | 3,014 | no_license | package remindbirthday
import (
"github.com/golang/protobuf/ptypes"
"github.com/sillyhatxu/environment-config"
"github.com/sillyhatxu/gin-utils/codes"
"github.com/sillyhatxu/gin-utils/ginerrors"
"github.com/sillyhatxu/gocache-client"
"github.com/sillyhatxu/message-backend/grpc/grpcclient"
"github.com/sillyhatxu... |
5b6532926c403e83ee234e36cecb38502719de65 | 6f006b77a9a7e8c9348e16d2778955f4ffd13bb0 | devnatash/dkenv | /switcher_test.go | Go | go | 354 | permissive | package main
import (
"testing"
)
func TestApiToVersion(t *testing.T) {
v1, _ := ApiToVersion("1.12")
if v1 != "1.0.1" {
t.Error("Expected 1.0.1, got ", v1)
}
v2, _ := ApiToVersion("1.17")
if v2 != "1.5.0" {
t.Error("Expected 1.5.0, got ", v2)
}
}
func TestListDownloa... |
ece7f78a13e8d4dae7e9cd737901e1cbbace7fab | 03f5470694b04ab62dd67f9a818ce4b2a22d2927 | msrb/fabric8-wit | /configuration/configuration.go | Go | go | 38,131 | permissive | package configuration
import (
"crypto/rsa"
"fmt"
"net/http"
"os"
"regexp"
"strings"
"time"
"github.com/fabric8-services/fabric8-wit/rest"
errs "github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"gopkg.in/yaml.v2"
)
// String returns the current configuration as a string
fu... |
ebc812eaf623a0a0d28ac3b7bea7b64bb27558d9 | 9c65fc78487d3b06af527acf0d5568bdebad619e | doitandbedone/google-photos-api-client-go | /fileuploaditem_test.go | Go | go | 1,637 | permissive | package gphotos_test
import (
"testing"
gphotos "github.com/gphotosuploader/google-photos-api-client-go/v2"
)
var testCases = []struct {
name string
path string
wantName string
wantSize int64
errExpected bool
}{
{name: "sample JPEG 100kB", path: "testdata/file_example_JPG_100kB.jpg", want... |
c0d98bcbbbde4ee00df9eeb075c3e1e9215006a2 | b650254d477b144dd7404e8a7dcb2d6cf3550d72 | recallsong/online-statistics | /server/handle.go | Go | go | 3,768 | permissive | package server
import (
"errors"
"net"
"net/http"
"sync/atomic"
"time"
"github.com/gorilla/websocket"
"github.com/labstack/echo"
"github.com/recallsong/go-utils/net/echox"
"github.com/recallsong/httpc"
log "github.com/sirupsen/logrus"
)
var (
upgrader = websocket.Upgrader{
CheckOrigin: func(r *http.Requ... |
03dda68ec69a29572a5f47cf679b1f81a3ac5a85 | b09a2b345c0109c274a9eef72f5017df023c430c | RicardoLSW/Go-demo | /errhanding/filelistingserver/fileListing/handle.go | Go | go | 651 | no_license | package fileListing
import (
"io/ioutil"
"net/http"
"os"
"strings"
)
const prefix = "/list/"
type userError string
func (e userError) Error() string {
return e.Message()
}
func (e userError) Message() string {
return string(e)
}
func HandleFileList(writer http.ResponseWriter, request *http.Request) error {
... |
310151465a7f03f3c303ec9b437dd71f0d47a082 | 01bc6b526aa6bf0f185611596a7e3e890caab117 | monasuite/lnd | /lnwallet/test/neutrino/neutrino_test.go | Go | go | 300 | permissive | package neutrino_test
import (
"testing"
lnwallettest "github.com/monasuite/lnd/lnwallet/test"
)
// TestLightningWallet tests LightningWallet powered by neutrino against our
// suite of interface tests.
func TestLightningWallet(t *testing.T) {
lnwallettest.TestLightningWallet(t, "neutrino")
}
|
13734a2409168d6d74992c63b4dc66d7dd2e55ca | 7279a8bafe650b1f54450b9c54800d97ada9fe2d | sgtest/monorepo-test-3 | /kubernetes-9/pkg/util/dbus/doc.go | Go | go | 755 | 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, ... |
7f641265cff7ee0c001b62958b4213b811683d4d | 282a47c35b0dec0ead0fa91983898e318aac8aba | munnerz/cert-manager | /test/e2e/suite/conformance/certificates/vault/vault_approle.go | Go | go | 6,631 | permissive | /*
Copyright 2019 The Jetstack cert-manager contributors.
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... |
cccf79d2ae26311d28cc722b849d7331ef40cd89 | 00e7b28f9190b24a84bb4a7a88ceccf638291538 | CinthiaKatiane/projeto3_concorrencia_go | /questao1.go | Go | go | 5,099 | no_license | package main
import (
"math/rand"
"time"
"fmt"
"os"
)
/* Foram definidos dois structs, o de jogador apresenta o nome do jogador
e os seus pontos marcados; o de partida apresenta as informações da partida
que esta sendo jogada, tais informações são configuraveis no inicio da partida*/
type jogador struct{
nome ... |
10a844c65c53baedc5dc98e1043dccd5c4afec92 | 73dd06339a7bbb628a570e6ab46b2a4824a97409 | cilium/cilium | /pkg/fqdn/re/re.go | Go | go | 2,409 | permissive | // SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium
// Package re provides a simple function to access compile regex objects for
// the FQDN subsystem.
package re
import (
"errors"
"fmt"
"regexp"
"sync/atomic"
lru "github.com/golang/groupcache/lru"
"github.com/cilium/cilium/pkg/lock"
"githu... |
015ac0fb03fc5114b1e399336e142a65494c22d1 | 2df3042a69784102c90a406ec9f8511890e519b3 | Top-Pattarapol/finalexam | /service/customer/database.go | Go | go | 1,157 | no_license | package customer
import (
"database/sql"
"log"
)
func (h *Handler) CreateCustomerTable() {
err := h.database.BaseExec(`CREATE TABLE IF NOT EXISTS customers( id SERIAL PRIMARY KEY, name TEXT, email TEXT, status TEXT );`)
if err != nil {
log.Fatal(err.Error())
}
}
func (h *Handler) GetCustomers() (*sql.Rows, er... |
6559c4d4175603c659dcb486977c8d87bb76e023 | d567087ebf2d64a196ae7a898bd5a32916d3ef75 | l0oktaan/goidcard | /tis620/main-1.go | Go | go | 1,547 | no_license | package main
import (
"bytes"
"encoding/csv"
"fmt"
"os"
"strconv"
"testing"
"unicode/utf8"
//"net/http"
)
const TEST_FILENAME = "tis620-testcases.txt"
func TestConvert_ToUTF8_AllChars(t *testing.T) {
testCases := readTestFile()
for _, line := range testCases {
tis620byte := byte(line.In)
u... |
8fdfe771825d0a1e82974aeb00ea20ae74bc333d | e2d3eb9c88caa191d6ce6d09b68d1ed0fc91d89e | javanmattos/go-modbus | /client_test.go | Go | go | 10,367 | permissive | package modbus
import (
. "github.com/smartystreets/goconvey/convey"
"testing"
)
type dummyTransporter struct {
// define a dummy response data
resData []byte
// cache current request
req *Pdu
// define a dummy response method
send func(pdu *Pdu) (*Pdu, error)
}
func (t *dummyTransporter) Connect() error ... |
62b3b292805c32cffef70f1f6b3a6be2f7aadbca | 3bc63385ef1951751994104f361aada36d0daffe | sabhiram/ratedr | /ratedr.go | Go | go | 2,849 | permissive | package ratedr
import (
"sync"
"time"
"golang.org/x/time/rate"
)
////////////////////////////////////////////////////////////////////////////////
type entry struct {
*rate.Limiter
expiryDuration time.Duration
expiryTime time.Time
}
// Allow returns the underlying `rate.Limiter`s Allow() function after to... |
5276798b997fa2ee06a30cfbc17fced1b2323074 | 5a15507dc2651d3923507c1b950d729e717f880b | mochisuna/number-hit-bot | /infrastructure/database/firestore.go | Go | go | 733 | no_license | package database
import (
"context"
"log"
"cloud.google.com/go/firestore"
firebase "firebase.google.com/go"
"github.com/mochisuna/number-hit-bot/config"
"google.golang.org/api/option"
)
type FirestoreClient struct {
*firestore.Client
}
func NewFirestore(config *config.Firestore) (*FirestoreClient, error) {
... |
a73ede002c6a786cc648f5a74b1c6734cf8fe3ad | 525ab0264e97ef5c97da8f85c43f9776cd2b25c5 | lozdog245/gocryptotrader | /config/config.go | Go | go | 49,064 | permissive | package config
import (
"bufio"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"sync"
"time"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/connchecker"
"github.com/thrasher-corp/gocryptotrader/currency"
"github... |
91f40c45c3864de2adc26946a5861d29db49b962 | aee06882199eb688aaa281bce22a84e327594229 | goeoeo/fyne-cross | /internal/command/context_test.go | Go | go | 3,310 | permissive | package command
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/fyne-io/fyne-cross/internal/volume"
)
func Test_makeDefaultContext(t *testing.T) {
vol, err := mockDefaultVolume()
require.Nil(t, err)
type args struct {
flags *CommonFlags
arg... |
47eb66a5116f1c3ea5a7dcaf40a55fd713296992 | c880383ff72cc1e4146577a8d660a35137225744 | JustSimpleCoder/go-demo-reptile | /fetcher/fetcher.go | Go | go | 972 | no_license | package fetcher
import (
"bufio"
"fmt"
"golang.org/x/net/html/charset"
"golang.org/x/text/encoding"
"golang.org/x/text/encoding/unicode"
"golang.org/x/text/transform"
"io/ioutil"
"log"
"net/http"
"time"
)
var rateLimiter = time.Tick(10 * time.Millisecond)
func Fetch(url string) ([]byte, error) {
<-rateLim... |
4f564f9e693391592064393249942cbb5a6c33d3 | 8bcc5015bc692a0683ba122f686734dc65eefe4e | leojasmim/jwt-generator | /application/factory.go | Go | go | 243 | no_license | package application
import (
jwtgen "github.com/leojasmim/jwt-generator/domain"
"github.com/gin-gonic/gin"
)
func GetJwtGenerator(c *gin.Context) {
generator := jwtgen.GetJwtGenerator(c.PostForm("alg"))
c.Set("generator", generator)
}
|
9e14be69ca52c6d407935d72bdaf35dbfedf679d | 8dd5db2d3272eb78823c4900ad882145ce5d5446 | rochabr/firebase-custom-auth | /main.go | Go | go | 320 | no_license | package main
import (
firebase "firebase-custom-auth/driver"
http "firebase-custom-auth/http/rest"
"fmt"
"google.golang.org/appengine"
)
func main() {
//Initializing Firebase
err := firebase.Init()
if err != nil {
fmt.Println("Error initializing firebase:", err.Error())
}
http.Run()
appengine.Main()
}
|
ec0898020d63924548025ed439a258056a6ad2a7 | fe526346b0e57fa8daae3ba450d0879966d3c6ea | chentaihan/leetcode | /treeTag/bstToGst.go | Go | go | 1,299 | no_license | package treeTag
/**
1038. 从二叉搜索树到更大和树
给出二叉 搜索 树的根节点,该二叉树的节点值各不相同,修改二叉树,使每个节点 node 的新值等于原树中大于或等于 node.val 的值之和。
提醒一下,二叉搜索树满足下列约束条件:
节点的左子树仅包含键 小于 节点键的节点。
节点的右子树仅包含键 大于 节点键的节点。
左右子树也必须是二叉搜索树。
示例:https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/05/03/tree.png
输入:[4,1,6,0,2,5,7,null,null,null,3,null,null,... |
9a30b101cf45c18ece6f36372e5bd26457f4ed2f | 886b1780d9b1a3abab4b06ff9334b34faefe98f3 | balena-os/balena-engine | /integration-cli/docker_cli_push_test.go | Go | go | 14,567 | permissive | package main
import (
"archive/tar"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"strings"
"sync"
"testing"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/integration-cli/cli/build"
"gotest.tools/v3/assert"
"gotest.tools/v3/icm... |
99fd648a652e4147744cf9702c5a140ab8ffc366 | d0976a4a21ca7338bcac6127826e603b72e431f2 | lenuse/ego | /helper/debug.go | Go | go | 460 | no_license | package helper
import (
"fmt"
"runtime"
)
// Debug 打印信息
func Debug(params ...interface{}) {
_, file, line, ok := runtime.Caller(1)
if ok {
fmt.Printf("[Trace]%s[%d]:%v \n", file, line, params)
}
}
// Trace 返回trace日志
func Trace() []string {
trace := []string{}
for i := 0; i < 10; i++ {
_, file, line, ok :=... |
a8d8dd705e0bd8f645acd44a31959d1ea6dd4b4b | 42c8ed1419b38b6d5abfcb0e1854fa5e1e6cd612 | BluntSporks/readability | /fk.go | Go | go | 400 | permissive | package read
import (
"github.com/mtso/syllables"
)
// Fk scores the Flesch-Kincaid Grade Level.
// See https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests.
func Fk(text string) float64 {
syllableCount := float64(syllables.In(text))
wordCnt := float64(CntWords(text))
sentCnt := float64(CntSents... |
e779024362e280e46d92d44c9f2c215cc3f7b173 | dde73cc51090b47c437ab3f020fdee35d70d82b0 | bitpie-wallet/solana-go-sdk | /client/simulate_transaction.go | Go | go | 1,052 | no_license | package client
import (
"context"
"errors"
)
type SimulateTransactionConfig struct {
SigVerify bool `json:"sigVerify"` // default: false
PreflightCommitment Commitment `json:"preflightCommitment"` // default: max
Encoding string `json:"encoding"` // base58 or b... |
2d61138c521f699a032eb7a458fad25ee5475a2e | 57eafbfb9041df2a57faeca8af70b0650e0456ab | gojoy/learntogo | /hskcrawler/base.go | Go | go | 2,420 | no_license | package main
import (
"fmt"
"github.com/henrylee2cn/pholcus/common/goquery"
"log"
"math"
"net/http"
"os"
"regexp"
"strconv"
)
var logg = log.New(os.Stdout, "log:", log.Lshortfile)
func main() {
total()
return
var (
name string = "工作"
url string = "http://yuliaoku.hanyu123.cn/index.php/hsk/index/hsk... |
deb3b2a0ee75c97b97c77ec89ce5d26cf43217d1 | 4ca1baa2fbd90524552289c0222d3b7ac8235805 | frntn/minio | /erasure_test.go | Go | go | 5,992 | permissive | /*
* Minio Cloud Storage, (C) 2016 Minio, 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 la... |
7ef2d84f5c5ea3814cddf0d4956ea8c1e5656cc0 | 5f5669c39d14d7255d76bb05775fe852951acfb4 | zhigangxi/utility | /go/xlsx/excel/gen_json.go | Go | go | 3,173 | no_license | package excel
import (
"bytes"
"fmt"
"strings"
)
func (c *CfgData) dataToJson(exportType string) *bytes.Buffer {
var codeBuf bytes.Buffer
codeBuf.WriteString("{\n")
if !c.appendTableDataJson(&codeBuf, exportType) {
return nil
}
codeBuf.WriteString("}\n")
return &codeBuf
}
func (c *CfgData) appendTableData... |
4fd820861e45d44f7db3e235be678c225f04f593 | 10aefc065d212116194c7a15499002fc56110d38 | iotopo/iotopo-sdk-go | /distrlock/lock.go | Go | go | 411 | permissive | package distrlock
import (
"github.com/bsm/redislock"
"github.com/iotopo/iotopo-sdk-go/cache"
)
var (
// ErrNotObtained is returned when a lock cannot be obtained.
ErrNotObtained = redislock.ErrNotObtained
// ErrLockNotHeld is returned when trying to release an inactive lock.
ErrLockNotHeld = redislock.ErrLock... |
6115ef5a713b8b25a4d22b0fc8200b97531dd35e | 42ee79c29ba122872ccd3c64bfbb0e93cae88697 | bigbigbigfish/go_matrix_cuda | /cuda_kernel_add_bias.go | Go | go | 1,646 | permissive | package mt
const KER_MATRIX_ADD_BIAS = `
//
// Generated by NVIDIA NVVM Compiler
// Compiler built on Thu Mar 13 19:31:35 2014 (1394735495)
// Cuda compilation tools, release 6.0, V6.0.1
//
.version 4.0
.target sm_30
.address_size 64
.visible .entry matrixAddBias(
.param .u64 matrixAddBias_param_0,
.param .u64 ma... |
b9a720797ca08565da3be894f3d3a4887c1df0b1 | f93059590af53036ff2718ef965afd60f3e74e5d | rhatdan/buildah | /tests/tools/vendor/github.com/golangci/golangci-lint/pkg/result/processors/sort_results.go | Go | go | 3,510 | permissive | package processors
import (
"sort"
"strings"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/result"
)
// Base propose of this functionality to sort results (issues)
// produced by various linters by analyzing code. We're achieving this
// by sorting results.Issues using pro... |
c33bf47e2ce22c1d6f1342a9988c20bd4ef4bc32 | e38f31ecaa74ce42b8d758c2670181d948b877f7 | txominpelu/fnd | /screen/screen.go | Go | go | 1,752 | permissive | package screen
import (
"strings"
"github.com/gdamore/tcell"
)
type ContentBlock struct {
r rune
style tcell.Style
}
type Row struct {
blocks []ContentBlock
width int
}
func (row *Row) writeRune(r rune, x int, style tcell.Style) {
row.blocks[x].r = r
row.blocks[x].style = style
}
func (row *Row) writ... |
e4f92e35a9da08c6bec402810b820a796cb9e01e | a925eecdd20b383f9eb7a8cbcc0d1fc83b052126 | carne-vore/weaviate | /database/resolver.go | Go | go | 480 | permissive | package database
import (
graphql_local_get "github.com/creativesoftwarefdn/weaviate/graphqlapi/local/get"
)
type dbClosingResolver struct {
connectorLock ConnectorLock
}
func (dbcr *dbClosingResolver) Close() {
dbcr.connectorLock.Unlock()
}
func (dbcr *dbClosingResolver) LocalGetClass(info *graphql_local_get.Lo... |
d453d326c6ff06d9a671a8aaa6f17a7305907da6 | fbcb491dbb2b2015dcbb5c2411d7b70012c9c46a | Venutios/mbsyslog | /Client.go | Go | go | 1,642 | permissive | package mbsyslog
import (
"errors"
"net"
"sync"
)
//Client is a syslog client to send messages to syslog servers
type Client struct {
syncSend bool
wg sync.WaitGroup
asyncError error
mutex *sync.Mutex
}
//NewClient prepares a client to send messages
func NewClient(syncSend bool) *Client {
resu... |
cc20a8878d81b720b122ddc5a181bdc1bcd5534b | c325067917f962573c8802ac8ad8d5480ca59a36 | cyril-corbon/tfsec | /internal/app/tfsec/rules/aws/iam/set_max_password_age_rule.go | Go | go | 2,476 | permissive | package iam
import (
"fmt"
"github.com/aquasecurity/tfsec/pkg/result"
"github.com/aquasecurity/tfsec/pkg/severity"
"github.com/aquasecurity/tfsec/pkg/provider"
"github.com/aquasecurity/tfsec/internal/app/tfsec/hclcontext"
"github.com/aquasecurity/tfsec/internal/app/tfsec/block"
"github.com/aquasecurity/tfs... |
e3f0ff635762d19eb3062bb90bde8a2c1ecc69a0 | 7866feff09fb6ace660fac1352d9627984480137 | postwait/gopacket | /layers/dns_test.go | Go | go | 11,859 | no_license | // Copyright 2012, Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree.
package layers
import (
"bytes"
"net"
"testing"
"github.com/postwait/gopacket"
)
// testPacketDNSRegression is the pac... |
4ac935952220fcb3140a4aa7ea63af2211726f84 | 490d3e5a6d7e2109af4060f80b500268e4296e58 | laikas123/IC_Microservices_Final | /Client/main.go | Go | go | 1,881 | no_license |
package main
import (
"context"
"flag"
"io"
"log"
"math/rand"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
//again we provide an alias for our directory
pb "github.com/laikas123/IC_Microservices/ProtoFiles"
//these are just test credentials found online
"google.golang.org/grpc/... |
a2e0f1cb398928a9e2719f4aac39704a3adeab87 | 394197ad2910872abaebc369bb68a90f8179815e | jaanek/jeth | /eth/method.go | Go | go | 4,787 | no_license | package eth
import (
"context"
"fmt"
"strings"
"time"
"github.com/holiman/uint256"
"github.com/jaanek/jeth/abi"
"github.com/jaanek/jeth/rpc"
"github.com/jaanek/jeth/ui"
"github.com/ledgerwatch/erigon/common"
"github.com/ledgerwatch/erigon/crypto"
)
type MethodSpec struct {
Name string
Inputs []string... |
81c783f317091ed9d142a299d988aa34a6acac3e | d0d99f35af0ee71ce6fd238cc9e8f1f4b49e74d6 | mathworks/arrow | /go/parquet/cmd/parquet_reader/main.go | Go | go | 10,559 | permissive | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
54bf06a93a78d4e237d3a3eee36a39f6ff4e6e2d | 422c9867155f20005fa2974d030904a4c882a3d2 | onethefour/REST-GO-demo | /untils/Signature_test.go | Go | go | 1,743 | permissive | package untils
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/huobiapi/REST-GO-demo/config"
)
func generateParameters() map[string]string {
params := make(map[string]string)
params["AccessKeyId"] = config.ACCESS_KEY
params["SignatureMethod"] = "HmacSHA256"
params["SignatureVers... |
4ac6dc85033e2dfcb40c92672bacdba6d647bd86 | dcee418f6e07f14b5ebb0e8fb3d1593283ccfb97 | jochenczemmel/gogenperllist | /usage/player_Player_perllist_generated.go | Go | go | 4,311 | no_license | package main
// PlayerList contains a slice of Player values
type PlayerList struct {
elements []Player
}
// NewPlayerList creates a new List of Player values
// with optional initial values
func NewPlayerList(values ...Player) *PlayerList {
return &PlayerList{values}
}
// Len returns the length of the underlyin... |
54710e2fbc3cf050094e05d7458f5366aec55bb5 | 9d78ea7740de79d703646de68255980e66d9b455 | RomanSeven7/gin_study | /middleware/rotatefilehook.go | Go | go | 956 | no_license | package middleware
import (
"github.com/sirupsen/logrus"
"gopkg.in/natefinch/lumberjack.v2"
"io"
)
type RotateFileConfig struct {
Filename string
MaxSize int
MaxBackups int
MaxAge int
Level logrus.Level
Formatter logrus.Formatter
}
type RotateFileHook struct {
Config RotateFileConfig
log... |
655a3568ac8eaa43e7b401ffb91cbebb57e46a3f | 3a45ec08aa4adc67f08174eb26eeaf20c102e991 | nivertech/CryptoWriter | /cryptowriter.go | Go | go | 3,297 | permissive | package main
/*
rootVIII
cryptowriter.go -
Download and write crypto-currency
historical data to CSVs in the CWD.
EXAMPLE USAGE:
go build cryptowriter.go
./cryptowriter bitcoin
./cryptowriter bitcoin litecoin ethereum
v1.1
*/
import (
"encoding/csv"
"fmt"
"io/ioutil"
"net/http"
"os"
"regexp"
"strings"
"sync"
... |
9196ac4ae4ec3d33618f19c2d1d591eef7ffa607 | 26243dd09ca70476f95786cadd4e404f9482e1ea | integr8ly/route-monitor-operator | /pkg/util/finalizer/finalizer_test.go | Go | go | 3,291 | permissive | package finalizer_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/route-monitor-operator/pkg/util/finalizer"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
var _ = Describe("Finalizer", func() {
const (
key = "fake-key"
secondKey = "second-fake-key"
)
var (... |
0c5f5dd25aa05819f30566236f5a0ef68ce82c81 | 6204f748752fc05cb173032f2abfd4c78d9d8a62 | jimm/exercism | /go/food-chain/food_chain_test.go | Go | go | 2,991 | no_license | package foodchain
import (
"strings"
"testing"
)
const testVersion = 1
func TestTestVersion(t *testing.T) {
if TestVersion != testVersion {
t.Errorf("Found TestVersion = %v, want %v.", TestVersion, testVersion)
}
}
var ref = []string{``,
`I know an old lady who swallowed a fly.
I don't know why she swallowe... |
69891d630d1d5cbe5a17f4ae6946d7efbf29c79b | 71528f7e338534be2e32e01d98846819ec7c94ec | bitspill/flod | /blockchain/mediantime_test.go | Go | go | 3,954 | permissive | // Copyright (c) 2013-2017 The btcsuite developers
// Copyright (c) 2018 The Flo developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package blockchain
import (
"strconv"
"testing"
"time"
)
// TestMedianTime tests the medianTime implementation.
func TestMe... |
83afaa8eadfc6a4d763a5c0178ba62acd7883fcf | 63006bab7b47c0e8dbcf37ed29a88a9b983c3c20 | feng-tao/airflow-operator | /pkg/client/clientset/versioned/typed/airflow/v1alpha1/airflowcluster.go | Go | go | 5,908 | permissive | /*
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... |
234addd9cebd5f959f1bc96425f1287d0f1b5da5 | 7b4e7805f4f1c7aec47c5e7f9ea6da4a31b354c2 | forj-oss/forjj | /forjfile/apps.go | Go | go | 547 | permissive | package forjfile
import "fmt"
type AppsStruct map[string]*AppStruct
func (a AppsStruct) Found(appName string) (*AppStruct, error) {
if v, found := a[appName]; !found {
return nil, fmt.Errorf("Application '%s' not defined.", appName)
} else {
return v, nil
}
}
func (a AppsStruct) mergeFrom(from AppsStruct) Ap... |
3c24073b4d5aa6f46c222287525d5dcefd7c84f8 | 204da01d28bc90c80fdfe3b72f9d82d93d2bbbed | melq/go-practice | /prime-number/prime_number.go | Go | go | 738 | no_license | package main
import (
"bufio"
"fmt"
"math"
"os"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
func next() string {
sc.Scan()
return sc.Text()
}
func nextInt() int {
i, err := strconv.Atoi(next())
if err != nil {
panic(err)
}
return i
}
func main() {
n := nextInt()
var a []int
for i := 0; i < n; ... |
6753e8cc8234331624ec610bd894b3b7b7863104 | 6c75075bfd4d64fd614a8869e9684866e2952500 | tencentcloudplatform/tcpicli | /feecenter/gen.go | Go | go | 771 | permissive | // +build ignore
package main
import (
. "."
"github.com/tencentcloudplatform/tcpicli/autogen"
)
type Pkg struct{}
func (p *Pkg) DoAction(action string, query ...string) ([]byte, error) {
return DoAction(action, query...)
}
func main() {
payerUin := "payerUin=100000655192" // china account uin
gen := &autoge... |
8bc8016e9c4d6477a6048c9207baa996588d502a | 0a31298d3dcdb60bde54188660d81348b664bde7 | mojocn/recommend-go | /ALS/examples/main.go | Go | go | 1,620 | permissive | package main
import (
"fmt"
"github.com/timkaye11/goRecommend/ALS"
)
func main() {
// For this instance, cols indicate product ID ; rows indicate user ID. Remember indexing starts at 0.
Q := ALS.MakeRatingMatrix([]float64{
5, 5, 5, 0, 1,
0, 0, 0, 4, 1,
1, 2, 3, 3, 1,
2, 0, 4, 1, 0,
5, 2, 0, 1, 0}, 5, 5)... |
6d29d85aae2ac0dd0c4b3a97784ec8a922023ed1 | fe2909be43b50d4864d45b61235927a08b894e4a | laudarch/iso20022 | /PledgeeFormat4Choice.go | Go | go | 1,186 | permissive | package iso20022
// Choice between formats for the entity to which the financial instruments are pledged.
type PledgeeFormat4Choice struct {
// Identification of the entity to which the financial instruments are pledged expressed as a code and a BIC.
TypeAndIdentification *PledgeeTypeAndAnyBICIdentifier1 `xml:"TpAn... |
9e191f79b369f3466b9de3612245a7ac3e81c452 | 104774a7a2cc6677adf2d689cc3f68febae19c63 | sgtest/monorepo-test-3 | /kubernetes-11/pkg/client/clientset_generated/clientset/typed/extensions/v1beta1/extensions_client.go | Go | go | 3,484 | 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, ... |
cc86f209c0b32697b2c40195abbbaeb7789af8a1 | 6fe0b550a806bc336d535f664a6494824851546f | emretiryaki/rabbitmq | /messagebroker.go | Go | go | 4,951 | no_license | package rabbitmq
import (
"encoding/json"
"fmt"
"github.com/streadway/amqp"
"golang.org/x/net/context"
"time"
)
type (
MessageBroker interface {
CreateChannel() (*Channel, error)
CreateConnection(parameters MessageBrokerParameter) error
SignalConnectionStatus(status bool)
SignalConnection() chan bool
... |
2df7ef4acfc091997470c6368add53883b0a9187 | a9aeec38e923edd1b0f7a0c03f5c6da40a211f15 | laudarch/iso20022 | /sese/TransferInCancellationRequestV03.go | Go | go | 3,144 | permissive | package sese
import (
"encoding/xml"
"github.com/fgrid/iso20022"
)
type Document00600103 struct {
XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:sese.006.001.03 Document"`
Message *TransferInCancellationRequestV03 `xml:"TrfInCxlReq"`
}
func (d *Document00600103) AddMessage() *TransferInCancellationReques... |
06bc04cc2d2badfbc3234a5499eabd7631f309e3 | 807dfd540a2dae8dbf62320c248695e8f10e7476 | jordankama/codeql-action-sync-tool | /cmd/push.go | Go | go | 2,262 | permissive | package cmd
import (
"os"
"github.com/github/codeql-action-sync/internal/cachedirectory"
"github.com/github/codeql-action-sync/internal/environment"
"github.com/github/codeql-action-sync/internal/push"
"github.com/github/codeql-action-sync/internal/version"
"github.com/spf13/cobra"
)
var pushCmd = &cobra.Comma... |
52526ca0f6238b2c1d5fa7e1e0bca1e659e7ed28 | 546a700d368ae59053e96fa7104d061eaf008d14 | slasyz/panda | /src/parser/fields_proxy.go | Go | go | 1,102 | permissive | package parser
import (
"errors"
"github.com/slasyz/panda/src/handle"
"net/url"
)
// parseServerParameterProxy sets value of "proxy" server instance.
func parseServerParameterProxy(name, sign, value string, custom *handle.ServerFieldsProxy, currentFileName string) (err error) {
switch name {
case ... |
5ba92e2853bdbff4e00ae5cb30786ade6f18557d | 300331f4ad8de7e21a4f564c0dcf74e76fa3318f | VladimirStarostenkov/fabric | /examples/chaincode/go/chaincode_example05/chaincode_example05.go | Go | go | 5,436 | 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... |
c85a51fe7a169f4819c3a1ef7d98d796c67ab894 | 1ee4a26cca5892abf4e74629e24d1e8232b14790 | mullumaus/GoLang-algorithm | /http/assignment/printArea.go | Go | go | 479 | no_license | package main
type triangle struct {
base float64
height float64
}
type square struct {
sideLength float64
}
type shape interface {
getArea() float64
}
func main() {
sq := square{sideLength: 10}
ta := triangle{base: 10, height: 40}
printArea(sq)
printArea(ta)
}
func (ta triangle) getArea() float64 {
retur... |
a1d5693cddfa608e7b1bcb3cfbf3dfb14553e31d | 0dc2361ddfbe20270dda7dbd9a39c64722518c32 | travis-ci/pudding | /image.go | Go | go | 327 | no_license | package pudding
// Image is the internal representation of an EC2 instance
type Image struct {
ImageID string `json:"image_id" redis:"image_id"`
Role string `json:"role" redis:"role"`
Active bool `json:"active" redis:"active"`
Name string `json:"name" redis:"name"`
State string `json:"state" redis:"sta... |
561cddf3a26bd023467a64abdb963916dfef5c59 | 57dcf20305dee8190763846db598572371fbe138 | XiaCo/practice | /algorithms/stack/reverse_substrings_between_each_pair_of_parentheses.go | Go | go | 796 | no_license | package stack
// https://leetcode-cn.com/problems/reverse-substrings-between-each-pair-of-parentheses/
// 输入:s = "(ed(et(oc))el)"
// 输出:"leetcode"
// 解释:先反转子字符串 "oc" ,接着反转 "etco" ,然后反转整个字符串。
func reverseParentheses(s string) string {
sub := [][]byte{{}}
for index := range s {
b := s[index]
if b == '(' {
sub ... |
c041a79288bf62f9d57f93bbd276b50ac04aecb3 | 0568f17f18038daa749d8c8e3f46927f6f0770b5 | ellcrys/docker | /daemon/logger/jsonfilelog/read_test.go | Go | go | 1,451 | permissive | package jsonfilelog // import "github.com/ellcrys/docker/daemon/logger/jsonfilelog"
import (
"bytes"
"testing"
"time"
"github.com/ellcrys/docker/daemon/logger"
"github.com/gotestyourself/gotestyourself/assert"
"github.com/gotestyourself/gotestyourself/fs"
)
func BenchmarkJSONFileLoggerReadLogs(b *testing.B) {
... |
b4ae9840e6cbce143ff6ca80419e02b4eae9f3da | e0b27f4c85ee778aa2bc3ea10e0f8ae139b697bb | k-takata/wxgo_kevin-yuan | /wx/window.go | Go | go | 38,650 | permissive | package wx
import (
"reflect"
)
//#include "window.h"
import "C"
func init() {
mapType("wxWindow", reflect.TypeOf(window{}))
}
//TODO: constants.
type DragResult int
type window struct {
evtHandler
}
func (w *window) delete() {
C.wxWindow_Destroy(w.p)
}
func (w *window) AcceptsFocus() bool {
p := ptr(w)
if... |
38fb28c9e3e61d22ea9316854a266b1bf20f77d8 | 23eb7b5aff81ce432a8774a3e6b1cc2b0677c53c | doublEeVil/my-blog | /tests/default_test.go | Go | go | 950 | no_license | package test
import (
"net/http"
"net/http/httptest"
"testing"
"runtime"
"path/filepath"
_ "my-blog/routers"
"github.com/astaxie/beego"
. "github.com/smartystreets/goconvey/convey"
)
func init() {
_, file, _, _ := runtime.Caller(1)
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(f... |
e3dbada627bd1d3b80917354b10a6010ea54bcdd | 088821688d685b39abe98dc3612eb4182a5217d6 | futoase/td-client-go | /examples/server_status.go | Go | go | 311 | permissive | package main
import (
"fmt"
"github.com/futoase/td-client-go"
"io/ioutil"
)
func main() {
r, err := ioutil.ReadFile("apikey.txt")
if err != nil {
panic(err)
}
options := td.NewOptions(string(r))
client := td.NewTreasureData(options)
s := client.ServerStatus()
fmt.Printf("status: %v", s.Status)
}
|
d12641d86bb4b11e04be9c73e356f77ed6eba78d | 58813788bdf0e0c776888bec9bc19b7b3558a3a9 | dogmatiq/marshalkit | /envelope.go | Go | go | 2,176 | permissive | package marshalkit
import (
"fmt"
"reflect"
"time"
"github.com/dogmatiq/configkit"
"github.com/dogmatiq/dogma"
"github.com/dogmatiq/interopspec/envelopespec"
)
// MustMarshalMessageIntoEnvelope marshals a Dogma message into an envelopespec.Envelope.
func MustMarshalMessageIntoEnvelope(
vm ValueMarshaler,
m d... |
1fdee19be3fbf961a69ec2c6debf6acf0fac174b | ec17893733c369bce2cc0e924d4db7bd9dd67956 | GeomaticM/hydra-consent-app-go | /ven/github.com/ory/fosite/handler/oauth2/strategy.go | Go | go | 1,798 | permissive | // Copyright © 2017 Aeneas Rekkas <aeneas+oss@aeneas.io>
//
// 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 appl... |
5e52bba5347fc860af94e8856d6555e2b4c52d4f | 65fa18df14c0654e6ae48b00036656513f091e0c | Pungyeon/message-queue | /queue/client.go | Go | go | 1,711 | no_license | package queue
import (
"bufio"
"fmt"
"log"
"net"
"strconv"
)
// Client is a struct for interacting with the queue messaging service
type Client struct {
host string
port int
subscription net.Conn
}
// NewClient will initialise a new message queue client
func NewClient(host string, port int) *... |
1db28459cdc46dd6e3a38406072f43f7c61b592c | 6293c80d6deac6c0555e987cb7a2e86d9df62d33 | roofimon/time_tracker_api | /repository/mongo_repository.go | Go | go | 791 | no_license | package repository
import (
"time"
"github.com/roofimon/time_tracker_api/model"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
const MongoDateFormat = "2006-01-02"
type MongoRepository struct {
collection *mgo.Collection
}
func (repository *MongoRepository) Insert(person model.Person) {
repository.collection.Ins... |
416d175d136c21c2f0438f2aa568c7b75cc7bcc1 | 098bd614c7f0994fa3ff1eea823b0de732e0c839 | freeformz/opentelemetry-go | /sdk/trace/tracer.go | Go | go | 2,826 | permissive | // Copyright 2019, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
ab1a5f1350a93861ce7039557980984c82312623 | 6195e8defd845f7c8426da06776755db6d4d2c3c | dualsystems/osmosis | /x/lockup/types/codec.go | Go | go | 1,124 | permissive | package types
import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)
func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgLockTokens{}, "osmosis/lockup/lock-token... |
327df4a1a9e030d9893c5d3585c7cbfd64f429bd | b6baa29c0853811014ad2c80340a89af38eb21a6 | punalpatel/geard | /cmd/gear/commands.go | Go | go | 27,620 | permissive | package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/url"
"os"
"path/filepath"
"regexp"
"time"
"github.com/openshift/docker-source-to-images/go"
"github.com/openshift/geard/cleanup"
. "github.com/openshift/geard/cmd"
"github.com/openshift/geard/config"
"github.com/openshift/... |
a8fb176c1405086d41c0267d1336656d9c5bdf47 | edf17e5c71d09fd1f7a61c3429d1cc1d08281126 | morrell/pulumi-azure-native | /sdk/go/azure/authorization/v20200501/getResourceManagementPrivateLink.go | Go | go | 1,366 | 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 v20200501
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupResourceManagementPrivateLink(ctx *pulumi.Context, args *LookupResourceManage... |
509622a1b49b4b8f9c14e05584b69ecddfa07467 | 2a87541954f4b45f436fd91e8f5a8ac1c5a10fa1 | stklv/v2ray-core | /infra/conf/v4/socks.go | Go | go | 3,294 | permissive | package v4
import (
"encoding/json"
"strings"
"github.com/golang/protobuf/proto"
"github.com/v2fly/v2ray-core/v5/common/protocol"
"github.com/v2fly/v2ray-core/v5/common/serial"
"github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon"
"github.com/v2fly/v2ray-core/v5/proxy/socks"
)
type SocksAccount struct {
Use... |
61ff21348273bdae7a6afae1f0f973307578b692 | 22037154f76ba79a770daa8a991920547ef9df0e | openshift/router | /pkg/router/template/util/haproxy/whitelist.go | Go | go | 807 | permissive | package haproxy
import (
"strings"
)
const (
// HAPROXY_MAX_LINE_ARGS is the maximum number of arguments that haproxy
// supports on a configuration line.
// Ref: https://github.com/haproxy/haproxy/blob/master/include/common/defaults.h#L75
HAPROXY_MAX_LINE_ARGS = 64
// HAPROXY_MAX_WHITELIST_LENGTH is the maxim... |
44519606f12863053383ccf5e708e1a7a0e16ad2 | 4c1fe63e90b1cb393ef830872eacd5677402d47b | masonchen2014/go-zero | /core/mathx/int.go | Go | go | 241 | permissive | package mathx
// MaxInt returns the larger one of a and b.
func MaxInt(a, b int) int {
if a > b {
return a
}
return b
}
// MinInt returns the smaller one of a and b.
func MinInt(a, b int) int {
if a < b {
return a
}
return b
}
|
71207c54835cb83b0595020cd6e34bab16176eae | 12007154fa722a829e7d3c332d12743a82f20d5e | bluesoftdev/mockery | /httpmock/mockery_test.go | Go | go | 3,618 | permissive | package httpmock
import (
. "github.com/bluesoftdev/go-http-matchers/predicate"
"github.com/stretchr/testify/assert"
"net/http/httptest"
"regexp"
"testing"
)
func TestServeHTTP(t *testing.T) {
handler := Mockery(func() {
Header("SNAFU", "BAZ")
pathPattern := regexp.MustCompile("/foo/bar/snafu.*")
Endpoin... |
b1c686e2a66873f5dd2cb77afdafb321cb6b0e07 | 6c19b9b4a8187247962193e4d25929f6678e883c | avesanen/blog | /handlers.go | Go | go | 5,393 | no_license | package main
import (
"encoding/json"
"fmt"
"github.com/zenazn/goji/web"
"html/template"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
)
func requiresLogin(h web.HandlerFunc) web.HandlerFunc {
fn := func(c web.C, w http.ResponseWriter, r *http.Request) {
if s := getSession(r); s == nil {
renderTemp... |
b1d3dfcec66aa0ea0977c1fbeecb720ea4927f7f | 26bc15c63eb77bb0e5704128164a9ce2e66edb7f | julienlefur/kubermatic | /pkg/install/stack/kubermatic-master/certmanager.go | Go | go | 2,943 | permissive | /*
Copyright 2020 The Kubermatic Kubernetes Platform contributors.
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 ... |
651a826df47ce652e7f2dd30f5523d2b00c32e13 | 784ba6a3fcbf82a781c2b2c6350d3b1f6db5ec96 | mori5321/forwarding | /client/main.go | Go | go | 317 | no_license | package main
import (
"io"
"log"
"net"
"os"
)
func main() {
conn, err := net.Dial("tcp", "localhost:8888")
if err != nil {
log.Fatal(err)
}
defer conn.Close()
mustCopy(os.Stdout, conn)
}
func mustCopy(dst io.Writer, src io.Reader) {
if _, err := io.Copy(dst, src); err != nil {
log.Fatal(err)
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.